open-telemetry/opentelemetry-collector

Add support of `Host` header in otlphttpexporter

enuret opened this issue · 0 comments

Is your feature request related to a problem? Please describe.
We try to use opentlelemetry collector gateway behind envoy as a gateway and send data there from collector layer in lambda function.

lambda function otel collector layer => Servicemesh gateway => otel collector gateway

Typically envoy uses authority/host headers for HTTP2/HTTP1 for request when routing
so for demonstrating the request should look like

curl https://evnoy-service -H 'host: otel-collector-host'

Describe the solution you'd like
I plan to add a config for host header into otlphttp exporter
https://github.com/open-telemetry/opentelemetry-collector/blob/main/exporter/otlphttpexporter/config.go
and set Request.header in the moment of request
https://github.com/open-telemetry/opentelemetry-collector/blob/main/exporter/otlphttpexporter/otlp.go#L124

Similar PR for grpc exporter:
#8228
I have a similar pull request ongoing in golang client
open-telemetry/opentelemetry-go#4780

Additional context
There is a tricky part in implementation of net.http.Request library. This library doesn't override Host header when it is passed as Request.Headers field . They have a special field Request.Host if Host header has to be overrided so configuration option for Host should be different than for generic Headers