Skip to content

promql: fix rate calculation with a counter reset after the 1st sample#15902

Merged
beorn7 merged 1 commit intomainfrom
beorn7/promql
Feb 5, 2025
Merged

promql: fix rate calculation with a counter reset after the 1st sample#15902
beorn7 merged 1 commit intomainfrom
beorn7/promql

Conversation

@beorn7
Copy link
Member

@beorn7 beorn7 commented Jan 29, 2025

If a rate (or increase) is calculated on native histograms, and there is a counter reset between the 1st and 2nd histogram, we never have to touch the 1st histogram, so it doesn't even matter if it has an incompatible bucket layout. So we should not error out in that case.

This simply nulls out the 1st histogram in that case.

@NeerajGartia21 as discussed.

…gram

If a rate (or increase) is calculated on native histograms, and there
is a counter reset between the 1st and 2nd histogram, we never have to
touch the 1st histogram, so it doesn't even matter if it has an
incompatible bucket layout. So we should not error out in that case.

This simply nulls out the 1st histogram in that case.

Signed-off-by: beorn7 <beorn@grafana.com>
@NeerajGartia21
Copy link
Contributor

NeerajGartia21 commented Feb 1, 2025

Thank you @beorn7.
Looks good to me!

@beorn7 beorn7 merged commit cb096a8 into main Feb 5, 2025
44 checks passed
@beorn7 beorn7 deleted the beorn7/promql branch February 5, 2025 21:10
charleskorn added a commit to grafana/mimir that referenced this pull request Mar 11, 2025
charleskorn added a commit to grafana/mimir that referenced this pull request Mar 11, 2025
charleskorn added a commit to grafana/mimir that referenced this pull request Mar 11, 2025
charleskorn added a commit to grafana/mimir that referenced this pull request Mar 11, 2025
charleskorn added a commit to grafana/mimir that referenced this pull request Mar 12, 2025
* Upgrade mimir-prometheus

* Bring in upstream test changes

* Apply change to match prometheus/prometheus#15974

* Remove test case added in upstream in prometheus/prometheus#15975

* Add tests for case where range vector selectors and subqueries have 0 range

Brings in change from #10586

* Update `sort` and `sort_desc` behaviour to match prometheus/prometheus#15964

* Add support for native histograms to `irate` and `idelta` to match prometheus/prometheus#15853

* Adjust test cases to match support for native histograms in `irate` and `idelta`

* Change binop annotations to match behaviour in prometheus/prometheus#15895

* Ignore incompatible schemas between the first and second point in `rate` and `increase` if the second point is a reset (prometheus/prometheus#15902)

* Adjust annotation test cases to match new behaviour introduced in previous commit

* Disable tests failing due to prometheus/prometheus#16199

* Add changelog entry

* Update `TestQuerySharding_FunctionCorrectness` to reflect changes in prometheus/prometheus#15964
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants