Skip to content

Commit

Permalink
Merge pull request #43003 from NipunaMadhushan/include-error-metric
Browse files Browse the repository at this point in the history
Include response error count metric
  • Loading branch information
NipunaMadhushan authored Jul 1, 2024
2 parents ac3ec4c + 2c64bc9 commit 735fb35
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ private void stopObservation(ObserverContext observerContext) {
"Total response response time for all requests", tags)).increment(duration);
metricRegistry.counter(new MetricId("requests_total",
"Total number of requests", tags)).increment();
if (statusCode != null && 400 <= statusCode && statusCode < 600) {
metricRegistry.counter(new MetricId("response_errors_total",
"Total number of response errors", tags)).increment();
}
} catch (RuntimeException e) {
handleError("multiple metrics", tags, e);
}
Expand Down

0 comments on commit 735fb35

Please sign in to comment.