Skip to content

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

@michaelsafyan

Description

@michaelsafyan

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions