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 · 5 comments
Open

Support WithSpanNameFormatter to otelecho #6363

gifff opened this issue Nov 24, 2024 · 5 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.

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