Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Labeler support for traced spans #4231

Open
austince opened this issue Aug 23, 2023 · 2 comments
Open

Labeler support for traced spans #4231

austince opened this issue Aug 23, 2023 · 2 comments
Labels
area: instrumentation Related to an instrumentation package enhancement New feature or request instrumentation: otelhttp

Comments

@austince
Copy link

Problem Statement

Using the otelhttp.Labeler is a nice way to get custom attributes into the metrics produced by the instrumentation. When trying to correlate this metric data with other sources, like spans, it would be helpful to have these custom attributes on both the metric and span data.

Proposed Solution

Add the attributes from the labeler to the span after serving.
Something like https://github.com/open-telemetry/opentelemetry-go-contrib/compare/main...austince:opentelemetry-go-contrib:feat/support-span-labeler?expand=1

Alternatives

Have a separate SpanLabeler or such. This seemed more complex than valuable.

@austince austince added area: instrumentation Related to an instrumentation package enhancement New feature or request instrumentation: otelhttp labels Aug 23, 2023
@dmathieu
Copy link
Member

otelhttp has a WithSpanOptions which allows doing that.

@austince
Copy link
Author

@dmathieu thanks for the link! I see there's a WithAttributes SpanStartEventOption, but that only allows setting statically known attributes. The otelhttp.Labeler allows dynamic attributes that can be attached in other route middleware -- is there a way to do that using WithSpanOptions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: instrumentation Related to an instrumentation package enhancement New feature or request instrumentation: otelhttp
Projects
None yet
Development

No branches or pull requests

2 participants