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 is stopped passing to attribute #464

Open
sc-yan opened this issue Feb 5, 2025 · 0 comments
Open

http.route is stopped passing to attribute #464

sc-yan opened this issue Feb 5, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@sc-yan
Copy link

sc-yan commented Feb 5, 2025

Describe the bug
it'd be rather a change than a bug. in our app, we send otel metrics to datadog. and after a upgrade of "opentelemetry_phoenix" from 1.2 -> 2.0, we found that the span names from HTTP requests are changed from "{http.method} {http.route}" to only ""{http.method}. and this is caused by this commit, which introduced some change and the span name thus is different.

from the spec, the span name should be

 {http.method} {http.route} (when route is available)
{http.method} (when route is not available)

but the commit above stopped passing "http.route" to the attribute.

Expected behavior
we expect "http.route" is passed into attribute.

Additional context
without http.route

Image

with http.route

Image

I created a PR to fix this.

I also have a question. when I log out the span to stdout, I can see the span name is what we want. but if I export it to opentelemetry_exporter, the name would be only {http.method}. I guess there is some process in exporter to change the span name again...?

*SPANS FOR DEBUG*
{span,40098462596871963769597534857057185735,9764691286833948456,
      {tracestate,[]},
      undefined,<<"GET /healthz">>,server,-576460743204758000,
      -576460743168924708,
      {attributes,128,infinity,0,
                  #{'server.address' => <<"localhost">>,'server.port' => 4000,
                    'http.response.status_code' => 200,
                    'client.address' => <<"127.0.0.1">>,
                    'http.request.method' => 'GET',
                    'network.peer.address' => <<"127.0.0.1">>,
                    'network.peer.port' => 54071,'url.path' => <<"/healthz">>,
                    'url.scheme' => http,
                    'user_agent.original' => <<"PostmanRuntime/7.43.0">>,
                    'network.protocol.version' => '1.1',
                    'phoenix.action' => index,
                    'phoenix.plug' =>
                        'Elixir.xxxxxWeb.HealthzController',
                    'http.route' => <<"/healthz">>,
                    'url.template' => <<"/healthz">>}},
      {events,128,128,infinity,0,[]},
      {links,128,128,infinity,0,[]},
      undefined,1,false,
      {instrumentation_scope,<<"opentelemetry_cowboy">>,<<"1.0.0">>,
                             undefined}}

@sc-yan sc-yan added the bug Something isn't working label Feb 5, 2025
@sc-yan sc-yan changed the title "http.route" is missing in attribute http.route is missing in attribute Feb 5, 2025
@sc-yan sc-yan changed the title http.route is missing in attribute http.route is stopped passing to attribute Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant