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

implement span suppression

Open brettmc opened this issue 7 months ago • 1 comments

Is your feature request related to a problem? When multiple auto-instrumentation packages are installed, we can see nested/redundant extra CLIENT spans. Ideally, and according to spec, there should only be one CLIENT span per operation, and the child of a CLIENT span should be a remote SERVER span.

Some discussion in https://github.com/open-telemetry/opentelemetry-php-contrib/pull/361#discussion_r2059679351

Describe the solution you'd like Java has SpanSuppressionStrategy to achieve this, and that might be a good way to go.

I think that ultimately we would want an auto-instrumentation to not create a CLIENT span if one has already been created (however, it should still perform other logic such as injecting trace propagation headers).

Also consider whether we can use this to resolve #1534

A PoC has been developed in https://github.com/open-telemetry/opentelemetry-php/pull/1599 so if we go ahead with that, I think the steps should be:

  • [x] merge #1599
  • [ ] action TODO from #1599 ("must suppress no-op spans too")
  • [ ] include inherited attributes when generating this resolver (for example db.system.name is missing in all span.db.*.client semconvs) (see https://github.com/open-telemetry/opentelemetry-php/pull/1599#discussion_r2384103959)
  • [ ] add tests
  • [ ] implement declarative configuration (probably under instrumentation.php.span_suppression
  • [ ] document how it works, or some common "recipes"

brettmc avatar May 05 '25 01:05 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 Jul 19 '25 05:07 stale[bot]