open-telemetry / open-telemetry/opentelemetry-java

Allow histograms to record measurements with negative values

Open
#6,596 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

blocked:spec Feature Request
Dominant language
Java
Stars
2.5k
Forks
1k
Avg merge
3d 17h
Merged PRs (30d)
58

Description

Describe the bug
Looking at SdkDoubleHistogram.java we block negative values in histograms despite this being supported under exponential histograms (via negativebuckets).

Is this intentional or just a side effect of the standard storage of Histograms not permitting negative values?

Steps to reproduce

  • Emit a negative histogram value
  • Get a WARN
  • Nothing emitted

What did you expect to see?
Negative values supported

What did you see instead?
Warning message

What version and what artifacts are you using?
N/A

Environment
N/A

Additional context
Add any other context about the problem here.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/SdkDoubleHistogram.java at the referenced line and trace how negative measurements are rejected and stored. Compare this behavior with the exponential histogram handling of negativebuckets. Done means negative histogram measurements no longer produce the reported warning or disappear, with behavior consistent with the supported histogram storage model.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
observability-sre
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.