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

Offen
#4,802 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 2 Tagen

@sid200727 arbeitet bereits daran.

Seit 30.1.2026.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
45/100
Issue-Typ
Feature
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
python

Rechercherichtung

Beginne mit exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/exporter.py und verfolge, wie der Channel erstellt und an den Stub übergeben wird. Untersuche anschließend die init-Methoden von verwendenden Exportern wie OTLPSpanExporter und OTLPMetricExporter. Erledigt ist die Aufgabe, wenn Aufrufer über diese Exporter einen Channel-Interceptor bereitstellen können und der Interceptor angewendet wird, bevor der Client-Stub erstellt wird.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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.

Vorherrschende Sprache
Python
Sterne
2.7k
Forks
1.1k
Ø Merge
3 T. 12 Std.
Gemergte PRs (30 T.)
16

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus open-telemetry/opentelemetry-python

Alle Issues in open-telemetry/opentelemetry-python

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.