opentelemetry-js icon indicating copy to clipboard operation
opentelemetry-js copied to clipboard

[exporters] set a config option for `user-agent` string header

Open david-luna opened this issue 7 months ago • 1 comments
trafficstars

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

As a developer I might want to use the SDK to create my own agent or even an OTEL distribution. I consider this a different product that the upstream repo provides (auto-instrumentations) so I would expect to have a way to identify it.

From the OTEL specs we can read

The format of the header SHOULD follow RFC 7231

And the RFC states

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

so I would expect a way to add my product identifier along the one defined in the exporter.

The goal of having such feature is to allow any receiver of the exported signal (proxy, backend) to be able to differentiate between my product and others without having to inspect the request payload to check for resource attributes like SDK attribs

Describe the solution you'd like

The exporters accept a constructor param to append a product ID in the user agent string.

Describe alternatives you've considered

Env vars were used in the past (https://github.com/open-telemetry/opentelemetry-js/issues/4447) but it was more a workaround rather than a solution. Also there was a potential issue of users overriding it with wrong values (https://github.com/open-telemetry/opentelemetry-specification/issues/4230)

david-luna avatar Apr 08 '25 18:04 david-luna

spec issue as discussed in the SIG https://github.com/open-telemetry/opentelemetry-specification/issues/4479

david-luna avatar Apr 11 '25 11:04 david-luna

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days.

github-actions[bot] avatar Jul 21 '25 06:07 github-actions[bot]

This issue was closed because it has been stale for 14 days with no activity.

github-actions[bot] avatar Aug 11 '25 06:08 github-actions[bot]