Skip to content

Remove NewPossibleNonCounterInfo and minimise creating empty annotations#13012

Merged
bboreham merged 4 commits intoprometheus:release-2.48from
zenador:release-2.48-remove-NewPossibleNonCounterInfo
Oct 24, 2023
Merged

Remove NewPossibleNonCounterInfo and minimise creating empty annotations#13012
bboreham merged 4 commits intoprometheus:release-2.48from
zenador:release-2.48-remove-NewPossibleNonCounterInfo

Conversation

@zenador
Copy link
Copy Markdown
Contributor

@zenador zenador commented Oct 20, 2023

Follow up to #12959 as a quick fix to temporarily remove NewPossibleNonCounterInfo and avoid creating empty annotations unnecessarily.

Followed up with #13022 to put NewPossibleNonCounterInfo back without running it every step, and apply a similar treatment for other warnings which don't look at the data like NewInvalidQuantileWarning.

According to benchmarks, this should restore most of the efficiency:
Before is run on a branch on main that reverts the commits that added and modified annotations, and after is run on a branch on main with this commit applied.

goos: linux
goarch: amd64
pkg: github.com/prometheus/prometheus/promql
cpu: 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz
                                                  │ BenchmarkRangeQuery_before.txt │   BenchmarkRangeQuery_after.txt    │
                                                  │             sec/op             │   sec/op     vs base               │
RangeQuery/expr=rate(a_hundred[1m]),steps=1000-16                      9.176m ± 4%   9.645m ± 1%  +5.11% (p=0.002 n=10)

                                                  │ BenchmarkRangeQuery_before.txt │ BenchmarkRangeQuery_after.txt  │
                                                  │              B/op              │     B/op      vs base          │
RangeQuery/expr=rate(a_hundred[1m]),steps=1000-16                     367.6Ki ± 0%   367.6Ki ± 0%  ~ (p=0.353 n=10)

                                                  │ BenchmarkRangeQuery_before.txt │   BenchmarkRangeQuery_after.txt    │
                                                  │           allocs/op            │  allocs/op   vs base               │
RangeQuery/expr=rate(a_hundred[1m]),steps=1000-16                      5.256k ± 0%   5.257k ± 0%  +0.02% (p=0.000 n=10)

… and avoid creating empty annotations as much as possible

Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
Copy link
Copy Markdown
Contributor

@LeviHarrison LeviHarrison left a comment

Choose a reason for hiding this comment

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

Did another benchmark and looks to save allocs from when this annotation was available, so LGTM.

name                                                                     old allocs/op  new allocs/op  delta
RangeQuery/expr=rate(a_one[1m]),steps=1-10                                    171 ± 0%       154 ± 0%   ~     (p=1.000 n=1+1)
RangeQuery/expr=rate(a_one[1m]),steps=100-10                                  969 ± 0%       160 ± 0%   ~     (p=1.000 n=1+1)
RangeQuery/expr=rate(a_one[1m]),steps=1000-10                               8.21k ± 0%     0.20k ± 0%   ~     (p=1.000 n=1+1)
RangeQuery/expr=rate(a_ten[1m]),steps=1-10                                    410 ± 0%       249 ± 0%   ~     (p=1.000 n=1+1)
RangeQuery/expr=rate(a_ten[1m]),steps=100-10                                8.38k ± 0%     0.30k ± 0%   ~     (p=1.000 n=1+1)
RangeQuery/expr=rate(a_ten[1m]),steps=1000-10                               80.8k ± 0%      0.7k ± 0%   ~     (p=1.000 n=1+1)
RangeQuery/expr=rate(a_hundred[1m]),steps=1-10                              2.75k ± 0%     1.15k ± 0%   ~     (p=1.000 n=1+1)
RangeQuery/expr=rate(a_hundred[1m]),steps=100-10                            82.5k ± 0%      1.7k ± 0%   ~     (p=1.000 n=1+1)
RangeQuery/expr=rate(a_hundred[1m]),steps=1000-10                            806k ± 0%        5k ± 0%   ~     (p=1.000 n=1+1)
RangeQuery/expr=rate(a_one[1m]),steps=10000-10                              80.7k ± 0%      0.6k ± 0%   ~     (p=1.000 n=1+1)
RangeQuery/expr=rate(a_ten[1m]),steps=10000-10                               805k ± 0%        5k ± 0%   ~     (p=1.000 n=1+1)
RangeQuery/expr=rate(a_hundred[1m]),steps=10000-10                          8.05M ± 0%     0.04M ± 0%   ~     (p=1.000 n=1+1)
RangeQuery/expr=rate(a_one[1d]),steps=1-10                                    555 ± 0%       538 ± 0%   ~     (p=1.000 n=1+1)
RangeQuery/expr=rate(a_one[1d]),steps=100-10                                1.35k ± 0%     0.54k ± 0%   ~     (p=1.000 n=1+1)
RangeQuery/expr=rate(a_one[1d]),steps=1000-10                               8.59k ± 0%     0.58k ± 0%   ~     (p=1.000 n=1+1)
RangeQuery/expr=rate(a_ten[1d]),steps=1-10                                  4.09k ± 0%     3.93k ± 0%   ~     (p=1.000 n=1+1)
RangeQuery/expr=rate(a_ten[1d]),steps=100-10                                12.1k ± 0%      4.0k ± 0%   ~     (p=1.000 n=1+1)
RangeQuery/expr=rate(a_ten[1d]),steps=1000-10                               84.4k ± 0%      4.3k ± 0%   ~     (p=1.000 n=1+1)
RangeQuery/expr=rate(a_hundred[1d]),steps=1-10                              39.4k ± 0%     37.8k ± 0%   ~     (p=1.000 n=1+1)
RangeQuery/expr=rate(a_hundred[1d]),steps=100-10                             119k ± 0%       38k ± 0%   ~     (p=1.000 n=1+1)
RangeQuery/expr=rate(a_hundred[1d]),steps=1000-10                            843k ± 0%       42k ± 0%   ~     (p=1.000 n=1+1)
RangeQuery/expr=rate(a_one[1m])_+_rate(b_one[1m]),steps=1-10                  320 ± 0%       285 ± 0%   ~     (p=1.000 n=1+1)
RangeQuery/expr=rate(a_one[1m])_+_rate(b_one[1m]),steps=100-10              2.11k ± 0%     0.49k ± 0%   ~     (p=1.000 n=1+1)
RangeQuery/expr=rate(a_one[1m])_+_rate(b_one[1m]),steps=1000-10             18.4k ± 0%      2.4k ± 0%   ~     (p=1.000 n=1+1)
RangeQuery/expr=rate(a_ten[1m])_+_rate(b_ten[1m]),steps=1-10                  857 ± 0%       534 ± 0%   ~     (p=1.000 n=1+1)
RangeQuery/expr=rate(a_ten[1m])_+_rate(b_ten[1m]),steps=100-10              17.0k ± 0%      0.8k ± 0%   ~     (p=1.000 n=1+1)
RangeQuery/expr=rate(a_ten[1m])_+_rate(b_ten[1m]),steps=1000-10              164k ± 0%        3k ± 0%   ~     (p=1.000 n=1+1)
RangeQuery/expr=rate(a_hundred[1m])_+_rate(b_hundred[1m]),steps=1-10        6.11k ± 0%     2.90k ± 0%   ~     (p=1.000 n=1+1)
RangeQuery/expr=rate(a_hundred[1m])_+_rate(b_hundred[1m]),steps=100-10       166k ± 0%        4k ± 0%   ~     (p=1.000 n=1+1)
RangeQuery/expr=rate(a_hundred[1m])_+_rate(b_hundred[1m]),steps=1000-10     1.62M ± 0%     0.01M ± 0%   ~     (p=1.000 n=1+1)

@LeviHarrison LeviHarrison requested review from bboreham and roidelapluie and removed request for roidelapluie October 22, 2023 20:33
Copy link
Copy Markdown
Member

@bboreham bboreham left a comment

Choose a reason for hiding this comment

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

Should also modify the changelog entry for annotations.

Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
CHANGELOG.md Outdated
* [ENHANCEMENT] Promtool: Add support for specifying series matchers in the TSDB analyze command. #12842
* [ENHANCEMENT] PromQL: Prevent Prometheus from overallocating memory on subquery with large amount of steps. #12734
* [ENHANCEMENT] PromQL: Add warning when monotonicity is forced in the input to histogram_quantile. #12931
* [ENHANCEMENT] PromQL: Reduce inefficiency introduced by warnings/annotations, and temporarily remove NewPossibleNonCounterInfo. #13012
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Everything else looks great, but not sure if this should go into the rc.0 annotations given that rc.0 has already been cut? Usually it would be the person cutting the next RC (rc.1) who would then add the new changelog lines, or did we agree to change that procedure now?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sorry that's my sloppy phrasing.
We should leave the addition noted in rc0 and add a line noting the removal in rc1 in this changelog.
When it gets merged to main we should have either no line or a reference that some foundations were added.

Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
@zenador
Copy link
Copy Markdown
Contributor Author

zenador commented Oct 23, 2023

With the latest commit, here's the benchmark with the same before/after branches as above (all overhead gone now):

                                                  │ BenchmarkRangeQuery_before.txt │ BenchmarkRangeQuery_after.txt │
                                                  │             sec/op             │   sec/op     vs base          │
RangeQuery/expr=rate(a_hundred[1m]),steps=1000-16                     9.345m ± 18%   9.472m ± 1%  ~ (p=0.280 n=10)

                                                  │ BenchmarkRangeQuery_before.txt │ BenchmarkRangeQuery_after.txt  │
                                                  │              B/op              │     B/op      vs base          │
RangeQuery/expr=rate(a_hundred[1m]),steps=1000-16                     367.6Ki ± 0%   367.6Ki ± 0%  ~ (p=0.579 n=10)

                                                  │ BenchmarkRangeQuery_before.txt │ BenchmarkRangeQuery_after.txt │
                                                  │           allocs/op            │  allocs/op   vs base          │
RangeQuery/expr=rate(a_hundred[1m]),steps=1000-16                      5.256k ± 0%   5.256k ± 0%  ~ (p=0.582 n=10)

Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
@zenador
Copy link
Copy Markdown
Contributor Author

zenador commented Oct 23, 2023

zenador added a commit to grafana/mimir that referenced this pull request Oct 24, 2023
zenador added a commit to grafana/mimir that referenced this pull request Oct 24, 2023
Copy link
Copy Markdown
Member

@beorn7 beorn7 left a comment

Choose a reason for hiding this comment

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

WRT the Changelog entry: In the final release notes, we shouldn't have any deltas relative to the RCs. So the final v2.48.0 will only feature whatever annotations we have then. In the changelog for v2.48.0, we don't have to document that the non-counter-info was added in rc.0 and removed again in rc.1.

@bboreham bboreham merged commit 80e977a into prometheus:release-2.48 Oct 24, 2023
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.

5 participants