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

http.route attribue #442

Closed
iNikem opened this issue May 26, 2020 · 8 comments · Fixed by #5266
Closed

http.route attribue #442

iNikem opened this issue May 26, 2020 · 8 comments · Fixed by #5266

Comments

@iNikem
Copy link
Contributor

iNikem commented May 26, 2020

Semantic convention for HTTP server spans defines attribute http.route:

The matched route (path template). E.g. "/users/:userID".

Currently instrumentations don't create this attribute. I think we should, but I am not quite sure which span should have this attribute. In case of a typical Java web application the first span created will usually come from generic middleware, such as Servlets or similar. It has no notion of route yet, just the full URL. Then, when request processing reaches actual web framework, such as Spring or jax-rs, second span will be created (potentially with kind=INTERNAL). At this point instrumentation can get used route information from the framework.

Where this attribute should now go? To parent span of kind SERVER (which has all other http attributes like http.url and http.method) or to a current span of kind INTERNAL, which has no other http attributes?

@trask
Copy link
Member

trask commented May 27, 2020

I believe it should go on the SERVER span.

We already have instrumentation to capture the route as part of the SERVER span name (to conform with the current span name guidelines), so I think this would be added in the same places in the code, calling now span.setAttribute("http.route", ...) in addition to span.updateName(...).

@iNikem
Copy link
Contributor Author

iNikem commented May 28, 2020

@tylerbenson said during last Java SIG meeting that he really dislikes this inter-instrumentation communication, when we modify already existing spans. And I tend to agree with him. If we continue to do this, we HAVE to do that in more explicit and transparent way. Which I don't know yet :)

Can we always be sure that SERVER span is still present when we create child spans? Can it happen that in some async processing server span will be already sent out to collector?

@iNikem
Copy link
Contributor Author

iNikem commented May 28, 2020

Also, modifying existing spans goes against e.g. #388. Also https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/api.md#span says:

It is highly discouraged to update the name of a Span after its creation. Span name is often used to group, filter and identify the logical groups of spans. And often, filtering logic will be implemented before the Span creation for performance reasons. Thus the name update may interfere with this logic.

@trask
Copy link
Member

trask commented May 29, 2020

The primary reason that updateName() exists is to handle this example, where you don't know the route when the SERVER span starts, and so initially you set the span name to something generic (like in #428), and then later when you know the route, you call updateName() on the SERVER span to set the span name to the route.

(also, see open-telemetry/opentelemetry-specification#468 which is proposing to remove that warning about updating the name of a Span)

@iNikem
Copy link
Contributor Author

iNikem commented May 29, 2020

Ok, I see your point. But in this case I think we still need much clearer and more explicit way for any span to find parent/root span. Current approach is too well hidden and non-obvious.

@trask
Copy link
Member

trask commented Jun 1, 2020

Nice, #465 will also solve this 👍

@sirianni
Copy link
Contributor

sirianni commented Apr 1, 2021

The absence of the http.route label is one of the things blocking us from migrating off of https://github.com/DataDog/dd-trace-java to this library. According to Datadog, the http.route label is used to categorize endpoints for the APM UI.

@mateuszrzeszutek
Copy link
Member

mateuszrzeszutek commented Jan 12, 2022

A couple of TODOs from #5086:

GA automation moved this from To do to Done Jan 31, 2022
Stable instrumentation-api automation moved this from In progress to Done Jan 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

4 participants