Error count reported is higher than expected in DX APM Java Agent
search cancel

Error count reported is higher than expected in DX APM Java Agent

book

Article ID: 445290

calendar_today

Updated On:

Products

DX SaaS DX Operational Observability DX Application Performance Management

Issue/Introduction

In certain Spring Boot applications, the DX APM Java Agent may report error counts (Errors Per Interval) that are two to three times higher than the actual number of exceptions triggered. This typically occurs when a custom global error handler and a log filter both process the same exception, leading to multiple metric increments for a single transaction.

Symptoms

  • Metrics show error counts significantly higher (e.g., 3x) than expected values.
  • Unavoidable alerts are triggered due to inflated error data.
  • Transaction traces show multiple error events for a single request.

Environment

  • DX Application Performance Management
  • DX APM Java Agent 24.9.1 and higher
  • Spring Boot Applications
  • VMware Cloud Foundation (VCF) / Cloud Foundry environments

Cause

The discrepancy is caused by how the Spring Boot server handles uncaught exceptions when using custom filters (e.g., LogFilter) and global exception handlers. If a servlet or filter throws an exception, the request is forwarded to a custom error page. Because the agent monitors servlet service methods, it detects the original request and the forwarded error page request as separate events, counting the error for each.

Resolution

To resolve the overcounting of errors, implement the following changes:

Consolidate error handling logic so that only one component (either the Global Exception Handler or the LogFilter) attempts to write to the response or log the error event.

Additional Information

  • If you need to troubleshoot further, you can temporarily enable DEBUG logging by adding: -Dintroscope.agent.log.level.root=DEBUG -Dintroscope.agent.log.destination=console,logfile
  • For more information refer to the DX Agents documentation