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

Prometheus exporter does not cumulatively sum histogram buckets #3281

Closed
albertlockett opened this issue Oct 13, 2022 · 2 comments · Fixed by #3282
Closed

Prometheus exporter does not cumulatively sum histogram buckets #3281

albertlockett opened this issue Oct 13, 2022 · 2 comments · Fixed by #3282
Labels
bug Something isn't working

Comments

@albertlockett
Copy link
Contributor

albertlockett commented Oct 13, 2022

Description

Using the otel-go sdk to collect metrics with prometheus exporter does report the values in the bucket as a cumulative sum of the value for this bucket and the buckets of lower values.

If I do this:

	histogram, _ := meter.SyncInt64().Histogram("my-histogram")
	histogram.Record(ctx, 95)
	histogram.Record(ctx, 95)
	histogram.Record(ctx, 95)
	histogram.Record(ctx, 245)
	histogram.Record(ctx, 245)
	histogram.Record(ctx, 495)

I get an output like this:

$ curl -XGET http://localhost:2222/metrics                                     
...
my_histogram_bucket{le="100"} 3
my_histogram_bucket{le="250"} 2
my_histogram_bucket{le="500"} 1
my_histogram_bucket{le="1000"} 0
...
my_histogram_bucket{le="+Inf"} 6

Environment

  • OS: osx
  • Architecture: intel
  • Go Version: 1.19
  • opentelemetry-go version:

Steps To Reproduce

here's a project that will reproduce
https://github.com/albertlockett/otel-go-metrics-test01/blob/main/go.mod

Expected behavior

I was expecting an output like this (this is the behaviour I get from opentelemetry-js)

my_histogram_bucket{le="100"} 3
my_histogram_bucket{le="250"} 5
my_histogram_bucket{le="500"} 6
my_histogram_bucket{le="1000"} 6
my_histogram_bucket{le="+Inf"} 6
@albertlockett albertlockett added the bug Something isn't working label Oct 13, 2022
albertlockett added a commit to albertlockett/opentelemetry-go that referenced this issue Oct 13, 2022
@albertlockett
Copy link
Contributor Author

#3282

@dangermike
Copy link

I have seen the same behavior, including with the provided example code from /example/prometheus/main.go.

Thanks, @albertlockett!

albertlockett added a commit to albertlockett/opentelemetry-go that referenced this issue Oct 13, 2022
Signed-off-by: albertlockett <albert.lockett@gmail.com>
MadVikingGod pushed a commit that referenced this issue Oct 14, 2022
Signed-off-by: albertlockett <albert.lockett@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants