ExceptionHandler middleware mutes http_server_request_duration_seconds_count metrics on exceptions #52766
Closed
1 task done
Labels
area-middleware
Includes: URL rewrite, redirect, response cache/compression, session, and other general middlesware
✔️ Resolution: Duplicate
Resolved as a duplicate of another issue
Status: Resolved
Is there an existing issue for this?
Describe the bug
Consider the following .NET 8 minimal api application with OTEL metrics enabled.
When I run the application in Developer mode, I see that the
http_server_request_duration_seconds_count
metrics is emmited for the failed request and also enriched because of this line of code: DiagnosticsTelemetry.ReportUnhandledException(_logger, context, ex);.This is the enriched metric:
So
http_server_request_duration_seconds_count
is increased for every invocation on the "/crash" route and also enriched with the error_type.Now, as soon as I start the app with the "Production" environment, where the following line kicks in:
the
http_server_request_duration_seconds_count
metric is now longer emitted for the failed requests.Expected Behavior
I dont know why
ExceptionHandlerMiddlewareImpl
"mutes" thehttp_server_request_duration_seconds_count
metric for endpoints with exceptions. Maybe I'm missing something and it makes sense, but for me the behaviour doesn't make sense.Is this possibly a bug or as designed?
Steps To Reproduce
Run the following app:
http_server_request_duration_seconds_count
metric.NET Version
.NET 8
The text was updated successfully, but these errors were encountered: