Thursday, May 12, 2022

Pattern: Exception tracking


How to understand the behavior of an application and troubleshoot problems?


  • Exceptions must be de-duplicated, recorded, investigated by developers and the underlying issue resolved
  • Any solution should have minimal runtime overhead


Report all exceptions to a centralized exception tracking service that aggregates and tracks exceptions and notifies developers.

When an exception is logged by a service, it’s important to identify the cause. Exceptions indicate a problem or a programming error. Logs are traditionally used to view exceptions. You could even configure the logging server to alert you if an exception is logged in the log file. This has several drawbacks, however:

  • Log files consist of single-line log entries, while exceptions have multiple lines.
  • In log files, there is no mechanism to track the resolution of exceptions. You would need to manually copy/paste the exception into the issue tracker.
  • There’s no way to automatically treat duplicate exceptions as one.

Exception tracking services are a better approach. Services report exceptions to a centralized service, which de-duplicates exceptions, generates alerts, and manages exception management. Exception tracking services like Honeybadger and Sentry are available.


Resulting Context

This pattern has the following benefits:

  • It is easier to view exceptions and track their resolution
  • The exception tracking service is an additional infrastructure

You may also like

Kubernetes Microservices
Python AI/ML
Spring Framework Spring Boot
Core Java Java Coding Question
Maven AWS