prometheus / prometheus/prometheus
topk/bottomk tie breaks are inconsistent
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 66.1k
- Forks
- 10.8k
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 131
Description
What did you do?
I ran the query "topk(2, metricA) by (ifName)".
What did you expect to see?
I expect to see consistent results between executions of the same query with identical data.
What did you see instead? Under which circumstances?
The results are not consistent and randomly picks a time series to include in the results when a value tie break needs to be made. Attached are screenshots of the results from two different executions of the same query with identical data.
System information
No response
Prometheus version
prometheus, version 2.55.1 (branch: HEAD, revision: 6d7569113f1ca814f1e149f74176656540043b8d)
build user: root@194e0f5dd5e8
build date: 20241106-10:11:03
go version: go1.23.2
platform: linux/arm64
tags: netgo,builtinassets,stringlabels
Prometheus configuration file
Alertmanager version
Alertmanager configuration file
Logs
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the topk and bottomk query operators and reproduce topk(2, metricA) by (ifName) using identical tied data across repeated executions. Trace how tied series are selected, then verify the fix with a regression test showing deterministic results for the same query and data.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100