Allow listening to TaskCanceled exceptions on HTTP client instrumentation #1793
Labels
comp:instrumentation.http
Things related to OpenTelemetry.Instrumentation.Http
enhancement
New feature or request
Feature Request
Is your feature request related to a problem?
I would like to add custom tags when timeouts happen on clients using the auto instrumentation, but currently when a HTTP Request is canceled and the request fails neither
OnStopActivity
norOnException
are called using theoptions.Enrich
hook.It seems this happens because when a Task is canceled the onStopActivity is called (and it handles tasks canceled):
https://github.com/open-telemetry/opentelemetry-dotnet/blob/884b224508351a65ab260c404fad5e25b341db97/src/OpenTelemetry.Instrumentation.Http/Implementation/HttpHandlerDiagnosticListener.cs#L160-L178
And since there is no response the
onStopActivity
will not be called:https://github.com/open-telemetry/opentelemetry-dotnet/blob/884b224508351a65ab260c404fad5e25b341db97/src/OpenTelemetry.Instrumentation.Http/Implementation/HttpHandlerDiagnosticListener.cs#L180-L198
Describe the solution you'd like:
Maybe OnStopActivity or OnException could be called signaling the timeout?
The text was updated successfully, but these errors were encountered: