fix(sdk): wire meterProvider for span self-observability metrics and add otel.sdk.span.ended#1990
Conversation
…add otel.sdk.span.ended SdkAutoloader was not passing the meterProvider to TracerProviderBuilder, so TracerSharedState always received null and never created the otel.sdk.span.started / otel.sdk.span.live counters even when OTEL_PHP_INTERNAL_METRICS_ENABLED=true. TracerProviderFactory (used directly in examples) had the same gap — it was not forwarding a meterProvider to either SpanProcessorFactory or TracerProvider. Also implements otel.sdk.span.ended (defined in SemConv but previously unrecorded): counter is created in TracerSharedState alongside spanStartedCounter and incremented in Span::end() with the otel.span.sampling_result attribute.
|
Thanks for opening your first pull request! If you haven't yet signed our Contributor License Agreement (CLA), then please do so that we can accept your contribution. A link should appear shortly in this PR if you have not already signed one. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1990 +/- ##
============================================
- Coverage 68.02% 68.00% -0.03%
- Complexity 3075 3076 +1
============================================
Files 459 459
Lines 9017 9020 +3
============================================
Hits 6134 6134
- Misses 2883 2886 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 3 files with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
…eters - Drop otel.sdk.span.ended (deprecated since spec 1.36.0; derive from otel.sdk.span.started - otel.sdk.span.live instead) - Pass schemaUrl to getMeter() in all 5 SDK self-observability sites (TracerSharedState, Span processors, ExportingReader, LoggerSharedState)
SdkAutoloader was not passing the meterProvider to TracerProviderBuilder, so TracerSharedState always received null and never created the otel.sdk.span.started / otel.sdk.span.live counters even when OTEL_PHP_INTERNAL_METRICS_ENABLED=true.
TracerProviderFactory (used directly in examples) had the same gap — it was not forwarding a meterProvider to either SpanProcessorFactory or TracerProvider.
Also implements otel.sdk.span.ended (defined in SemConv but previously unrecorded): counter is created in TracerSharedState alongside spanStartedCounter and incremented in Span::end() with the otel.span.sampling_result attribute.