-
Notifications
You must be signed in to change notification settings - Fork 923
Description
Is your feature request related to a problem? Please describe.
The problem I'm trying to solve is to send metrics and traces (later logs) over OTLP with authentication. This works well with otel-collector-contrib with using the authentication extensions. However this would require the Java application to use send through a locally running collector which would then be used to send to the next step in the pipeline. This adds resource usage and complexity.
In Java I can create a SpanExporter implementation that simply wraps OtlpHttpSpanExporter and set it up to be loaded by the java-instrumentations autoconfiguration. The issue here is that headers are being set as part of creating the exporter and can't be changed, while they are actually used on a per request basis. This requires the wrapper to teardown and setup a completely new delegated OtlpHttpSpanExporter each time the auth token needs to be refreshed and the header updated.
For metrics as far as I can tell there is no support yet for easily setting up a your own MetricExporter using autoconfiguration (but might have just missed it).
Describe the solution you'd like
I can see to straightforward ways to expand the capabilities here, but there are most likely other ideas out there.
- Enable headers to accept a lambda that returns the string and is called on each request. This should be enough to at least support oauth setting a Authorization token.
- Extend the SDK API to enable a type of Auth extension similar to otel-collector. This would allow building more complex authentication protocols that might require more than just a simple header call back.
Describe alternatives you've considered
Running otel-collector as an extra step, or creating wrapped exporters.
CC @trask