Skip to content

Prometheus exporter converts TiBy to tibibytes and does not map kBy #8751

Description

@thswlsqls

Describe the bug
PrometheusUnitsHelper disagrees with the specification's UCUM unit table on two byte units: TiBy is converted to tibibytes, and only upper case KBy is mapped while the table lists lower case kBy.

Steps to reproduce
Record a metric whose unit is TiBy or kBy and export it through the Prometheus exporter, or call PrometheusUnitsHelper.convertUnit with those units.

What did you expect to see?
tebibytes and kilobytes. The unit table lists TiBy -> tebibytes and kBy -> kilobytes. The "OTLP Metric points to Prometheus / Metric Metadata" section that references it is marked Status: Stable and says the unit MUST be converted using that table.

What did you see instead?
tibibytes, and kBy left unconverted as kBy. Both come from the static initializer of PrometheusUnitsHelper (exporters/prometheus/src/main/java/io/opentelemetry/exporter/prometheus/PrometheusUnitsHelper.java, lines 41-42).

What version and what artifacts are you using?
Artifacts: opentelemetry-exporter-prometheus (alpha)
Version: main @ 3a9fdc6
How did you reference these artifacts? N/A

Environment
Compiler: Temurin 21
OS: N/A

Additional context
This changes exposed metric names (..._tibibytes -> ..._tebibytes). The existing test asserting tibibytes encodes the same mistake, so it has to be corrected too. Upstream prometheus/otlptranslator already fixed both entries, keeping the old spellings in an opt-out legacyUnitMap.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions