open-telemetry / opentelemetry-collector-contrib

Contrib repository for the OpenTelemetry Collector
https://opentelemetry.io
Apache License 2.0
3.03k stars 2.35k forks source link

`kafkaexporter` - support injecting headers #33260

Open d-mankowski-synerise opened 5 months ago

d-mankowski-synerise commented 5 months ago

Component(s)

exporter/kafka

Is your feature request related to a problem? Please describe.

kafkareceiver does support header extraction, e.g.

receivers:
  kafka:
    topic: test
    header_extraction: 
      extract_headers: true
      headers: ["header1", "header2"]

However, kafkaexporter does not support injecting such headers, that could then be read by kafkareceiver.

Use case: we want to have a following setup: applications (send traces to) -> OT Collector -> Kafka -> Grafana Tempo. Grafana Tempo has multi-tenancy enabled, which means, that in order to identify which tenant sends the telemetry, an X-Scope-OrgID header is required.

Note: Tempo is using kafkareceiver internally

Describe the solution you'd like

kafkaexporter should be able to inject custom headers that are in compatible format with what kafkareceiver expects. Config could look like this:

exporters:
  kafka:
    topic: test
    header_injection: 
      inject_headers: true
      headers:
        header1: value1
        header2: value2

Describe alternatives you've considered

No response

Additional context

No response

github-actions[bot] commented 5 months ago

Pinging code owners:

crobert-1 commented 5 months ago

It may be preferable to add support for the headers setter extension to this exporter, but I'll defer to others who are better informed here than me.

samiura commented 4 months ago

I will work on this issue.

github-actions[bot] commented 2 months ago

This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.