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

Expand the set of units supported by the prometheus exporter #4374

Merged
merged 4 commits into from Aug 2, 2023

Conversation

dashpole
Copy link
Contributor

@dashpole dashpole commented Jul 26, 2023

Fixes #4372.

We currently have a very small set of units we recognize. Expand it so that we can cover more cases, such as the one pointed out in the issue.

Change the tests to use seconds instead of milliseconds, as we want to ensure that case works correctly.

The set of units is copied from https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/pkg/translator/prometheus/normalize_name.go#L19

@codecov
Copy link

codecov bot commented Jul 26, 2023

Codecov Report

Merging #4374 (be87609) into main (2899fcf) will not change coverage.
The diff coverage is 100.0%.

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main   #4374   +/-   ##
=====================================
  Coverage   83.4%   83.4%           
=====================================
  Files        184     184           
  Lines      14380   14380           
=====================================
  Hits       11997   11997           
  Misses      2155    2155           
  Partials     228     228           
Files Changed Coverage Δ
exporters/prometheus/exporter.go 82.7% <100.0%> (ø)

exporters/prometheus/exporter.go Outdated Show resolved Hide resolved
exporters/prometheus/exporter.go Outdated Show resolved Hide resolved
@pellared
Copy link
Member

pellared commented Jul 27, 2023

Opportunistic question: Should we add some doc comments to https://pkg.go.dev/go.opentelemetry.io/otel/metric#WithUnit that we recommend using UCUM units?

Related to #4374 (comment)

@MrAlias
Copy link
Contributor

MrAlias commented Jul 28, 2023

Opportunistic question: Should we add some doc comments to https://pkg.go.dev/go.opentelemetry.io/otel/metric#WithUnit that we recommend using UCUM units?

Related to #4374 (comment)

Doing so in a separate PR sounds good to me.

dmitryax pushed a commit to open-telemetry/opentelemetry-collector-contrib that referenced this pull request Aug 1, 2023
**Description:**

Discovered during
open-telemetry/opentelemetry-go#4374 (review).

`B` means `bel` in UCUM, so MB is `megabel`, for example. `$` is also
not UCUM.

https://ucum.org/ucum#section-Alphabetic-Index-By-Symbol
@pellared pellared merged commit 528a0cb into open-telemetry:main Aug 2, 2023
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

prometheus: unit is not appended to name
4 participants