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

Prometheus exporter: Add unit to metric names, and convert unit to words

Open dashpole opened this issue 2 years ago • 0 comments
trafficstars

From the OTel prometheus compatibility spec:

The Unit of an OTLP metric point MUST be added as OpenMetrics UNIT metadata. Additionally, the unit MUST be added as a suffix to the metric name, and SHOULD be converted to base units recommended by OpenMetrics when possible. The unit suffix comes before any type-specific suffixes.

For now, I would hold off trying to convert to base units (e.g. milliseconds to seconds), but would still encourage converting from abbreviations to full words for the unit (e.g. ms to milliseconds).

For example, a metric with name "foo", type=monotonic sum, unit=ms should have the name: foo_milliseconds_total.

dashpole avatar Dec 02 '22 21:12 dashpole