Skip to content

[Feature]: Allow async interceptors for OTLP GRPC exporter #2881

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
valkum opened this issue Mar 28, 2025 · 0 comments
Open

[Feature]: Allow async interceptors for OTLP GRPC exporter #2881

valkum opened this issue Mar 28, 2025 · 0 comments
Labels
enhancement New feature or request triage:todo Needs to be traiged.

Comments

@valkum
Copy link
Contributor

valkum commented Mar 28, 2025

Related Problems?

Google just released their tracing OTLP endpoint. This endpoint needs authorization metadata.
Tonic provides interceptors to inject auth metadata and those are exposed via WithTonicConfig::with_interceptor. In contrast to tonic, this interceptor is maintained outside of tonic and just allows returning metadata that is then set in the export functions.
Getting a valid bearer token normally requires an async operation, and interceptors are currently non-async only.
Currently, you would need to duplicate a lot of code to have blocking counterparts.

Describe the solution you'd like:

To support this kind of auth, opentelemetry-otlp should support adding async interceptors via WithTonicConfig.

The tonic native way would be using tower layers to add async interceptor functionality. There currently isn't a helper to do so. There is a standalone crate tonic-async-interceptor, but this also needs a tower layer.

With the current integration of interceptors in TonicTracesClient, the least invasive solution would provide an async interceptor variant that is just awaited in the returned future in export and would add the metadata to the request similarly to the current interceptor.

Considered Alternatives

No response

Additional Context

One common way would be to use gcp_auth which provides bearer tokens for use in an async manner.

Related: open-telemetry/opentelemetry-specification#4390 open-telemetry/opentelemetry-specification#1344

@valkum valkum added enhancement New feature or request triage:todo Needs to be traiged. labels Mar 28, 2025
@valkum valkum changed the title [Feature]: Allow tower layers for OTLP GRPC exporter [Feature]: Allow async interceptors for OTLP GRPC exporter Mar 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request triage:todo Needs to be traiged.
Projects
None yet
Development

No branches or pull requests

1 participant