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

未關閉 適合新手
#5,891 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 2 天內回覆

還沒有人認領這個 Issue。

  • #5902 來自 @2Zest —— 已關閉,未合併

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
78/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
python

研究方向

閱讀 opentelemetry-sdk/src/opentelemetry/sdk/_shared_internal/_processor_metrics.py,尤其是 ProcessorMetrics.__init__ 和 register_queue_size。檢查現有的佇列大小 observable callback 如何註冊,並與同步容量測量進行比較。當 span 和 log 佇列容量指標都使用 observable callback,且在 meter provider 註冊後以及 Delta 收集週期中仍可使用時,即表示完成。

由索引模型根據 Issue 內容生成。

描述

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).

主要語言
Python
星號
2.7k
分支
1.1k
平均合併
4 天 13 分鐘
30 天內合併 PR
38

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

open-telemetry/opentelemetry-python 的其他 Issue

查看 open-telemetry/opentelemetry-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。