opentelemetry-collector
opentelemetry-collector copied to clipboard
Dynamic headers to OTLP Exporter
Is your feature request related to a problem? Please describe. Today only static headers are allowed in OTLP exporter. I would like to have an option to pass dynamic headers to OTLP exporter.
Describe the solution you'd like
Ability to set the header in OTLP exporter dynamically from attributes processor for example.
receivers: otlp: protocols: grpc: include_metadata: true
attributes/get_tenant: actions: - key: "my-dynamic-value" from_attributes: app_tenant action: upsert
otlp: endpoint: "http://some-endpoint:4317" headers: my-dynamic-header: <my-dynamic-value>
Describe alternatives you've considered If header_setter extension in OTEL contrib repo can support from_attributes then we will consider that as an alternatives.
Additional context
Today in our pipeline we have a OTLP receiver , resource attributes, attributes processor, OTLP exporter and auth extension to support us our multi-tenancy setup. The headers that auth extension requires from our client can be accessed as our pipeline is pretty simple.
As we are getting more applications getting onboarded to OTEL based implementation we want to implement tail sampling and introduce Kafka for temporary storage to allow scaling.
With the new setup we will have multiple pipelines 1 - OTEL Agent --> OTEL Receiver --> Kafka Exporter. 2 - Kafka Receiver --> Load Balancer --> Resource attributes & attributes processor --> Tail sampling processor --> Routing Processor --> OTLP Exporter
With this new pipeline (2) we can't access the headers (from_context) sent by the OTEL Agent hence we are not able to use the header_setter extension for our multi-tenancy use-case.
Upon checking we can use Routing processor which has the ability to get value from attributes (from_attributes) and based on match it can forward to specific exporter. But again, the headers we need to set is static and when new applications are onboarded we need to keep updating the pipeline configuration.
This sounds like a reasonable request to me. I can work on this once it is triaged.
Hi, Any plan to implement this request? I believe this is a must have feature in multi-tenant environment. Could you please consider this feature?
This should really help any enterprise landscape with a variety of application systems where multi tenancy is integral requirement. Hope this feature gets picked up soon.
Hi, a much needed feature while working with multi tenants. Appreciate if this could be considered for implementation.
have you take à look at https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/extension/headerssetterextension ?
Hi @jtama , Thanks for your reply. We are already using the headersetterextension today but this extension is missing the from_attributes option to get the information for the tenant to dynamically populate it. Its only has option to get it from header or hard-code the tenant information. Hence I thought of checking if this option can be added to the core otel exporter option.
Indeed, I completely missed the second pipeline... I know what you ask exists in the loki exporter, and is far more simpler to use than the extension...
Hi @jtama , For logs exporting to Loki backend we are using the options you explained in the Loki exporter but our current use case is for traces which we need to export in OTLP format to a Tempo which is multi-tenant enabled. Hence looking for native support in OTEL exporter.
Any progress on this? headerssetterextension doesn't seem a good approach. Ideally we should be able to dynamically set the tenantID from attribute...
/label help-wanted
is this request still active ? We have a similar requirement to populate dynamic headers to tempo .
We have also a similar requirement for metrics (and in the future also for traces). Therefore we would like to set the header X-Scope-OrgID
dynamically.
I have found an alternative solution with a custom processor implementation: https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/27901. Maybe this would be a solution to be integrated into in the OTEL contrib repo.
same use case here. 👍 want to keep/convert an attribute/label read from kafka to X-Scope-OrgID
same here please add it to an existing exporter or header_setter extension. 🙌🙌🤞
Yet another comment that we have this use case too.
Thanks for letting us know this issue is important. I expect this feature will depend on this milestone: https://github.com/open-telemetry/opentelemetry-collector/milestone/67 and the functionality that currently lives in the client
directory.
It is unlikely that approvers/maintainers take on this enhancement while we are pushing for 1.0, but we're open to hearing some solutions to this problem and someone else taking it up.