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

[enhancement]: Incorrect histograms? #1079

Closed
1 task done
akeamc opened this issue Jan 9, 2025 · 4 comments
Closed
1 task done

[enhancement]: Incorrect histograms? #1079

akeamc opened this issue Jan 9, 2025 · 4 comments
Labels
enhancement New feature or request

Comments

@akeamc
Copy link

akeamc commented Jan 9, 2025

Which feature or improvement would you like to request?

In an attempt to monitor my mail server with Prometheus, I noticed the histograms behave a bit strange. Instead of incrementing the corresponding bucket by 1 on each observation, the bucket is incremented by the observed value:

for (idx, upper_bound) in self.upper_bounds.iter().enumerate() {
if value < *upper_bound {
self.buckets.add(idx, value);
return;
}
}

Also, shouldn't the comparison be inclusive, per Prometheus specification?

  • cumulative counters for the observation buckets, exposed as <basename>_bucket{le="<upper inclusive bound>"}

Is this really correct?

Is your feature request related to a problem?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@akeamc akeamc added the enhancement New feature or request label Jan 9, 2025
@mdecimus
Copy link
Member

The observed value is added but as you can see in the code above the counter is incremented by one.
For example, if the histogram is measuring latencies, the current latency is added to the corresponding bucket and the counter is incremented by one.

@akeamc
Copy link
Author

akeamc commented Jan 10, 2025

Yes, I'm with you on that. But isn't it still incorrect behavior to add the entire value to the bucket? The Prometheus tutorial specifies a count of observations, not a per-bucket sum.

@mdecimus
Copy link
Member

You are correct, this was a bug and it has now been fixed.

@akeamc
Copy link
Author

akeamc commented Jan 11, 2025

Thanks! Stalwart is a wonderful mail server, by the way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants