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

Trace sdk processor metrics

Open dashpole opened this issue 8 months ago • 1 comments
trafficstars

Adds otel.sdk.processor.span.queue.size, otel.sdk.processor.span.queue.capacity, and otel.sdk.processor.span.processed.count metrics to the trace batch span processor.

These are defined in https://github.com/open-telemetry/semantic-conventions/blob/cb11bb9bac24f4b0e95ad0f61ce01813d8ceada8/docs/otel/sdk-metrics.md, and are experimental. Because of this, metrics are behind the OTEL_GO_X_SELF_OBSERVABILITY feature gate.

Given the feature is experimental, it always uses the global meterprovider when enabled.

dashpole avatar Mar 02 '25 18:03 dashpole

Codecov Report

:x: Patch coverage is 80.64516% with 12 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 83.0%. Comparing base (c5e68b2) to head (e162018). :warning: Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
sdk/trace/batch_span_processor.go 80.3% 8 Missing and 4 partials :warning:
Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main   #6393   +/-   ##
=====================================
  Coverage   82.9%   83.0%           
=====================================
  Files        264     264           
  Lines      24574   24634   +60     
=====================================
+ Hits       20392   20451   +59     
+ Misses      3802    3800    -2     
- Partials     380     383    +3     
Files with missing lines Coverage Δ
sdk/trace/provider.go 86.4% <ø> (+1.0%) :arrow_up:
sdk/trace/tracer.go 95.9% <100.0%> (ø)
sdk/trace/batch_span_processor.go 80.4% <80.3%> (+2.1%) :arrow_up:

... and 2 files with indirect coverage changes

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Mar 02 '25 18:03 codecov[bot]

I remember why I didn't get this merged now... Unit tests for the queue size are hard to write without race conditions.

dashpole avatar Jul 16 '25 14:07 dashpole

Figured out how to get unit tests to work.

dashpole avatar Jul 17 '25 19:07 dashpole

@pellared rebased on your PR, and updated to use your feature gate

dashpole avatar Jul 22 '25 17:07 dashpole

Codecov failure is from not testing otel.Handle(err) calls.

dashpole avatar Jul 29 '25 00:07 dashpole