Make it possible to intercept the gRPC channel for OTLP based export

未關閉
#4,802 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 2 天內回覆

@sid200727 已經在處理了。

開始於 2026年1月30日。

評估

難度
3/5
預估耗時
1-2 天
新手友好度
45/100
Issue 類型
功能
描述清晰度
基本清楚
活躍度
停滯
技術堆疊
python

研究方向

從 exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/exporter.py 開始,追蹤 channel 的建立方式,以及它如何傳遞給 stub。接著檢查使用它的 exporter(例如 OTLPSpanExporter 和 OTLPMetricExporter)的 init 方法。完成的標準是:呼叫端可以透過這些 exporter 提供 channel interceptor,且 interceptor 會在建立 client stub 之前套用。

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

描述

feature-request
Is your feature request related to a problem?

I'm having trouble with a particular use of OTLP export, and it would have been helpful to be able to use gRPC channel interceptors as a debugging tool.

https://grpc-interceptor.readthedocs.io/en/latest/#client-interceptors

However, there is no way to pass down an interceptor into the OTLP gRPC exporter code.

Describe the solution you'd like

In the code here:
https://github.com/open-telemetry/opentelemetry-python/blob/main/exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/exporter.py

A sketch of the logic might be something like:

+ def _default_interceptor(channel):
+  return channel

class OTLPExporterMixin(
   ...
   channel_options=...,
+ channel_interceptor=None):
+ channel_interceptor = channel_interceptor or _default_interceptor
...
+ self._channel = channel_interceptor(self._channel)
self._client = self._stub(self._channel)  # type: ignore [reportCallIssue]
...

Along with exposing access to channel_interceptor in the __init__ methods of the consuming classes (e.g. OTLPSpanExporter, OTLPMetricExporter, etc.)

Describe alternatives you've considered

No response

Additional Context

No response

Would you like to implement a fix?

None

Tip

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

主要語言
Python
星號
2.7k
分支
1.1k
平均合併
3 天 12 小時
30 天內合併 PR
16

環境準備

從這裡開始

  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 摘要。