-
Notifications
You must be signed in to change notification settings - Fork 9.7k
promql(histograms): scale a histogram the same as the count #16828
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
Conversation
Should we go with this approach, this might actually be close to the final code, which proves the simplicity. (Assuming I haven't missed anything substantial…) Another thought: Even though this will have overblown values for some buckets, I am not so sure anymore if "fixing" those is the right thing. By reducing the overblown buckets, we are increasing other buckets, so one might argue we are actually glossing over differences between buckets that has been in the data, but has been "smoothed out" with the other approaches (3) and (4). Or in other words: The outcome of this approach (2) is easier to reason with. For "optimal" rate estimation, the hopes are that the new |
This deals with the count field of native histograms in the same way as with simple float counters. It then scale the whole histogram with the same factor as it has scaled the count. This will still allow individual buckets to get extrapolated below zero, but maybe that is fine. This implements approach (2) as described in #15976 (comment) Signed-off-by: beorn7 <beorn@grafana.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, we could add some testcases to show that histogram_count
behaves correctly, but that can be a next PR.
Upstream pr - prometheus/prometheus#16828 Signed-off-by: Innokentii Konstantinov <innokenty.konstantinov@grafana.com>
## Update mimir-prometheus dependency *This PR was automatically created by the [update-vendored-mimir-prometheus.yml](https://github.com/grafana/mimir/blob/main/.github/workflows/update-vendored-mimir-prometheus.yml) workflow.* ### Details: - **Source branch/ref**: [`main`](https://github.com/grafana/mimir-prometheus/tree/main) - **Previous commit**: [`73cbc98c25ff`](grafana/mimir-prometheus@73cbc98c25ff) - **New commit**: [`acace3cd1e0232d0d167e1f8062accd0a318d06c`](grafana/mimir-prometheus@acace3c) - **Changes**: [`73cbc98c25ff...acace3cd1e0232d0d167e1f8062accd0a318d06c`](grafana/mimir-prometheus@73cbc98...acace3c) ### Note to reviewer: There are two manual changes to make it mergeable: - [Use NewLeveledCompactorWithOptions instead of NewLeveledCompactorWithChunkSize](7e0061b) – NewLeveledCompactorWithChunkSize was removed in upstream - [ Port "Prevent extrapolation below zero for histogram count" to MQE ](https://github.com/grafana/mimir/pull/12106/files#diff-1256527183ea6d432ef0f080e75927eefb108f47554f9e20633c1b30756a3134). This one is more subtle. prometheus/prometheus#16828 was merged in upstream, affecting query results and causing some MQE tests to fail. The solution was to port the change to the MQE histogram rate implementation. --------- Signed-off-by: Innokentii Konstantinov <innokenty.konstantinov@grafana.com> Co-authored-by: mimir-github-bot[bot] <mimir-github-bot[bot]@users.noreply.github.com> Co-authored-by: Innokentii Konstantinov <innokenty.konstantinov@grafana.com> Co-authored-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>
This deals with the count field of native histograms in the same way
as with simple float counters. It then scale the whole histogram with
the same factor as it has scaled the count. This will still allow
individual buckets to get extrapolated below zero, but maybe that is
fine.
This implements approach (2) as described in
#15976 (comment)
This is now ready for review.
For posterity: This approach was chosen as per discussion in #15976 , with @gen1321 and @krajorama being the other two contributors.