open-telemetry / opentelemetry-specification

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

Clarify that unit must be a suffix for metric names for Prometheus #4057

Closed dashpole closed 1 month ago

dashpole commented 1 month ago

I found this confusion while reviewing https://github.com/open-telemetry/opentelemetry-dotnet/pull/5646#discussion_r1611719896. The intention is for unit to be added in the same fashion for both OpenMetrics and non-OpenMetrics names.

Before this change, the name seconds_before_my_birthday would not have a unit suffix appended. While this is a conceivable name, it isn't compliant with OpenMetrics, which is the intention of the spec. Instead, it needs to be changed to seconds_before_my_birthday_seconds to be compliant with the OpenMetrics spec.

This change will prevent Exporters from needing to special-case unit handling for OpenMetrics vs non-OpenMetrics.

@open-telemetry/wg-prometheus @reyang @robertcoltheart

reyang commented 1 month ago

Thanks @dashpole!