open-telemetry / opentelemetry-specification

Specifications for OpenTelemetry
https://opentelemetry.io
Apache License 2.0
3.71k stars 887 forks source link

[protocol/exporter]: should `user-agent` header be configurable via `OTEL_EXPORTER_OTLP_HEADERS`? #4230

Open david-luna opened 1 week ago

david-luna commented 1 week ago

We had this question in yesterday's JS SIG (2024-09-25) and originates from the issue I've opened a while ago https://github.com/open-telemetry/opentelemetry-js/issues/4447

From the spec:

Key-value pairs to be used as headers associated with gRPC or HTTP requests.

User-Agent is a header too but in some implementations exporters usually set it up following the recommendation in the spec and it cannot be modified see:

Should we allow to override the header although the user might not follow the spec?

dmathieu commented 1 week ago

RFC 7231 states:

The User-Agent field-value consists of one or more product identifiers

In the case of OTLP exporters, the product identifier is OpenTelemetry, not the user's application, despite it happening within the said app. So even if some folks may want to override it, and maybe we want to support it, the formal recommendation should probably not be to do so.

david-luna commented 1 day ago

Thanks @dmathieu and I agree with you.

I guess the only use case for having access to user agent is if you're creating your own product (like a distribution) based on the SDK an you want to add that info in it right?

dmathieu commented 1 day ago

Do we need it configurable via an environment variable then? A distribution could modify a local variable, or any other mean to change the value that wouldn't easily be available to end-users.