otel.sdk.processor.{span,log}.queue.capacity uses synchronous UpDownCounter recorded once in __init__

Open Beginner friendly
#5,891 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

  • #5902 by @2Zest — closed without merging

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python

Research direction

Read opentelemetry-sdk/src/opentelemetry/sdk/_shared_internal/_processor_metrics.py, especially ProcessorMetrics.__init__ and register_queue_size. Check how the existing queue size observable callback is registered and compare it with the synchronous capacity measurements. Done means both span and log queue capacity metrics use observable callbacks and remain available after the meter provider is registered and across Delta collection cycles.

Written by the indexing model from the issue text.

Description

Description

In ProcessorMetrics.__init__, otel.sdk.processor.span.queue.capacity and otel.sdk.processor.log.queue.capacity are created as synchronous UpDownCounter instruments and recorded once during __init__:

https://github.com/open-telemetry/opentelemetry-python/blob/66ec88357e964dfda9b225975afc0d87ae4e95bb/opentelemetry-sdk/src/opentelemetry/sdk/_shared_internal/_processor_metrics.py#L93-L95

This causes queue.capacity to be missing in two common scenarios:

  1. When BatchSpanProcessor or BatchLogRecordProcessor is constructed before metrics.set_meter_provider(...) is called (including in opentelemetry-instrument auto-instrumentation), get_meter_provider() returns _ProxyMeterProvider, whose _ProxyUpDownCounter.add() is a no-op and does not replay measurements when the real MeterProvider is registered.
  2. When the MetricReader uses Delta aggregation temporality for UpDownCounter, the single .add(capacity) call in __init__ is only reported on the first collection cycle and is missing from all subsequent collections.
Expected behavior

otel.sdk.processor.span.queue.capacity and otel.sdk.processor.log.queue.capacity should be registered as asynchronous ObservableUpDownCounter callbacks (matching register_queue_size on lines 97-117).

Dominant language
Python
Stars
2.7k
Forks
1.1k
Avg merge
4d 13m
Merged PRs (30d)
38

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from open-telemetry/opentelemetry-python

All issues in open-telemetry/opentelemetry-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.