Skip to content

fix sorting in sort_by_label and sort_by_label_desc - #7886

Open
SungJin1212 wants to merge 1 commit into
masterfrom
fix-sort-by-label
Open

SungJin1212 wants to merge 1 commit into
masterfrom
fix-sort-by-label

Conversation

@SungJin1212

Copy link
Copy Markdown
Member

What this PR does:

When sharded instant query has sort_by_label or sort_by_label_desc, the query frontend re-sorts the merged result by sample value instead of by the given labels. For example, the result of sort_by_label(sum by (job) (up), "job") comes back in value order rather than job order.

This PR adds a separate sort plan for them. It orders the merged series with Prometheus' own sort_by_label / sort_by_label_desc implementation.

Which issue(s) this PR fixes:
Fixes #

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]
  • docs/configuration/v1-guarantees.md updated if this PR introduces experimental flags

@SungJin1212
SungJin1212 requested a review from a team as a code owner October 20, 2026 05:29
Signed-off-by: SungJin1212 <tjdwls1201@gmail.com>

This branch has not been deployed

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant