Skip to content

HttpClient spans don't show up as exemplars #103893

@JamesNK

Description

@JamesNK

Description

I'm adding a new exemplar feature to the Aspire dashboard. Basically, when a metric is recorded, in-progress spans are included as example data.

However, I never see the HttpClient span as an exemplar. Someone should investigate why and fix this.

I don't know exactly how this feature technically works. However, my theory is the HttpClient span is ended before http.client.request.duration recorded, so the HttpClient activity isn't available for opentelemetry-sdk to associate with the metric. The order may need to be flipped: record http.client.request.duration and then stop the activity. I think it is a matter of making the metrics handler a child of the diagnostics handler here.

Reproduction Steps

Capture OTEL data with metrics + exemplars enabled + make HTTP requests with HttpClient.

See dotnet/aspire#4629 for an example.

Expected behavior

HttpClient spans show update as exemplars.

Actual behavior

HttpClient spans are never exemplars.

Regression?

No

Known Workarounds

No response

Configuration

.NET 8

Other information

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions