Skip to content

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

@dashpole

Description

@dashpole

Describe the solution you'd like

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.

The current behavior is that the name of the metric would be foo_total.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions