micrometer-metrics / micrometer

An application observability facade for the most popular observability tools. Think SLF4J, but for observability.
https://micrometer.io
Apache License 2.0
4.46k stars 985 forks source link

[OTLP Registry] Exporter missing User-Agent header #5577

Open joaopgrassi opened 1 day ago

joaopgrassi commented 1 day ago

Please describe the feature request. The OTel specification defines that OTLP exporters SHOULD emit a User-Agent header identifying the exporter and its version.

https://github.com/open-telemetry/opentelemetry-specification/blob/v1.37.0/specification/protocol/exporter.md#user-agent

OpenTelemetry protocol exporters SHOULD emit a User-Agent header to at a minimum identify the exporter, the language of its implementation, and the version of the exporter. For example, the Python OTLP exporter version 1.2.3 would report the following:

OTel-OTLP-Exporter-Python/1.2.3

Right now, when using the OTLP registry in Micrometer, I get this "default" user agent Java/21.*. It makes it difficult to identify error with requests coming from micrometer apps using the OTLP registry.

Rationale The exporter should follow the specification and emit the header with a more clear value. For example OTel-OTLP-Exporter-Micrometer/1.2.3

jonatan-ivanov commented 1 day ago

Thank you for the issue! If OTel-OTLP-Exporter-Python/1.2.3 represents the "Python OTLP exporter version 1.2.3" (I assume OTel represents the OTel SDK, though the spec does not say it), I think Micrometer should use something like this:

Micrometer-OTLP-Exporter-Java/1.2.3

Are you interested in filing a PR? We could do something like this: https://github.com/micrometer-metrics/micrometer/blob/0458fc8a77f635bfee8cf2a6377435e5857ec764/implementations/micrometer-registry-dynatrace/src/main/java/io/micrometer/dynatrace/v2/DynatraceExporterV2.java#L425

But we also need to figure out where to get the version number (the manifest should contain it).

joaopgrassi commented 1 day ago

Yes, I can send a PR for it! Just may need help with the version thing as I'm not that familiar with the codebase and how to get it. Feel free to assign this to me :)