Skip to content

bugfix sort after merging histogram metrics#7380

Open
Shvejan wants to merge 1 commit intocortexproject:masterfrom
Shvejan:master
Open

bugfix sort after merging histogram metrics#7380
Shvejan wants to merge 1 commit intocortexproject:masterfrom
Shvejan:master

Conversation

@Shvejan
Copy link
Contributor

@Shvejan Shvejan commented Mar 26, 2026

What this PR does:
Add sort.Slice() to sort buckets by UpperBound in ascending order after building from the map. This matches the Prometheus client library's approach:

Which issue(s) this PR fixes:
Fixes #7379

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [BUGFIX]

Signed-off-by: Shvejan Mutheboyina <shvejan@amazon.com>
Copy link
Contributor

@yeya24 yeya24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

* [ENHANCEMENT] Tenant Federation: Add a local cache to regex resolver. #7363
* [ENHANCEMENT] Query Scheduler: Add `cortex_query_scheduler_tracked_requests` metric to track the current number of requests held by the scheduler. #7355
* [BUGFIX] Fix nil when ingester_query_max_attempts > 1. #7369
* [BUGFIX] Metrics Helper: Fix non-deterministic bucket order in merged histograms by sorting buckets after map iteration, matching Prometheus client library behavior. #7379
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* [BUGFIX] Metrics Helper: Fix non-deterministic bucket order in merged histograms by sorting buckets after map iteration, matching Prometheus client library behavior. #7379
* [BUGFIX] Metrics Helper: Fix non-deterministic bucket order in merged histograms by sorting buckets after map iteration, matching Prometheus client library behavior. #7380

Can you fix a PR number?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: mergeHistogram produces non-deterministic bucket order causing flaky tests

3 participants