Skip to content

otelgin: Add a WithSpanOptions option #7247

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

Open
sdwa0 opened this issue Apr 21, 2025 · 4 comments · May be fixed by #7261
Open

otelgin: Add a WithSpanOptions option #7247

sdwa0 opened this issue Apr 21, 2025 · 4 comments · May be fixed by #7261
Assignees
Labels
area: instrumentation Related to an instrumentation package enhancement New feature or request instrumentation: otelgin

Comments

@sdwa0
Copy link

sdwa0 commented Apr 21, 2025

Problem Statement

otelgin instrumentation doesn't provide a way to add extra attributes, links, etc. to the spans it generates, like the otelhttp instrumentation does.

Proposed Solution

Add a WithSpanOptions(opts ...trace.SpanStartOption) otelgin.Option.

@sdwa0 sdwa0 added area: instrumentation Related to an instrumentation package enhancement New feature or request instrumentation: otelgin labels Apr 21, 2025
@arshukla98
Copy link
Contributor

Hi @sdwa0 , I would like to take up this issue.

arshukla98 added a commit to arshukla98/opentelemetry-go-contrib that referenced this issue Apr 22, 2025
@arshukla98 arshukla98 linked a pull request Apr 24, 2025 that will close this issue
@akats7
Copy link
Contributor

akats7 commented Apr 24, 2025

@dmathieu do you think it makes sense to expose this as a config option for a framework middleware? Exposing it in otelhttp makes more sense since it's more generic, but for something like otelgin what would be a StartSpanOption that shouldn't be decided by the middleware

@flc1125

@flc1125
Copy link
Member

flc1125 commented Apr 25, 2025

My personal opinion is that adding WithSpanOptions would have minimal impact on the current components. To some extent, it provides more flexibility for operations.

As a supplement, WithSpanOptions appears to be a misnamed location.

@dmathieu
Copy link
Member

otelhttp could also add specific span options in a middleware. I think this option is more a convenience.
And in the sake of similarity, I think having having it in otelgin is fine.

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: otelgin
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants