opentelemetry-dotnet icon indicating copy to clipboard operation
opentelemetry-dotnet copied to clipboard

Exception handled in ExceptionHandler middleware is recorded by ASP.NET Core instrumentation

Open vishweshbankwar opened this issue 2 years ago • 2 comments

If the exception thrown during request processing is handled using Exception Handler middleware, the exception is currently recorded by the instrumentation. However, this does not match with the definition of RecordException which calls out Unhandled exceptions specifically. The issue occurs due to the following reason:

The diagnostic source event name that is written in case of handled exception by handler is Microsoft.AspNetCore.Diagnostics.HandledException and in case of unhandled exception is Microsoft.AspNetCore.Diagnostics.UnhandledException. However, due to the pattern matching both handled and unhandled exceptions are recorded.

Related issue #3495.

vishweshbankwar avatar Aug 01 '22 21:08 vishweshbankwar

We should remove pattern matching and rely on exact names!

cijothomas avatar Aug 01 '22 22:08 cijothomas

@cijothomas @alanwest - one of the ways we can achieve this https://github.com/open-telemetry/opentelemetry-dotnet/pull/3519

open to comments / other ideas.

vishweshbankwar avatar Aug 02 '22 20:08 vishweshbankwar

Closed via #3519

cijothomas avatar Sep 26 '22 18:09 cijothomas