Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
dashpole opened this issue Dec 2, 2022 · 5 comments
Closed

Comments

@dashpole
Copy link
Contributor

dashpole commented Dec 2, 2022

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.

@github-actions
Copy link

github-actions bot commented Feb 6, 2023

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days.

@github-actions github-actions bot added the stale label Feb 6, 2023
@dashpole
Copy link
Contributor Author

dashpole commented Feb 6, 2023

The updated specification now states:

The Unit of an OTLP metric point SHOULD be converted to the equivalent unit in Prometheus when possible. This includes:

  • Converting from abbreviations to full words (e.g. "ms" to "milliseconds").
  • Dropping the portions of the Unit within brackets (e.g. {packets}). Brackets MUST NOT be included in the resulting unit. A "count of foo" is considered unitless in Prometheus.
  • Special case: Converting "1" to "ratio".
  • Converting "foo/bar" to "foo_per_bar".

The resulting unit SHOULD be added to the metric as OpenMetrics UNIT metadata and as a suffix to the metric name unless the metric name already contains the unit, or the unit MUST be omitted. The unit suffix comes before any type-specific suffixes.

Hopefully this helps clarify the expected behavior.

@legendecas legendecas removed the stale label Feb 7, 2023
@github-actions
Copy link

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days.

@github-actions github-actions bot added the stale label Apr 10, 2023
@github-actions
Copy link

This issue was closed because it has been stale for 14 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 19, 2023
@dashpole
Copy link
Contributor Author

This is still relevant. I would appreciate it if this was reopened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants