Skip to content

Counter with unit '1' backwards compatibility #7625

@sbuliarca

Description

@sbuliarca

Description

Using this counter:

counter, err := meter.Int64Counter(
   "foo",
   otelmetric.WithDescription("a simple counter with unit 1"),
   otelmetric.WithUnit("1"),
 )                    

In prometheus exporter v0.57 it produced the metric foo_ratio_total vs
in prometheus exporter v0.60 in produces the metric foo_total

Environment

  • OS: linux
  • Architecture: any
  • Go Version: 1.24.2
  • opentelemetry-go version: [1.38.0 / prometheus exporter 0.60.0]

Steps To Reproduce

I've added a sample test over the 0.57.0 tag here

The addapted test for it to pass over 0.60.0 tag is here.
The adaptations for it to pass in 0.60.0 can be viewed in this commit

Expected behavior

Was this an intentional change?

I know the foo_ratio_total is not really nice, and there is a discussion in the comunity to remove the ratio for counters, but it introduces backwards incompatibility for such metrics.
The spec hasn't been updated yet, although I see it is an accepted proposal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpkg:exporter:prometheusRelated to the Prometheus exporter package

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions