Skip to content

Fix route handling when local root span wasn't created by instrumentation api #13588

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

Merged
merged 2 commits into from
Mar 27, 2025

Conversation

laurit
Copy link
Contributor

@laurit laurit commented Mar 26, 2025

Resolves #13583
Currently instrumentation api sets local root only when parent span is either invalid or remote. If the parent span is not created by instrumentation api then the local root span will remain unset and the server span won't be set in http route state. Ideally if the server span is created outside of the instrumentation api we'd like to suppress our server span, but one of the side-effects of having spans that are not created with instrumentation api is that span suppression won't work since we rely on context keys set by instrumentation api to determine whether there already is a server span. I'm not completely convinced that this is the right thing to do but route not being updated when there is a non instrumentation api parent is unexpected. Another option we could try is that instead of setting the local root span we could just update the server span in the http route state and leave the local root unset. @trask WDYT? This PR fixes updating the route state when the root span wasn't created by instrumentation api.

@laurit laurit requested a review from a team as a code owner March 26, 2025 12:20
@trask
Copy link
Member

trask commented Mar 26, 2025

Another option we could try is that instead of setting the local root span we could just update the server span in the http route state and leave the local root unset

ideally this seems better to me if it works, so that we can preserve the definition of local root

@laurit laurit changed the title Set first span created by instrumentation api as local root Fix route handling when local root span wasn't created by instrumentation api Mar 26, 2025
@laurit laurit merged commit 389b153 into open-telemetry:main Mar 27, 2025
86 checks passed
@laurit laurit deleted the local-root branch March 27, 2025 06:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Spring Web MVC http.route attribute not set on http server metrics when used with Micrometer ServerHttpObservationFilter
2 participants