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

SpringWebTelemetry span name contains only HTTP method #8839

Closed
jkamon opened this issue Jun 30, 2023 · 4 comments · Fixed by #8933
Closed

SpringWebTelemetry span name contains only HTTP method #8839

jkamon opened this issue Jun 30, 2023 · 4 comments · Fixed by #8933
Labels
enhancement New feature or request

Comments

@jkamon
Copy link

jkamon commented Jun 30, 2023

Is your feature request related to a problem? Please describe.
No

Describe the solution you'd like
Interceptor created by SpringWebTelemetry creates spans named only by HTTP method. Metadata correctly contains also original URL wich would be much more specific and describing in span. Probably best solution would be to implement getRoute method on SpringWebMvcHttpAttributesGetter which would most probably generate correct name

Describe alternatives you've considered
Change in SpringWebTelemetryBuilder to allow custom name extractor would be also acceptable since user will be able to define its own name extractor which would generate more descriptive names.

Additional context
Used version 1.27.0-alpha

@jkamon jkamon added the enhancement New feature or request label Jun 30, 2023
@laurit
Copy link
Contributor

laurit commented Jun 30, 2023

SpringWebMvcHttpAttributesGetter is used by SpringWebMvcTelemetry(server instrumentation) not SpringWebTelemetry(client instrumentation). Which are you interested in SpringWebTelemetry or SpringWebMvcTelemetry?

@jkamon
Copy link
Author

jkamon commented Jun 30, 2023

Thanks for clarification. Now when you pointed it out it is clear that it should be implemented in both:
SpringWebMvcHttpAttributesGetter
SpringWebHttpAttributesGetter
they both share the same 'mistake' and final spans are reported like this:
onlyHTTPmethod

Top level span comes somewhere from OtelPropagator or something like this and is named somehow OK. Later two are created by mentioned classes and are named only POST (green one is from my application named pokus, blue one is from http which is resttemplate). Please do not mind the failures it was only local test.

@laurit
Copy link
Contributor

laurit commented Jun 30, 2023

Otel specification gives guidelines for naming these spans https://opentelemetry.io/docs/specs/otel/trace/semantic_conventions/http/#name
@mateuszrzeszutek wdyt about letting users override the span name? Should we let users set SpanNameExtractor or Function<SpanNameExtractor, SpanNameExtractor> so that the original extractor could be wrapped or something else?

@mateuszrzeszutek
Copy link
Member

Should we let users set SpanNameExtractor or Function<SpanNameExtractor, SpanNameExtractor> so that the original extractor could be wrapped or something else?

It should be a Function<SpanNameExtractor, SpanNameExtractor> -- we want to allow decoration of the original extractor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
3 participants