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

feat(spring-mvc): Fallback to name Span including requestURI #10951

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

deas
Copy link

@deas deas commented Mar 25, 2024

Adding opentelemetry-spring-boot-starter defaults to create an instance of WebMvcTelemetryProducingFilter for Spring WebMvc Applications . This filter applies to all requests.

However, you only get "beautiful span names" for mappings of type RequestMappingHandlerMapping. I understand this is most likely related to the desire to group path patterns under a common span name.

For other, non RequestMappingHandlerMapping based requests, you get the bare HTTP method - e.g. GET for the span name.

Sure, the name WebMvc hints at Spring WebMvc, but the filter creates spans already. Besides, the code around it already does most of the wiring you want in more bare situations (e.g. Servlet).

Wouldn't it be reasonable to fallback to requestURI based paths, so we get GET /not-request-mapping-handler-mapping instead of GET span names when the request is not RequestMappingHandlerMapping based?

The attached patch does the trick for me.

@deas deas requested a review from a team as a code owner March 25, 2024 13:30
Copy link

linux-foundation-easycla bot commented Mar 25, 2024

CLA Signed


The committers listed above are authorized under a signed CLA.

@github-actions github-actions bot added the test native This label can be applied to PRs to trigger them to run native tests label Mar 25, 2024
@trask
Copy link
Member

trask commented Mar 26, 2024

hi @deas! span names need to have low cardinality, I think falling back to the full path could give unbounded cardinality?

check out https://github.com/open-telemetry/opentelemetry-specification/blob/65875014e15fa9739501413b3349961d503c0630/specification/trace/api.md?plain=1#L315-L316

@deas
Copy link
Author

deas commented Mar 26, 2024

Maybe we can make "default to request URI" opt-in for those how think they know what they are doing? ;)

I am using the filter with the OpenCMIS AtomPub Servlet at the moment. URI cardinality appears to be very low using the request URI. All the details are covered by the query string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test native This label can be applied to PRs to trigger them to run native tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants