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

[Prometheus Compatibility] Reconsider 1 to ratio unit conversion

Open dashpole opened this issue 1 year ago • 0 comments

Context

Found as part of https://github.com/open-telemetry/opentelemetry-python/pull/3924.

The semantic conventions for instrument unit recommend using annotations, rather than the unity:

Instruments that measure an integer count of something SHOULD only use annotations with curly braces to give additional meaning without the leading default unit (1). For example, use {packet}, {error}, {fault}, etc.

The linked UCUM section says that annotations (e.g. {RBC}) and 1 are equivalent:

For example one can write “%{vol}”, “ kg{total}”, or “{RBC}” (for “red blood cells”) as pseudo-units. However, these annotations do not have any effect on the semantics, which is why these example expressions are equivalent to “ %”, “kg”, and “ 1” respectively.

The current Prometheus Compatibility specification converts 1 to ratio:

Special case: Converting "1" to "ratio".

Problem

While 1 can be a ratio, it can also be a count of something, since it is equivalent to {RBC}. Our spec discourages the use of 1 as a count of something, but that still doesn't make it correct to automatically convert 1 to ratio for Prometheus conversion.

Proposal

Remove the special case for changing 1 to ratio in prometheus conversion.

@bertysentry @open-telemetry/wg-prometheus @aabmass

dashpole avatar May 23 '24 14:05 dashpole