opentelemetry-php icon indicating copy to clipboard operation
opentelemetry-php copied to clipboard

Include more than just the method in opentelemetry-auto-symfony HttpClientInstrumentation

Open NeilWhitworth opened this issue 1 year ago • 4 comments

Is your feature request related to a problem? We are consuming an api (served from api.example.com) that references images (served from images.example.com). However since all http(s) requests only use the method as the span name, it is impossible to distinguish requests going to the different hosts.

Describe the solution you'd like Include additional distinguishing information in the span name. Possibly using the target url host-name

Describe alternatives you've considered

  • Use the target request schema/host/port combination
  • Use base_uri if available

Additional context From to https://opentelemetry.io/docs/specs/semconv/http/http-spans/

HTTP span names SHOULD be {method} {target} if there is a (low-cardinality) target available.

Instrumentation MUST NOT default to using URI path as a {target}

NeilWhitworth avatar Oct 11 '24 22:10 NeilWhitworth

HTTP span names SHOULD be {method} {target} if there is a (low-cardinality) target available. Instrumentation MUST NOT default to using URI path as a {target}

This is the heart of the issue. We cannot move URI & friends up into the span name, and so far we have not come up with a way to create a low-cardinality target from a general URI.

I think this is actually a UI issue, and you need a way to "pull up" existing span metadata and display it alongside the span's name - interesting parts of the URI are already stored against the span, in other attributes such as URL_FULL, URL_PATH...

brettmc avatar Oct 13 '24 11:10 brettmc

@brettmc why not at least use the hostname, that should count as low cardinality.

POST api.example.com

much better than

POST

dkarlovi avatar Oct 16 '24 12:10 dkarlovi

why not at least use the hostname

That's what was proposed in the linked PR. Can discuss over there: https://github.com/open-telemetry/opentelemetry-php-contrib/pull/305

brettmc avatar Oct 16 '24 21:10 brettmc

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 27 '25 02:04 stale[bot]

This issue has been automatically closed because it has not had recent activity, but it can be reopened. Thank you for your contributions.

stale[bot] avatar Jul 19 '25 05:07 stale[bot]