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

Fix datadog incorrect resource names added semconv attribute http.route #5420

Closed

Conversation

MrwanBaghdad
Copy link

Added http.route key in the span attribute to fix Datadog of resource name as it depends on http.method + http.route

@MrwanBaghdad MrwanBaghdad requested a review from a team as a code owner April 21, 2024 19:47
Copy link

linux-foundation-easycla bot commented Apr 21, 2024

CLA Signed


The committers listed above are authorized under a signed CLA.

Copy link
Member

@dmathieu dmathieu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, you would be setting http.route as the target, not the route.
The target is /posts/42, while the route is /posts/:id.

If we cannot get the route, it should not be set.
See https://github.com/open-telemetry/semantic-conventions/blob/b77c881ad68dca7bb7af2c97899a0ef64357c47c/docs/http/http-spans.md#http-server-semantic-conventions

@@ -407,6 +407,7 @@ func (c *httpConv) ServerRequest(server string, req *http.Request) []attribute.K

if target != "" {
attrs = append(attrs, c.HTTPTargetKey.String(target))
attrs = append(attrs, c.HTTPTargetKey.String(target))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is using HTTPTargetKey, so it's setting the http.target attribute twice, not http.route.

@MrAlias
Copy link
Contributor

MrAlias commented Jun 26, 2024

This looks blocked and stale, closing. @MrwanBaghdad if this is in error, please reopen and update/respond to the feedback provided by @dmathieu.

@MrAlias MrAlias closed this Jun 26, 2024
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.

None yet

3 participants