Expected behavior of HttpClientInstrumentation RecordException=true #1788
Labels
comp:instrumentation.http
Things related to OpenTelemetry.Instrumentation.Http
question
Further information is requested
When should HttpClientInstrumentation create an Activity Event when RecordException=true??
Describe your environment.
n/a
Describe any aspect of your environment relevant to the question.
What are you trying to achieve?
I'd like to get the exception details from outbound HttpClient requests added as Activity Events when RecordException=true
Here is my startup.cs configuration:
If the parent service fails I get an Activity Event with the Exception details. I can also see that the
activityEventName
in my EnrichParentSpan method isOnException
and it gives me access to the Exception object.If an outbound request fails (404) the client span does not have an Activity Event with the Exception details, but it will set the
error
tag to true and thestatus.code
tag to 2. When debugging my EnrichChildSpan method theactivityEventName
isOnStopActivity
and I'll get access to the HttpResponseMessage object.What did you expect to see?
I expected the behavior for inbound and outbound Exception processing to be the same, namely that if an error is returned from an outbound call it would log the same as an inbound call.
Is the expectation that I would code the response processing myself in my EnrichChildSpan method and to something like this??
The
HttpHandlerDiagnosticListener
has an exception method that will record the exception, but it doesn't get hit. Not sure if this is intended, thanks for the clarification.Additional Context
Add any other context about the problem here. If you followed an existing
documentation, please share the link to it.
The text was updated successfully, but these errors were encountered: