Skip to content

Histogram buckets do not adjust for unit #5891

Open
@ajatprabha

Description

Description

When I create a histogram without metric.WithUnit, it creates a prometheus histogram with buckets []float64{0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, 7500, 10000} from metric.DefaultAggregationSelector I believe.

But when I use metric.WithUnit("s"), the buckets do not re-adjust to account for this unit change. This should either be documented or handled by the SDK. For example: SDK handles naming in such case, i.e. _milliseconds or _seconds.

Environment

  • OS: MacOS
  • Architecture: arm64
  • Go Version: 1.22.8
  • opentelemetry-go version: v1.30.0

Expected behavior

When I use metric.WithUnit("s") which overrides the default Unit ms, it should adjust the buckets to []float64{0, 0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10}, if not set explicitly.

Metadata

Assignees

No one assigned

    Labels

    blocked:specificationWaiting on clarification of the OpenTelemetry specification before progress can be madebugSomething isn't workinginvalidThis doesn't seem right

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions