opentelemetry-dotnet
opentelemetry-dotnet copied to clipboard
Exception handled in ExceptionHandler middleware is recorded by ASP.NET Core instrumentation
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.
We should remove pattern matching and rely on exact names!
@cijothomas @alanwest - one of the ways we can achieve this https://github.com/open-telemetry/opentelemetry-dotnet/pull/3519
open to comments / other ideas.
Closed via #3519