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

Support WithSpanNameFormatter to otelecho #6363

Open
gifff opened this issue Nov 24, 2024 · 6 comments
Open

Support WithSpanNameFormatter to otelecho #6363

gifff opened this issue Nov 24, 2024 · 6 comments
Labels
area: instrumentation Related to an instrumentation package enhancement New feature or request instrumentation: otelecho

Comments

@gifff
Copy link

gifff commented Nov 24, 2024

Problem Statement

otelecho lacks support of custom span name formatter like one in otelhttp.

Proposed Solution

Add WithSpanNameFormatter option to otelecho.

Alternatives

Prior Art

func WithSpanNameFormatter(f func(operation string, r *http.Request) string) Option {
return optionFunc(func(c *config) {
c.SpanNameFormatter = f
})
}

Additional Context

@pellared
Copy link
Member

Why would we need to create a custom span name? I feel that the instrumentation library should follow the semantic conventions the semantic conventions: https://opentelemetry.io/docs/specs/semconv/http/http-spans/#name. The user can always create a child span with a custom name.

@dmathieu
Copy link
Member

I would add: is this issue based on an actual need (could you describe it?), or is it just for parity with otelhttp?

@flc1125
Copy link
Member

flc1125 commented Nov 26, 2024

mark

@gifff
Copy link
Author

gifff commented Nov 27, 2024

Why would we need to create a custom span name? I feel that the instrumentation library should follow the semantic conventions the semantic conventions: https://opentelemetry.io/docs/specs/semconv/http/http-spans/#name. The user can always create a child span with a custom name.

I’m new to opentelemetry and currently learning to integrate it with existing system. So my initial plan was to annotate the span name with some prefixes so the span name becomes Echo/HTTP GET /some/actions for handlers and ServiceX/HTTP GET /some/other/actions for outgoing HTTP calls. I decided to use span.kind for filtering and add custom attribute to identify different http.Client(s).

Thanks for the pointer to the semantic conventions! I haven't gone through it.

@flc1125
Copy link
Member

flc1125 commented Nov 27, 2024

I decided to use span.kind for filtering and add custom attribute to identify different http.Client(s).

This is a very good choice. I am doing the same at the moment. And there are no problems at all.

dmathieu added a commit that referenced this issue Nov 28, 2024
from:
#6363

This change adjusts the default span name and does not support backward
compatibility.

---------

Co-authored-by: Damien Mathieu <[email protected]>
Co-authored-by: Robert Pająk <[email protected]>
@flc1125
Copy link
Member

flc1125 commented Dec 3, 2024

@pellared For this reason, we need to re-evaluate whether we need to add this feature.

#6375 (comment)

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

No branches or pull requests

4 participants