Skip to content

Commit

Permalink
Streaming PromQL engine: binary arithmetic operations with one-to-one…
Browse files Browse the repository at this point in the history
… matching (#8096)

* Add some test cases

* Enable upstream test cases for binary operators with one-to-one matching and arithmetic operations

* Fix invalid test case

* Make it clear that points are expected to be in timestamp order with no duplicate timestamps.

* Enable relevant benchmarks

* Enable test cases for atan2

* Initial (WIP) version of one-to-one matching

* Update comment

* Fix issue where `on` and `ignoring` are ignored

* Use correct terminology

* Fix issue where errors are lost if result is a matrix

* Add support for case where multiple different series contribute to one side of a binary operation

* Add comment explaining when slices are returned to the pool

* Add further comment

* Remove redundant checks

* Log output from benchmark binary if it fails

* Don't limit the number of samples loaded in a query

* Return point slices to the pool once we're done with them

* Split `SeriesMetadata` into smaller methods

* Clarify comment

* Add extra benchmark

* Add comment explaining tradeoff

* Rename `binaryOperationSeriesPair` to `binaryOperationOutputSeries`

* Add benchmark for the case where one side of a binary operation has many more series than the other

* Further simplify `SeriesMetadata` by moving more logic into `computeOutputSeries`.

* Sort output series to minimise the number of input series we need to buffer in memory

* Add support for capturing CPU and memory profiles while running benchmark

* Reuse slices when computing result.

* Use bucketed pools with factor 2 rather than factor 10.

This dramatically reduces peak memory consumption, as we'll no longer
potentially over-allocate by a factor of 10.

For example, previously, if we needed a slice of 1001 points, we'd
end up using a slice with capacity 10000. Now it will only be 1024.

This fixes the issue where queries that return many series result in
peak memory utilisation far greater than Prometheus' engine.

Full benchmark results:
goos: darwin
goarch: arm64
pkg: github.com/grafana/mimir/pkg/streamingpromql/benchmarks
                                                                       │      standard      │             streaming              │
                                                                       │       sec/op       │   sec/op     vs base               │
Query/a_1,_instant_query                                                       127.9µ ±  5%   120.6µ ± 4%   -5.72% (p=0.004 n=6)
Query/a_1,_range_query_with_100_steps                                          141.8µ ± 15%   131.8µ ± 8%        ~ (p=0.132 n=6)
Query/a_1,_range_query_with_1000_steps                                         181.0µ ±  2%   171.4µ ± 1%   -5.33% (p=0.002 n=6)
Query/a_100,_instant_query                                                     577.7µ ±  7%   558.4µ ± 3%   -3.35% (p=0.002 n=6)
Query/a_100,_range_query_with_100_steps                                        1.060m ±  5%   1.039m ± 5%        ~ (p=0.240 n=6)
Query/a_100,_range_query_with_1000_steps                                       5.276m ±  1%   5.191m ± 2%   -1.61% (p=0.015 n=6)
Query/a_2000,_instant_query                                                    7.207m ±  0%   7.015m ± 1%   -2.65% (p=0.002 n=6)
Query/a_2000,_range_query_with_100_steps                                       15.88m ±  1%   15.39m ± 1%   -3.08% (p=0.002 n=6)
Query/a_2000,_range_query_with_1000_steps                                      94.69m ±  1%   90.68m ± 0%   -4.24% (p=0.002 n=6)
Query/rate(a_1[1m]),_instant_query                                             123.1µ ±  7%   112.7µ ± 3%   -8.43% (p=0.002 n=6)
Query/rate(a_1[1m]),_range_query_with_100_steps                                134.4µ ±  4%   120.3µ ± 4%  -10.48% (p=0.002 n=6)
Query/rate(a_1[1m]),_range_query_with_1000_steps                               236.3µ ±  1%   178.0µ ± 1%  -24.69% (p=0.002 n=6)
Query/rate(a_100[1m]),_instant_query                                           570.8µ ±  2%   557.4µ ± 4%   -2.34% (p=0.004 n=6)
Query/rate(a_100[1m]),_range_query_with_100_steps                              1.606m ±  2%   1.153m ± 0%  -28.20% (p=0.002 n=6)
Query/rate(a_100[1m]),_range_query_with_1000_steps                            10.467m ±  2%   5.811m ± 1%  -44.48% (p=0.002 n=6)
Query/rate(a_2000[1m]),_instant_query                                          7.007m ±  0%   6.811m ± 1%   -2.80% (p=0.002 n=6)
Query/rate(a_2000[1m]),_range_query_with_100_steps                             26.64m ±  1%   17.95m ± 2%  -32.62% (p=0.002 n=6)
Query/rate(a_2000[1m]),_range_query_with_1000_steps                            195.2m ±  2%   104.3m ± 0%  -46.57% (p=0.002 n=6)
Query/rate(a_1[1m]),_range_query_with_10000_steps                             1174.8µ ±  2%   744.3µ ± 1%  -36.64% (p=0.002 n=6)
Query/rate(a_100[1m]),_range_query_with_10000_steps                            97.00m ±  1%   52.99m ± 6%  -45.38% (p=0.002 n=6)
Query/rate(a_2000[1m]),_range_query_with_10000_steps                            2.004 ±  2%    1.047 ± 5%  -47.75% (p=0.002 n=6)
Query/rate(a_1[1d]),_instant_query                                             745.6µ ±  2%   553.4µ ± 7%  -25.77% (p=0.002 n=6)
Query/rate(a_1[1d]),_range_query_with_100_steps                               1302.3µ ±  1%   988.9µ ± 1%  -24.07% (p=0.002 n=6)
Query/rate(a_1[1d]),_range_query_with_1000_steps                               6.227m ±  1%   4.860m ± 1%  -21.94% (p=0.002 n=6)
Query/rate(a_100[1d]),_instant_query                                           43.68m ±  0%   33.71m ± 0%  -22.83% (p=0.002 n=6)
Query/rate(a_100[1d]),_range_query_with_100_steps                              98.27m ±  1%   76.75m ± 1%  -21.90% (p=0.002 n=6)
Query/rate(a_100[1d]),_range_query_with_1000_steps                             587.2m ±  1%   461.3m ± 0%  -21.44% (p=0.002 n=6)
Query/rate(a_2000[1d]),_instant_query                                          813.1m ±  1%   618.5m ± 0%  -23.93% (p=0.002 n=6)
Query/rate(a_2000[1d]),_range_query_with_100_steps                              1.914 ±  1%    1.482 ± 8%  -22.58% (p=0.002 n=6)
Query/rate(a_2000[1d]),_range_query_with_1000_steps                            11.671 ±  1%    9.149 ± 0%  -21.61% (p=0.002 n=6)
Query/a_1_-_b_1,_instant_query                                                 225.9µ ±  1%   211.4µ ± 2%   -6.42% (p=0.002 n=6)
Query/a_1_-_b_1,_range_query_with_100_steps                                    260.3µ ±  0%   225.9µ ± 2%  -13.23% (p=0.002 n=6)
Query/a_1_-_b_1,_range_query_with_1000_steps                                   618.3µ ±  2%   319.6µ ± 1%  -48.31% (p=0.002 n=6)
Query/a_100_-_b_100,_instant_query                                             1.182m ±  1%   1.125m ± 0%   -4.82% (p=0.002 n=6)
Query/a_100_-_b_100,_range_query_with_100_steps                                4.437m ±  1%   2.042m ± 1%  -53.98% (p=0.002 n=6)
Query/a_100_-_b_100,_range_query_with_1000_steps                               33.51m ±  0%   10.19m ± 1%  -69.59% (p=0.002 n=6)
Query/a_2000_-_b_2000,_instant_query                                           15.92m ±  1%   15.38m ± 1%   -3.42% (p=0.002 n=6)
Query/a_2000_-_b_2000,_range_query_with_100_steps                              82.01m ±  1%   32.76m ± 1%  -60.06% (p=0.002 n=6)
Query/a_2000_-_b_2000,_range_query_with_1000_steps                             735.9m ±  1%   187.5m ± 1%  -74.53% (p=0.002 n=6)
Query/a_1_-_b_1,_range_query_with_10000_steps                                  3.298m ±  1%   1.273m ± 1%  -61.40% (p=0.002 n=6)
Query/a_100_-_b_100,_range_query_with_10000_steps                             322.21m ±  0%   87.20m ± 0%  -72.94% (p=0.002 n=6)
Query/a_2000_-_b_2000,_range_query_with_10000_steps                             7.571 ±  0%    1.733 ± 3%  -77.11% (p=0.002 n=6)
Query/a_100{l=~"[13579]."}_-_b_100,_instant_query                              1.114m ±  1%   1.086m ± 1%   -2.52% (p=0.002 n=6)
Query/a_100{l=~"[13579]."}_-_b_100,_range_query_with_100_steps                 3.182m ±  1%   1.803m ± 1%  -43.32% (p=0.002 n=6)
Query/a_100{l=~"[13579]."}_-_b_100,_range_query_with_1000_steps               21.739m ±  0%   8.109m ± 1%  -62.70% (p=0.002 n=6)
Query/a_2000{l=~"1..."}_-_b_2000,_instant_query                               12.093m ±  1%   9.135m ± 2%  -24.46% (p=0.002 n=6)
Query/a_2000{l=~"1..."}_-_b_2000,_range_query_with_100_steps                   52.50m ±  1%   18.63m ± 2%  -64.51% (p=0.002 n=6)
Query/a_2000{l=~"1..."}_-_b_2000,_range_query_with_1000_steps                  470.5m ±  1%   103.8m ± 0%  -77.94% (p=0.002 n=6)
Query/sum(a_1),_instant_query                                                  118.5µ ±  2%   110.8µ ± 4%   -6.42% (p=0.002 n=6)
Query/sum(a_1),_range_query_with_100_steps                                     129.1µ ±  1%   117.5µ ± 2%   -9.00% (p=0.002 n=6)
Query/sum(a_1),_range_query_with_1000_steps                                    207.4µ ±  1%   172.5µ ± 1%  -16.83% (p=0.002 n=6)
Query/sum(a_100),_instant_query                                                584.5µ ±  1%   561.9µ ± 3%   -3.87% (p=0.002 n=6)
Query/sum(a_100),_range_query_with_100_steps                                   1.092m ±  1%   1.020m ± 1%   -6.59% (p=0.002 n=6)
Query/sum(a_100),_range_query_with_1000_steps                                  5.683m ±  1%   5.199m ± 0%   -8.53% (p=0.002 n=6)
Query/sum(a_2000),_instant_query                                               7.251m ±  1%   7.010m ± 0%   -3.32% (p=0.002 n=6)
Query/sum(a_2000),_range_query_with_100_steps                                  16.84m ±  1%   15.74m ± 1%   -6.53% (p=0.002 n=6)
Query/sum(a_2000),_range_query_with_1000_steps                                111.55m ±  2%   93.75m ± 0%  -15.96% (p=0.002 n=6)
Query/sum_by_(l)(h_1),_instant_query                                           148.6µ ±  2%   139.7µ ± 2%   -5.98% (p=0.002 n=6)
Query/sum_by_(l)(h_1),_range_query_with_100_steps                              183.7µ ±  1%   170.9µ ± 2%   -6.98% (p=0.002 n=6)
Query/sum_by_(l)(h_1),_range_query_with_1000_steps                             533.7µ ±  1%   480.8µ ± 2%   -9.92% (p=0.002 n=6)
Query/sum_by_(l)(h_100),_instant_query                                         2.576m ±  1%   2.458m ± 1%   -4.55% (p=0.002 n=6)
Query/sum_by_(l)(h_100),_range_query_with_100_steps                            5.505m ±  1%   5.193m ± 1%   -5.65% (p=0.002 n=6)
Query/sum_by_(l)(h_100),_range_query_with_1000_steps                           33.01m ±  1%   29.73m ± 1%   -9.94% (p=0.002 n=6)
Query/sum_by_(l)(h_2000),_instant_query                                        46.80m ±  1%   45.32m ± 1%   -3.16% (p=0.002 n=6)
Query/sum_by_(l)(h_2000),_range_query_with_100_steps                          107.41m ±  1%   98.70m ± 1%   -8.11% (p=0.002 n=6)
Query/sum_by_(l)(h_2000),_range_query_with_1000_steps                          705.7m ±  0%   563.3m ± 1%  -20.17% (p=0.002 n=6)
Query/sum_by_(le)(h_1),_instant_query                                          150.1µ ±  1%   141.2µ ± 3%   -5.95% (p=0.002 n=6)
Query/sum_by_(le)(h_1),_range_query_with_100_steps                             187.2µ ±  1%   174.5µ ± 2%   -6.80% (p=0.002 n=6)
Query/sum_by_(le)(h_1),_range_query_with_1000_steps                            562.1µ ±  0%   500.4µ ± 2%  -10.98% (p=0.002 n=6)
Query/sum_by_(le)(h_100),_instant_query                                        2.525m ±  2%   2.412m ± 1%   -4.46% (p=0.002 n=6)
Query/sum_by_(le)(h_100),_range_query_with_100_steps                           5.403m ±  1%   5.072m ± 1%   -6.13% (p=0.002 n=6)
Query/sum_by_(le)(h_100),_range_query_with_1000_steps                          32.40m ±  3%   29.59m ± 1%   -8.67% (p=0.002 n=6)
Query/sum_by_(le)(h_2000),_instant_query                                       45.69m ±  1%   43.78m ± 1%   -4.18% (p=0.002 n=6)
Query/sum_by_(le)(h_2000),_range_query_with_100_steps                         104.06m ±  0%   96.44m ± 1%   -7.32% (p=0.002 n=6)
Query/sum_by_(le)(h_2000),_range_query_with_1000_steps                         683.8m ±  0%   560.5m ± 1%  -18.03% (p=0.002 n=6)
Query/rate(a_1[1m])_+_rate(b_1[1m]),_instant_query                             232.9µ ±  1%   216.2µ ± 2%   -7.17% (p=0.002 n=6)
Query/rate(a_1[1m])_+_rate(b_1[1m]),_range_query_with_100_steps                276.6µ ±  2%   231.2µ ± 2%  -16.42% (p=0.002 n=6)
Query/rate(a_1[1m])_+_rate(b_1[1m]),_range_query_with_1000_steps               710.4µ ±  2%   340.7µ ± 3%  -52.04% (p=0.002 n=6)
Query/rate(a_100[1m])_+_rate(b_100[1m]),_instant_query                         1.150m ±  1%   1.102m ± 0%   -4.15% (p=0.002 n=6)
Query/rate(a_100[1m])_+_rate(b_100[1m]),_range_query_with_100_steps            5.453m ±  1%   2.268m ± 1%  -58.41% (p=0.002 n=6)
Query/rate(a_100[1m])_+_rate(b_100[1m]),_range_query_with_1000_steps           43.07m ±  1%   11.55m ± 1%  -73.18% (p=0.002 n=6)
Query/rate(a_2000[1m])_+_rate(b_2000[1m]),_instant_query                       15.28m ±  1%   14.82m ± 1%   -3.04% (p=0.002 n=6)
Query/rate(a_2000[1m])_+_rate(b_2000[1m]),_range_query_with_100_steps         102.03m ±  1%   37.52m ± 1%  -63.22% (p=0.002 n=6)
Query/rate(a_2000[1m])_+_rate(b_2000[1m]),_range_query_with_1000_steps         928.4m ±  1%   214.7m ± 0%  -76.87% (p=0.002 n=6)
Query/sum(a_1_+_b_1),_instant_query                                            225.9µ ±  1%   214.6µ ± 2%   -5.00% (p=0.002 n=6)
Query/sum(a_1_+_b_1),_range_query_with_100_steps                               266.8µ ±  2%   228.0µ ± 2%  -14.55% (p=0.002 n=6)
Query/sum(a_1_+_b_1),_range_query_with_1000_steps                              650.4µ ±  2%   329.4µ ± 2%  -49.36% (p=0.002 n=6)
Query/sum(a_100_+_b_100),_instant_query                                        1.189m ±  1%   1.133m ± 1%   -4.72% (p=0.002 n=6)
Query/sum(a_100_+_b_100),_range_query_with_100_steps                           4.504m ±  1%   2.043m ± 1%  -54.64% (p=0.002 n=6)
Query/sum(a_100_+_b_100),_range_query_with_1000_steps                          34.07m ±  1%   10.34m ± 0%  -69.64% (p=0.002 n=6)
Query/sum(a_2000_+_b_2000),_instant_query                                      15.94m ±  1%   15.41m ± 1%   -3.34% (p=0.002 n=6)
Query/sum(a_2000_+_b_2000),_range_query_with_100_steps                         83.55m ±  2%   33.20m ± 1%  -60.26% (p=0.002 n=6)
Query/sum(a_2000_+_b_2000),_range_query_with_1000_steps                        764.1m ±  0%   192.3m ± 0%  -74.84% (p=0.002 n=6)
Query/sum_by_(le)(rate(h_1[1m])),_instant_query                                153.3µ ±  1%   142.2µ ± 1%   -7.26% (p=0.002 n=6)
Query/sum_by_(le)(rate(h_1[1m])),_range_query_with_100_steps                   241.2µ ±  4%   184.2µ ± 3%  -23.64% (p=0.002 n=6)
Query/sum_by_(le)(rate(h_1[1m])),_range_query_with_1000_steps                  932.3µ ±  6%   540.8µ ± 1%  -41.99% (p=0.002 n=6)
Query/sum_by_(le)(rate(h_100[1m])),_instant_query                              2.455m ±  1%   2.341m ± 2%   -4.62% (p=0.002 n=6)
Query/sum_by_(le)(rate(h_100[1m])),_range_query_with_100_steps                 9.185m ±  8%   5.771m ± 0%  -37.16% (p=0.002 n=6)
Query/sum_by_(le)(rate(h_100[1m])),_range_query_with_1000_steps                73.48m ±  0%   33.33m ± 1%  -54.64% (p=0.002 n=6)
Query/sum_by_(le)(rate(h_2000[1m])),_instant_query                             43.97m ±  2%   42.68m ± 0%   -2.95% (p=0.002 n=6)
Query/sum_by_(le)(rate(h_2000[1m])),_range_query_with_100_steps                165.6m ± 15%   111.2m ± 1%  -32.84% (p=0.002 n=6)
Query/sum_by_(le)(rate(h_2000[1m])),_range_query_with_1000_steps              1327.0m ±  0%   641.8m ± 1%  -51.63% (p=0.002 n=6)
geomean                                                                        7.430m         5.174m       -30.37%

                                                                       │      standard      │               streaming               │
                                                                       │        B/op        │      B/op       vs base               │
Query/a_1,_instant_query                                                       20.20Ki ± 0%    17.24Ki ±  0%  -14.65% (p=0.002 n=6)
Query/a_1,_range_query_with_100_steps                                          21.16Ki ± 0%    17.84Ki ±  0%  -15.69% (p=0.002 n=6)
Query/a_1,_range_query_with_1000_steps                                         27.14Ki ± 1%    23.91Ki ±  0%  -11.88% (p=0.002 n=6)
Query/a_100,_instant_query                                                     140.1Ki ± 0%    122.0Ki ±  0%  -12.95% (p=0.002 n=6)
Query/a_100,_range_query_with_100_steps                                        196.0Ki ± 0%    182.1Ki ±  0%   -7.09% (p=0.002 n=6)
Query/a_100,_range_query_with_1000_steps                                       770.4Ki ± 0%    758.2Ki ±  0%   -1.58% (p=0.002 n=6)
Query/a_2000,_instant_query                                                    2.407Mi ± 0%    2.086Mi ±  0%  -13.36% (p=0.002 n=6)
Query/a_2000,_range_query_with_100_steps                                       3.428Mi ± 0%    3.265Mi ±  0%   -4.77% (p=0.002 n=6)
Query/a_2000,_range_query_with_1000_steps                                      14.50Mi ± 0%    14.37Mi ±  0%   -0.88% (p=0.002 n=6)
Query/rate(a_1[1m]),_instant_query                                             22.44Ki ± 0%    17.67Ki ±  0%  -21.27% (p=0.002 n=6)
Query/rate(a_1[1m]),_range_query_with_100_steps                                23.29Ki ± 0%    18.24Ki ±  0%  -21.69% (p=0.002 n=6)
Query/rate(a_1[1m]),_range_query_with_1000_steps                               29.13Ki ± 1%    23.98Ki ±  0%  -17.69% (p=0.002 n=6)
Query/rate(a_100[1m]),_instant_query                                           164.3Ki ± 0%    124.9Ki ±  0%  -23.97% (p=0.002 n=6)
Query/rate(a_100[1m]),_range_query_with_100_steps                              220.1Ki ± 0%    184.9Ki ±  0%  -16.01% (p=0.002 n=6)
Query/rate(a_100[1m]),_range_query_with_1000_steps                             758.7Ki ± 0%    724.8Ki ±  0%   -4.47% (p=0.002 n=6)
Query/rate(a_2000[1m]),_instant_query                                          2.857Mi ± 0%    2.137Mi ±  0%  -25.18% (p=0.002 n=6)
Query/rate(a_2000[1m]),_range_query_with_100_steps                             3.879Mi ± 0%    3.326Mi ±  1%  -14.25% (p=0.002 n=6)
Query/rate(a_2000[1m]),_range_query_with_1000_steps                            14.32Mi ± 0%    13.84Mi ±  0%   -3.40% (p=0.002 n=6)
Query/rate(a_1[1m]),_range_query_with_10000_steps                              79.90Ki ± 6%    66.90Ki ±  2%  -16.27% (p=0.002 n=6)
Query/rate(a_100[1m]),_range_query_with_10000_steps                            4.993Mi ± 4%    4.986Mi ±  0%        ~ (p=1.000 n=6)
Query/rate(a_2000[1m]),_range_query_with_10000_steps                          1068.8Mi ± 0%    599.7Mi ±  0%  -43.89% (p=0.002 n=6)
Query/rate(a_1[1d]),_instant_query                                            632.50Ki ± 3%    67.00Ki ±  5%  -89.41% (p=0.002 n=6)
Query/rate(a_1[1d]),_range_query_with_100_steps                               651.78Ki ± 1%    66.88Ki ±  5%  -89.74% (p=0.002 n=6)
Query/rate(a_1[1d]),_range_query_with_1000_steps                              649.71Ki ± 3%    76.55Ki ± 16%  -88.22% (p=0.002 n=6)
Query/rate(a_100[1d]),_instant_query                                           5.181Mi ± 1%    4.681Mi ±  1%   -9.66% (p=0.002 n=6)
Query/rate(a_100[1d]),_range_query_with_100_steps                              5.197Mi ± 3%    4.685Mi ±  2%   -9.84% (p=0.002 n=6)
Query/rate(a_100[1d]),_range_query_with_1000_steps                             5.498Mi ± 7%    5.169Mi ±  2%        ~ (p=0.180 n=6)
Query/rate(a_2000[1d]),_instant_query                                          86.90Mi ± 1%    85.94Mi ±  1%   -1.11% (p=0.009 n=6)
Query/rate(a_2000[1d]),_range_query_with_100_steps                             92.64Mi ± 1%    92.15Mi ±  1%        ~ (p=0.240 n=6)
Query/rate(a_2000[1d]),_range_query_with_1000_steps                            126.4Mi ± 1%    125.8Mi ±  0%   -0.47% (p=0.015 n=6)
Query/a_1_-_b_1,_instant_query                                                 41.54Ki ± 0%    36.42Ki ±  0%  -12.33% (p=0.002 n=6)
Query/a_1_-_b_1,_range_query_with_100_steps                                    47.81Ki ± 0%    37.61Ki ±  0%  -21.32% (p=0.002 n=6)
Query/a_1_-_b_1,_range_query_with_1000_steps                                  102.49Ki ± 0%    49.73Ki ±  0%  -51.48% (p=0.002 n=6)
Query/a_100_-_b_100,_instant_query                                             372.1Ki ± 0%    262.7Ki ±  0%  -29.40% (p=0.002 n=6)
Query/a_100_-_b_100,_range_query_with_100_steps                                586.3Ki ± 0%    383.7Ki ±  0%  -34.55% (p=0.002 n=6)
Query/a_100_-_b_100,_range_query_with_1000_steps                               2.541Mi ± 0%    1.503Mi ±  0%  -40.85% (p=0.002 n=6)
Query/a_2000_-_b_2000,_instant_query                                           6.968Mi ± 0%    4.516Mi ±  0%  -35.19% (p=0.002 n=6)
Query/a_2000_-_b_2000,_range_query_with_100_steps                              9.187Mi ± 0%    6.820Mi ±  0%  -25.76% (p=0.002 n=6)
Query/a_2000_-_b_2000,_range_query_with_1000_steps                             32.16Mi ± 0%    29.13Mi ±  1%   -9.42% (p=0.002 n=6)
Query/a_1_-_b_1,_range_query_with_10000_steps                                  688.7Ki ± 3%    139.7Ki ±  2%  -79.72% (p=0.002 n=6)
Query/a_100_-_b_100,_range_query_with_10000_steps                             19.575Mi ± 1%    9.913Mi ±  0%  -49.36% (p=0.002 n=6)
Query/a_2000_-_b_2000,_range_query_with_10000_steps                           3107.2Mi ± 0%    698.1Mi ±  0%  -77.53% (p=0.002 n=6)
Query/a_100{l=~"[13579]."}_-_b_100,_instant_query                              291.1Ki ± 0%    211.4Ki ±  0%  -27.38% (p=0.002 n=6)
Query/a_100{l=~"[13579]."}_-_b_100,_range_query_with_100_steps                 467.5Ki ± 0%    401.0Ki ±  0%  -14.23% (p=0.002 n=6)
Query/a_100{l=~"[13579]."}_-_b_100,_range_query_with_1000_steps                2.092Mi ± 0%    1.929Mi ±  0%   -7.79% (p=0.002 n=6)
Query/a_2000{l=~"1..."}_-_b_2000,_instant_query                                5.258Mi ± 0%    3.011Mi ±  0%  -42.73% (p=0.002 n=6)
Query/a_2000{l=~"1..."}_-_b_2000,_range_query_with_100_steps                   6.911Mi ± 0%    4.723Mi ±  1%  -31.66% (p=0.002 n=6)
Query/a_2000{l=~"1..."}_-_b_2000,_range_query_with_1000_steps                  23.54Mi ± 1%    20.19Mi ±  1%  -14.24% (p=0.002 n=6)
Query/sum(a_1),_instant_query                                                  21.31Ki ± 0%    17.83Ki ±  0%  -16.34% (p=0.002 n=6)
Query/sum(a_1),_range_query_with_100_steps                                     22.26Ki ± 0%    19.51Ki ±  0%  -12.35% (p=0.002 n=6)
Query/sum(a_1),_range_query_with_1000_steps                                    28.32Ki ± 1%    33.65Ki ±  0%  +18.83% (p=0.002 n=6)
Query/sum(a_100),_instant_query                                                144.4Ki ± 0%    123.5Ki ±  0%  -14.50% (p=0.002 n=6)
Query/sum(a_100),_range_query_with_100_steps                                   204.2Ki ± 0%    183.7Ki ±  0%  -10.03% (p=0.002 n=6)
Query/sum(a_100),_range_query_with_1000_steps                                  779.0Ki ± 0%    769.8Ki ±  0%   -1.18% (p=0.002 n=6)
Query/sum(a_2000),_instant_query                                               2.471Mi ± 0%    2.072Mi ±  0%  -16.13% (p=0.002 n=6)
Query/sum(a_2000),_range_query_with_100_steps                                  3.561Mi ± 0%    3.179Mi ±  0%  -10.72% (p=0.002 n=6)
Query/sum(a_2000),_range_query_with_1000_steps                                 14.68Mi ± 0%    14.39Mi ±  0%   -1.98% (p=0.002 n=6)
Query/sum_by_(l)(h_1),_instant_query                                           27.61Ki ± 0%    23.24Ki ±  0%  -15.85% (p=0.002 n=6)
Query/sum_by_(l)(h_1),_range_query_with_100_steps                              31.28Ki ± 0%    27.60Ki ±  0%  -11.77% (p=0.002 n=6)
Query/sum_by_(l)(h_1),_range_query_with_1000_steps                             67.41Ki ± 0%    71.68Ki ±  0%   +6.34% (p=0.002 n=6)
Query/sum_by_(l)(h_100),_instant_query                                         906.3Ki ± 0%    748.2Ki ±  0%  -17.44% (p=0.002 n=6)
Query/sum_by_(l)(h_100),_range_query_with_100_steps                            1.212Mi ± 0%    1.174Mi ±  0%   -3.15% (p=0.002 n=6)
Query/sum_by_(l)(h_100),_range_query_with_1000_steps                           4.570Mi ± 1%    5.346Mi ±  1%  +16.99% (p=0.002 n=6)
Query/sum_by_(l)(h_2000),_instant_query                                        18.97Mi ± 0%    15.99Mi ±  1%  -15.71% (p=0.002 n=6)
Query/sum_by_(l)(h_2000),_range_query_with_100_steps                           25.21Mi ± 0%    25.76Mi ±  1%   +2.19% (p=0.002 n=6)
Query/sum_by_(l)(h_2000),_range_query_with_1000_steps                          91.63Mi ± 1%   124.01Mi ±  3%  +35.34% (p=0.002 n=6)
Query/sum_by_(le)(h_1),_instant_query                                          29.12Ki ± 0%    23.37Ki ±  0%  -19.77% (p=0.002 n=6)
Query/sum_by_(le)(h_1),_range_query_with_100_steps                             32.55Ki ± 0%    33.19Ki ±  0%   +1.98% (p=0.002 n=6)
Query/sum_by_(le)(h_1),_range_query_with_1000_steps                            68.69Ki ± 0%   117.21Ki ±  0%  +70.64% (p=0.002 n=6)
Query/sum_by_(le)(h_100),_instant_query                                        868.9Ki ± 0%    729.8Ki ±  0%  -16.01% (p=0.002 n=6)
Query/sum_by_(le)(h_100),_range_query_with_100_steps                           1.181Mi ± 0%    1.052Mi ±  0%  -10.87% (p=0.002 n=6)
Query/sum_by_(le)(h_100),_range_query_with_1000_steps                          4.542Mi ± 0%    4.491Mi ±  1%   -1.11% (p=0.002 n=6)
Query/sum_by_(le)(h_2000),_instant_query                                       18.12Mi ± 0%    15.45Mi ±  0%  -14.73% (p=0.002 n=6)
Query/sum_by_(le)(h_2000),_range_query_with_100_steps                          24.50Mi ± 0%    22.18Mi ±  0%   -9.46% (p=0.002 n=6)
Query/sum_by_(le)(h_2000),_range_query_with_1000_steps                         91.00Mi ± 0%    89.33Mi ±  1%   -1.84% (p=0.002 n=6)
Query/rate(a_1[1m])_+_rate(b_1[1m]),_instant_query                             46.02Ki ± 0%    37.26Ki ±  0%  -19.05% (p=0.002 n=6)
Query/rate(a_1[1m])_+_rate(b_1[1m]),_range_query_with_100_steps                52.31Ki ± 0%    38.45Ki ±  0%  -26.49% (p=0.002 n=6)
Query/rate(a_1[1m])_+_rate(b_1[1m]),_range_query_with_1000_steps              106.31Ki ± 0%    49.80Ki ±  0%  -53.15% (p=0.002 n=6)
Query/rate(a_100[1m])_+_rate(b_100[1m]),_instant_query                         415.2Ki ± 0%    267.0Ki ±  0%  -35.69% (p=0.002 n=6)
Query/rate(a_100[1m])_+_rate(b_100[1m]),_range_query_with_100_steps            629.6Ki ± 0%    387.8Ki ±  0%  -38.42% (p=0.002 n=6)
Query/rate(a_100[1m])_+_rate(b_100[1m]),_range_query_with_1000_steps           2.512Mi ± 0%    1.435Mi ±  0%  -42.90% (p=0.002 n=6)
Query/rate(a_2000[1m])_+_rate(b_2000[1m]),_instant_query                       7.780Mi ± 0%    4.586Mi ±  0%  -41.05% (p=0.002 n=6)
Query/rate(a_2000[1m])_+_rate(b_2000[1m]),_range_query_with_100_steps         10.024Mi ± 0%    6.886Mi ±  1%  -31.31% (p=0.002 n=6)
Query/rate(a_2000[1m])_+_rate(b_2000[1m]),_range_query_with_1000_steps         31.72Mi ± 1%    27.82Mi ±  1%  -12.27% (p=0.002 n=6)
Query/sum(a_1_+_b_1),_instant_query                                            42.80Ki ± 0%    37.06Ki ±  0%  -13.42% (p=0.002 n=6)
Query/sum(a_1_+_b_1),_range_query_with_100_steps                               49.12Ki ± 0%    39.33Ki ±  0%  -19.93% (p=0.002 n=6)
Query/sum(a_1_+_b_1),_range_query_with_1000_steps                             103.73Ki ± 0%    59.51Ki ±  0%  -42.63% (p=0.002 n=6)
Query/sum(a_100_+_b_100),_instant_query                                        376.7Ki ± 0%    264.2Ki ±  0%  -29.86% (p=0.002 n=6)
Query/sum(a_100_+_b_100),_range_query_with_100_steps                           595.1Ki ± 0%    384.4Ki ±  0%  -35.40% (p=0.002 n=6)
Query/sum(a_100_+_b_100),_range_query_with_1000_steps                          2.549Mi ± 0%    1.514Mi ±  0%  -40.61% (p=0.002 n=6)
Query/sum(a_2000_+_b_2000),_instant_query                                      7.032Mi ± 0%    4.487Mi ±  0%  -36.20% (p=0.002 n=6)
Query/sum(a_2000_+_b_2000),_range_query_with_100_steps                         9.335Mi ± 6%    6.728Mi ±  0%  -27.94% (p=0.002 n=6)
Query/sum(a_2000_+_b_2000),_range_query_with_1000_steps                        32.44Mi ± 1%    29.36Mi ±  2%   -9.48% (p=0.002 n=6)
Query/sum_by_(le)(rate(h_1[1m])),_instant_query                                32.88Ki ± 0%    23.80Ki ±  0%  -27.61% (p=0.002 n=6)
Query/sum_by_(le)(rate(h_1[1m])),_range_query_with_100_steps                   36.00Ki ± 0%    33.58Ki ±  0%   -6.71% (p=0.002 n=6)
Query/sum_by_(le)(rate(h_1[1m])),_range_query_with_1000_steps                  69.37Ki ± 0%   114.78Ki ±  0%  +65.46% (p=0.002 n=6)
Query/sum_by_(le)(rate(h_100[1m])),_instant_query                             1007.7Ki ± 0%    750.0Ki ±  0%  -25.57% (p=0.002 n=6)
Query/sum_by_(le)(rate(h_100[1m])),_range_query_with_100_steps                 1.315Mi ± 0%    1.073Mi ±  0%  -18.42% (p=0.002 n=6)
Query/sum_by_(le)(rate(h_100[1m])),_range_query_with_1000_steps                4.488Mi ± 0%    4.308Mi ±  0%   -4.01% (p=0.002 n=6)
Query/sum_by_(le)(rate(h_2000[1m])),_instant_query                             20.78Mi ± 0%    15.81Mi ±  0%  -23.90% (p=0.002 n=6)
Query/sum_by_(le)(rate(h_2000[1m])),_range_query_with_100_steps                27.08Mi ± 1%    22.56Mi ±  0%  -16.72% (p=0.002 n=6)
Query/sum_by_(le)(rate(h_2000[1m])),_range_query_with_1000_steps              278.70Mi ± 0%    85.93Mi ±  0%  -69.17% (p=0.002 n=6)
geomean                                                                        1.147Mi         884.4Ki        -24.72%

                                                                       │      standard      │             streaming              │
                                                                       │     allocs/op      │  allocs/op   vs base               │
Query/a_1,_instant_query                                                         360.0 ± 0%    303.0 ± 0%  -15.83% (p=0.002 n=6)
Query/a_1,_range_query_with_100_steps                                            371.0 ± 0%    308.0 ± 0%  -16.98% (p=0.002 n=6)
Query/a_1,_range_query_with_1000_steps                                           401.0 ± 0%    338.0 ± 0%  -15.71% (p=0.002 n=6)
Query/a_100,_instant_query                                                      1.975k ± 0%   1.910k ± 0%   -3.29% (p=0.002 n=6)
Query/a_100,_range_query_with_100_steps                                         2.486k ± 0%   2.417k ± 0%   -2.78% (p=0.002 n=6)
Query/a_100,_range_query_with_1000_steps                                        5.499k ± 0%   5.432k ± 0%   -1.22% (p=0.002 n=6)
Query/a_2000,_instant_query                                                     32.79k ± 0%   32.70k ± 0%   -0.27% (p=0.002 n=6)
Query/a_2000,_range_query_with_100_steps                                        42.84k ± 0%   42.76k ± 0%   -0.18% (p=0.002 n=6)
Query/a_2000,_range_query_with_1000_steps                                       102.9k ± 0%   102.9k ± 0%   -0.06% (p=0.002 n=6)
Query/rate(a_1[1m]),_instant_query                                               403.0 ± 0%    313.0 ± 0%  -22.33% (p=0.002 n=6)
Query/rate(a_1[1m]),_range_query_with_100_steps                                  414.0 ± 0%    318.0 ± 0%  -23.19% (p=0.002 n=6)
Query/rate(a_1[1m]),_range_query_with_1000_steps                                 441.0 ± 0%    345.0 ± 0%  -21.77% (p=0.002 n=6)
Query/rate(a_100[1m]),_instant_query                                            2.422k ± 0%   2.019k ± 0%  -16.64% (p=0.002 n=6)
Query/rate(a_100[1m]),_range_query_with_100_steps                               2.934k ± 0%   2.527k ± 0%  -13.87% (p=0.002 n=6)
Query/rate(a_100[1m]),_range_query_with_1000_steps                              5.649k ± 0%   5.242k ± 0%   -7.21% (p=0.002 n=6)
Query/rate(a_2000[1m]),_instant_query                                           40.85k ± 0%   34.71k ± 0%  -15.02% (p=0.002 n=6)
Query/rate(a_2000[1m]),_range_query_with_100_steps                              50.90k ± 0%   44.78k ± 0%  -12.02% (p=0.002 n=6)
Query/rate(a_2000[1m]),_range_query_with_1000_steps                            105.00k ± 0%   98.90k ± 0%   -5.81% (p=0.002 n=6)
Query/rate(a_1[1m]),_range_query_with_10000_steps                                670.0 ± 0%    574.0 ± 0%  -14.33% (p=0.002 n=6)
Query/rate(a_100[1m]),_range_query_with_10000_steps                             28.63k ± 0%   28.23k ± 0%   -1.39% (p=0.002 n=6)
Query/rate(a_2000[1m]),_range_query_with_10000_steps                            576.2k ± 0%   564.0k ± 0%   -2.13% (p=0.002 n=6)
Query/rate(a_1[1d]),_instant_query                                               646.5 ± 0%    542.0 ± 0%  -16.16% (p=0.002 n=6)
Query/rate(a_1[1d]),_range_query_with_100_steps                                  655.5 ± 0%    545.0 ± 0%  -16.86% (p=0.002 n=6)
Query/rate(a_1[1d]),_range_query_with_1000_steps                                 676.0 ± 0%    567.0 ± 0%  -16.12% (p=0.002 n=6)
Query/rate(a_100[1d]),_instant_query                                            25.37k ± 0%   24.94k ± 0%   -1.71% (p=0.002 n=6)
Query/rate(a_100[1d]),_range_query_with_100_steps                               25.67k ± 0%   25.26k ± 0%   -1.59% (p=0.002 n=6)
Query/rate(a_100[1d]),_range_query_with_1000_steps                              27.78k ± 0%   27.40k ± 0%   -1.36% (p=0.002 n=6)
Query/rate(a_2000[1d]),_instant_query                                           501.6k ± 0%   491.8k ± 0%   -1.95% (p=0.002 n=6)
Query/rate(a_2000[1d]),_range_query_with_100_steps                              509.9k ± 0%   503.8k ± 0%   -1.20% (p=0.002 n=6)
Query/rate(a_2000[1d]),_range_query_with_1000_steps                             552.1k ± 0%   546.1k ± 0%   -1.08% (p=0.002 n=6)
Query/a_1_-_b_1,_instant_query                                                   720.0 ± 0%    626.0 ± 0%  -13.06% (p=0.002 n=6)
Query/a_1_-_b_1,_range_query_with_100_steps                                      934.0 ± 0%    636.0 ± 0%  -31.91% (p=0.002 n=6)
Query/a_1_-_b_1,_range_query_with_1000_steps                                    2795.0 ± 0%    697.0 ± 0%  -75.06% (p=0.002 n=6)
Query/a_100_-_b_100,_instant_query                                              4.579k ± 0%   4.246k ± 0%   -7.27% (p=0.002 n=6)
Query/a_100_-_b_100,_range_query_with_100_steps                                 5.800k ± 0%   5.260k ± 0%   -9.31% (p=0.002 n=6)
Query/a_100_-_b_100,_range_query_with_1000_steps                                15.51k ± 0%   11.29k ± 0%  -27.20% (p=0.002 n=6)
Query/a_2000_-_b_2000,_instant_query                                            77.69k ± 0%   73.50k ± 0%   -5.40% (p=0.002 n=6)
Query/a_2000_-_b_2000,_range_query_with_100_steps                               93.95k ± 0%   93.56k ± 0%   -0.42% (p=0.002 n=6)
Query/a_2000_-_b_2000,_range_query_with_1000_steps                              216.1k ± 0%   213.8k ± 0%   -1.04% (p=0.002 n=6)
Query/a_1_-_b_1,_range_query_with_10000_steps                                  21.256k ± 0%   1.154k ± 0%  -94.57% (p=0.002 n=6)
Query/a_100_-_b_100,_range_query_with_10000_steps                               97.56k ± 0%   56.64k ± 0%  -41.95% (p=0.002 n=6)
Query/a_2000_-_b_2000,_range_query_with_10000_steps                             1.172M ± 0%   1.126M ± 0%   -3.95% (p=0.002 n=6)
Query/a_100{l=~"[13579]."}_-_b_100,_instant_query                               3.577k ± 0%   3.302k ± 0%   -7.69% (p=0.002 n=6)
Query/a_100{l=~"[13579]."}_-_b_100,_range_query_with_100_steps                  4.565k ± 0%   4.061k ± 0%  -11.04% (p=0.002 n=6)
Query/a_100{l=~"[13579]."}_-_b_100,_range_query_with_1000_steps                12.508k ± 0%   8.592k ± 0%  -31.31% (p=0.002 n=6)
Query/a_2000{l=~"1..."}_-_b_2000,_instant_query                                 57.48k ± 0%   45.14k ± 0%  -21.46% (p=0.002 n=6)
Query/a_2000{l=~"1..."}_-_b_2000,_range_query_with_100_steps                    69.74k ± 0%   56.46k ± 0%  -19.04% (p=0.002 n=6)
Query/a_2000{l=~"1..."}_-_b_2000,_range_query_with_1000_steps                   161.7k ± 0%   122.1k ± 0%  -24.50% (p=0.002 n=6)
Query/sum(a_1),_instant_query                                                    384.0 ± 0%    312.0 ± 0%  -18.75% (p=0.002 n=6)
Query/sum(a_1),_range_query_with_100_steps                                       395.0 ± 0%    321.0 ± 0%  -18.73% (p=0.002 n=6)
Query/sum(a_1),_range_query_with_1000_steps                                      425.0 ± 0%    351.0 ± 0%  -17.41% (p=0.002 n=6)
Query/sum(a_100),_instant_query                                                 1.999k ± 0%   1.920k ± 0%   -3.95% (p=0.002 n=6)
Query/sum(a_100),_range_query_with_100_steps                                    2.511k ± 0%   2.429k ± 0%   -3.25% (p=0.002 n=6)
Query/sum(a_100),_range_query_with_1000_steps                                   5.524k ± 0%   5.444k ± 0%   -1.46% (p=0.002 n=6)
Query/sum(a_2000),_instant_query                                                32.81k ± 0%   32.71k ± 0%   -0.30% (p=0.002 n=6)
Query/sum(a_2000),_range_query_with_100_steps                                   42.86k ± 0%   42.76k ± 0%   -0.23% (p=0.002 n=6)
Query/sum(a_2000),_range_query_with_1000_steps                                  103.0k ± 0%   102.9k ± 0%   -0.06% (p=0.002 n=6)
Query/sum_by_(l)(h_1),_instant_query                                             482.0 ± 0%    404.0 ± 0%  -16.18% (p=0.002 n=6)
Query/sum_by_(l)(h_1),_range_query_with_100_steps                                518.0 ± 0%    438.0 ± 0%  -15.44% (p=0.002 n=6)
Query/sum_by_(l)(h_1),_range_query_with_1000_steps                               698.0 ± 0%    619.0 ± 0%  -11.32% (p=0.002 n=6)
Query/sum_by_(l)(h_100),_instant_query                                          10.86k ± 0%   10.76k ± 0%   -0.94% (p=0.002 n=6)
Query/sum_by_(l)(h_100),_range_query_with_100_steps                             13.87k ± 0%   14.19k ± 0%   +2.29% (p=0.002 n=6)
Query/sum_by_(l)(h_100),_range_query_with_1000_steps                            31.93k ± 0%   32.27k ± 0%   +1.07% (p=0.002 n=6)
Query/sum_by_(l)(h_2000),_instant_query                                         223.0k ± 1%   210.1k ± 0%   -5.78% (p=0.002 n=6)
Query/sum_by_(l)(h_2000),_range_query_with_100_steps                            269.2k ± 0%   279.3k ± 0%   +3.74% (p=0.002 n=6)
Query/sum_by_(l)(h_2000),_range_query_with_1000_steps                           629.6k ± 0%   643.9k ± 0%   +2.27% (p=0.002 n=6)
Query/sum_by_(le)(h_1),_instant_query                                            490.0 ± 0%    409.0 ± 0%  -16.53% (p=0.002 n=6)
Query/sum_by_(le)(h_1),_range_query_with_100_steps                               526.0 ± 0%    463.5 ± 0%  -11.88% (p=0.002 n=6)
Query/sum_by_(le)(h_1),_range_query_with_1000_steps                              706.0 ± 0%    644.0 ± 0%   -8.78% (p=0.002 n=6)
Query/sum_by_(le)(h_100),_instant_query                                         10.74k ± 0%   10.65k ± 0%   -0.87% (p=0.002 n=6)
Query/sum_by_(le)(h_100),_range_query_with_100_steps                            13.76k ± 0%   13.68k ± 0%   -0.54% (p=0.002 n=6)
Query/sum_by_(le)(h_100),_range_query_with_1000_steps                           31.81k ± 0%   31.75k ± 0%   -0.19% (p=0.002 n=6)
Query/sum_by_(le)(h_2000),_instant_query                                        218.8k ± 1%   206.9k ± 0%   -5.48% (p=0.002 n=6)
Query/sum_by_(le)(h_2000),_range_query_with_100_steps                           267.0k ± 0%   267.2k ± 0%        ~ (p=0.240 n=6)
Query/sum_by_(le)(h_2000),_range_query_with_1000_steps                          627.4k ± 0%   627.7k ± 0%   +0.04% (p=0.002 n=6)
Query/rate(a_1[1m])_+_rate(b_1[1m]),_instant_query                               798.0 ± 0%    645.0 ± 0%  -19.17% (p=0.002 n=6)
Query/rate(a_1[1m])_+_rate(b_1[1m]),_range_query_with_100_steps                 1012.0 ± 0%    656.0 ± 0%  -35.18% (p=0.002 n=6)
Query/rate(a_1[1m])_+_rate(b_1[1m]),_range_query_with_1000_steps                2867.0 ± 0%    710.0 ± 0%  -75.24% (p=0.002 n=6)
Query/rate(a_100[1m])_+_rate(b_100[1m]),_instant_query                          5.468k ± 0%   4.465k ± 0%  -18.35% (p=0.002 n=6)
Query/rate(a_100[1m])_+_rate(b_100[1m]),_range_query_with_100_steps             6.690k ± 0%   5.480k ± 0%  -18.09% (p=0.002 n=6)
Query/rate(a_100[1m])_+_rate(b_100[1m]),_range_query_with_1000_steps            15.80k ± 0%   10.92k ± 0%  -30.90% (p=0.002 n=6)
Query/rate(a_2000[1m])_+_rate(b_2000[1m]),_instant_query                        93.80k ± 0%   77.52k ± 0%  -17.35% (p=0.002 n=6)
Query/rate(a_2000[1m])_+_rate(b_2000[1m]),_range_query_with_100_steps          110.06k ± 0%   97.59k ± 0%  -11.33% (p=0.002 n=6)
Query/rate(a_2000[1m])_+_rate(b_2000[1m]),_range_query_with_1000_steps          220.1k ± 0%   205.8k ± 0%   -6.52% (p=0.002 n=6)
Query/sum(a_1_+_b_1),_instant_query                                              744.0 ± 0%    635.0 ± 0%  -14.65% (p=0.002 n=6)
Query/sum(a_1_+_b_1),_range_query_with_100_steps                                 958.0 ± 0%    650.0 ± 0%  -32.15% (p=0.002 n=6)
Query/sum(a_1_+_b_1),_range_query_with_1000_steps                               2819.0 ± 0%    710.0 ± 0%  -74.81% (p=0.002 n=6)
Query/sum(a_100_+_b_100),_instant_query                                         4.603k ± 0%   4.256k ± 0%   -7.54% (p=0.002 n=6)
Query/sum(a_100_+_b_100),_range_query_with_100_steps                            5.824k ± 0%   5.271k ± 0%   -9.49% (p=0.002 n=6)
Query/sum(a_100_+_b_100),_range_query_with_1000_steps                           15.53k ± 0%   11.30k ± 0%  -27.22% (p=0.002 n=6)
Query/sum(a_2000_+_b_2000),_instant_query                                       77.72k ± 0%   73.51k ± 0%   -5.42% (p=0.002 n=6)
Query/sum(a_2000_+_b_2000),_range_query_with_100_steps                          93.99k ± 1%   93.57k ± 0%   -0.45% (p=0.002 n=6)
Query/sum(a_2000_+_b_2000),_range_query_with_1000_steps                         216.1k ± 0%   214.0k ± 0%   -0.99% (p=0.002 n=6)
Query/sum_by_(le)(rate(h_1[1m])),_instant_query                                  554.0 ± 0%    418.0 ± 0%  -24.55% (p=0.002 n=6)
Query/sum_by_(le)(rate(h_1[1m])),_range_query_with_100_steps                     582.0 ± 0%    473.0 ± 0%  -18.73% (p=0.002 n=6)
Query/sum_by_(le)(rate(h_1[1m])),_range_query_with_1000_steps                    745.0 ± 0%    635.0 ± 0%  -14.77% (p=0.002 n=6)
Query/sum_by_(le)(rate(h_100[1m])),_instant_query                               13.20k ± 0%   11.26k ± 0%  -14.68% (p=0.002 n=6)
Query/sum_by_(le)(rate(h_100[1m])),_range_query_with_100_steps                  16.20k ± 0%   14.30k ± 0%  -11.77% (p=0.002 n=6)
Query/sum_by_(le)(rate(h_100[1m])),_range_query_with_1000_steps                 32.46k ± 0%   30.56k ± 0%   -5.86% (p=0.002 n=6)
Query/sum_by_(le)(rate(h_2000[1m])),_instant_query                              276.4k ± 1%   218.9k ± 0%  -20.81% (p=0.002 n=6)
Query/sum_by_(le)(rate(h_2000[1m])),_range_query_with_100_steps                 315.3k ± 0%   279.2k ± 0%  -11.45% (p=0.002 n=6)
Query/sum_by_(le)(rate(h_2000[1m])),_range_query_with_1000_steps                665.7k ± 0%   603.7k ± 0%   -9.31% (p=0.002 n=6)
geomean                                                                         11.10k        9.219k       -16.97%

                                                                       │      standard      │               streaming                │
                                                                       │         B          │       B         vs base                │
Query/a_1,_instant_query                                                      72.84Mi ±  1%    72.25Mi ±  1%    -0.82% (p=0.015 n=6)
Query/a_1,_range_query_with_100_steps                                         72.70Mi ±  1%    71.51Mi ±  1%    -1.64% (p=0.004 n=6)
Query/a_1,_range_query_with_1000_steps                                        72.05Mi ±  2%    70.04Mi ±  1%    -2.80% (p=0.002 n=6)
Query/a_100,_instant_query                                                    66.33Mi ±  2%    65.80Mi ±  1%         ~ (p=0.368 n=6)
Query/a_100,_range_query_with_100_steps                                       67.19Mi ±  1%    65.77Mi ±  1%    -2.12% (p=0.004 n=6)
Query/a_100,_range_query_with_1000_steps                                      68.54Mi ±  1%    68.41Mi ±  1%         ~ (p=0.394 n=6)
Query/a_2000,_instant_query                                                   68.42Mi ±  3%    68.45Mi ±  0%         ~ (p=1.000 n=6)
Query/a_2000,_range_query_with_100_steps                                      74.73Mi ±  1%    76.11Mi ±  1%    +1.84% (p=0.002 n=6)
Query/a_2000,_range_query_with_1000_steps                                     134.5Mi ±  1%    136.3Mi ±  9%         ~ (p=0.509 n=6)
Query/rate(a_1[1m]),_instant_query                                            71.85Mi ±  1%    71.84Mi ±  1%         ~ (p=0.818 n=6)
Query/rate(a_1[1m]),_range_query_with_100_steps                               72.88Mi ±  2%    71.96Mi ±  1%         ~ (p=0.065 n=6)
Query/rate(a_1[1m]),_range_query_with_1000_steps                              70.88Mi ±  2%    69.79Mi ±  1%         ~ (p=0.067 n=6)
Query/rate(a_100[1m]),_instant_query                                          66.68Mi ±  1%    65.83Mi ±  0%    -1.28% (p=0.002 n=6)
Query/rate(a_100[1m]),_range_query_with_100_steps                             66.08Mi ±  1%    65.91Mi ±  2%         ~ (p=0.699 n=6)
Query/rate(a_100[1m]),_range_query_with_1000_steps                            67.52Mi ±  1%    68.53Mi ±  1%    +1.49% (p=0.002 n=6)
Query/rate(a_2000[1m]),_instant_query                                         69.01Mi ±  1%    68.42Mi ±  2%    -0.85% (p=0.015 n=6)
Query/rate(a_2000[1m]),_range_query_with_100_steps                            73.89Mi ±  2%    75.41Mi ±  3%    +2.06% (p=0.006 n=6)
Query/rate(a_2000[1m]),_range_query_with_1000_steps                           131.7Mi ±  1%    132.8Mi ±  2%         ~ (p=0.292 n=6)
Query/rate(a_1[1m]),_range_query_with_10000_steps                             67.65Mi ±  1%    68.72Mi ±  1%    +1.58% (p=0.004 n=6)
Query/rate(a_100[1m]),_range_query_with_10000_steps                           103.6Mi ±  1%    112.3Mi ±  4%    +8.41% (p=0.002 n=6)
Query/rate(a_2000[1m]),_range_query_with_10000_steps                          543.8Mi ±  5%    421.5Mi ±  3%   -22.49% (p=0.002 n=6)
Query/rate(a_1[1d]),_instant_query                                            67.98Mi ±  1%    73.12Mi ±  2%    +7.56% (p=0.002 n=6)
Query/rate(a_1[1d]),_range_query_with_100_steps                               67.20Mi ±  0%    71.86Mi ±  3%    +6.94% (p=0.002 n=6)
Query/rate(a_1[1d]),_range_query_with_1000_steps                              65.39Mi ±  1%    64.44Mi ±  2%         ~ (p=0.258 n=6)
Query/rate(a_100[1d]),_instant_query                                          70.02Mi ±  2%    70.53Mi ±  4%         ~ (p=0.329 n=6)
Query/rate(a_100[1d]),_range_query_with_100_steps                             68.98Mi ±  4%    68.83Mi ±  3%         ~ (p=0.589 n=6)
Query/rate(a_100[1d]),_range_query_with_1000_steps                            63.19Mi ±  2%    65.43Mi ±  5%         ~ (p=0.240 n=6)
Query/rate(a_2000[1d]),_instant_query                                         78.38Mi ±  1%    76.97Mi ±  1%    -1.80% (p=0.004 n=6)
Query/rate(a_2000[1d]),_range_query_with_100_steps                            78.30Mi ±  4%    78.70Mi ±  2%         ~ (p=0.331 n=6)
Query/rate(a_2000[1d]),_range_query_with_1000_steps                           111.8Mi ±  4%    110.5Mi ±  4%         ~ (p=0.937 n=6)
Query/a_1_-_b_1,_instant_query                                                72.75Mi ±  1%    72.88Mi ±  1%         ~ (p=0.290 n=6)
Query/a_1_-_b_1,_range_query_with_100_steps                                   71.61Mi ±  1%    71.97Mi ±  1%         ~ (p=0.420 n=6)
Query/a_1_-_b_1,_range_query_with_1000_steps                                  68.48Mi ±  1%    70.09Mi ±  1%    +2.35% (p=0.002 n=6)
Query/a_100_-_b_100,_instant_query                                            66.76Mi ±  1%    65.92Mi ±  1%    -1.25% (p=0.011 n=6)
Query/a_100_-_b_100,_range_query_with_100_steps                               67.09Mi ±  1%    66.21Mi ±  1%    -1.30% (p=0.002 n=6)
Query/a_100_-_b_100,_range_query_with_1000_steps                              73.14Mi ±  3%    68.69Mi ±  1%    -6.09% (p=0.002 n=6)
Query/a_2000_-_b_2000,_instant_query                                          69.03Mi ±  1%    68.98Mi ±  1%         ~ (p=0.699 n=6)
Query/a_2000_-_b_2000,_range_query_with_100_steps                             89.50Mi ±  3%    78.59Mi ±  2%   -12.19% (p=0.002 n=6)
Query/a_2000_-_b_2000,_range_query_with_1000_steps                            213.2Mi ±  0%    139.4Mi ±  1%   -34.62% (p=0.002 n=6)
Query/a_1_-_b_1,_range_query_with_10000_steps                                 68.86Mi ±  1%    70.09Mi ±  1%    +1.78% (p=0.004 n=6)
Query/a_100_-_b_100,_range_query_with_10000_steps                             158.6Mi ±  5%    113.7Mi ±  3%   -28.34% (p=0.002 n=6)
Query/a_2000_-_b_2000,_range_query_with_10000_steps                          1600.8Mi ± 11%    458.4Mi ±  1%   -71.36% (p=0.002 n=6)
Query/a_100{l=~"[13579]."}_-_b_100,_instant_query                             67.02Mi ±  1%    66.34Mi ±  1%         ~ (p=0.065 n=6)
Query/a_100{l=~"[13579]."}_-_b_100,_range_query_with_100_steps                66.80Mi ±  1%    67.16Mi ±  1%         ~ (p=0.065 n=6)
Query/a_100{l=~"[13579]."}_-_b_100,_range_query_with_1000_steps               70.56Mi ±  1%    71.12Mi ±  1%         ~ (p=0.193 n=6)
Query/a_2000{l=~"1..."}_-_b_2000,_instant_query                               68.22Mi ±  3%   141.39Mi ±  3%  +107.26% (p=0.002 n=6)
Query/a_2000{l=~"1..."}_-_b_2000,_range_query_with_100_steps                  81.85Mi ±  1%   113.49Mi ± 37%   +38.66% (p=0.002 n=6)
Query/a_2000{l=~"1..."}_-_b_2000,_range_query_with_1000_steps                 189.6Mi ±  6%    177.4Mi ±  6%    -6.46% (p=0.041 n=6)
Query/sum(a_1),_instant_query                                                 72.89Mi ±  1%    72.74Mi ±  1%         ~ (p=0.331 n=6)
Query/sum(a_1),_range_query_with_100_steps                                    72.87Mi ±  1%    73.45Mi ±  1%         ~ (p=0.126 n=6)
Query/sum(a_1),_range_query_with_1000_steps                                   71.77Mi ±  2%    79.17Mi ±  2%   +10.31% (p=0.002 n=6)
Query/sum(a_100),_instant_query                                               66.07Mi ±  1%    65.70Mi ±  1%         ~ (p=0.132 n=6)
Query/sum(a_100),_range_query_with_100_steps                                  66.69Mi ±  1%    65.60Mi ±  1%    -1.63% (p=0.002 n=6)
Query/sum(a_100),_range_query_with_1000_steps                                 68.49Mi ±  1%    65.65Mi ±  1%    -4.15% (p=0.002 n=6)
Query/sum(a_2000),_instant_query                                              68.56Mi ±  1%    67.64Mi ±  1%    -1.34% (p=0.009 n=6)
Query/sum(a_2000),_range_query_with_100_steps                                 75.28Mi ±  2%    66.77Mi ±  1%   -11.31% (p=0.002 n=6)
Query/sum(a_2000),_range_query_with_1000_steps                               133.92Mi ±  1%    70.73Mi ±  2%   -47.19% (p=0.002 n=6)
Query/sum_by_(l)(h_1),_instant_query                                          70.35Mi ±  2%    69.88Mi ±  1%         ~ (p=0.061 n=6)
Query/sum_by_(l)(h_1),_range_query_with_100_steps                             70.41Mi ±  2%    69.94Mi ±  2%         ~ (p=0.485 n=6)
Query/sum_by_(l)(h_1),_range_query_with_1000_steps                            67.91Mi ±  2%    69.67Mi ±  1%    +2.59% (p=0.002 n=6)
Query/sum_by_(l)(h_100),_instant_query                                        66.62Mi ±  3%    66.23Mi ±  1%    -0.57% (p=0.041 n=6)
Query/sum_by_(l)(h_100),_range_query_with_100_steps                           69.16Mi ±  1%    68.66Mi ±  1%         ~ (p=0.132 n=6)
Query/sum_by_(l)(h_100),_range_query_with_1000_steps                          88.68Mi ±  2%    76.27Mi ±  1%   -13.99% (p=0.002 n=6)
Query/sum_by_(l)(h_2000),_instant_query                                       72.65Mi ±  2%    70.82Mi ±  2%    -2.52% (p=0.009 n=6)
Query/sum_by_(l)(h_2000),_range_query_with_100_steps                         119.36Mi ±  1%    82.17Mi ±  2%   -31.16% (p=0.002 n=6)
Query/sum_by_(l)(h_2000),_range_query_with_1000_steps                         464.1Mi ±  0%    150.4Mi ±  3%   -67.60% (p=0.002 n=6)
Query/sum_by_(le)(h_1),_instant_query                                         70.67Mi ±  1%    70.34Mi ±  1%         ~ (p=0.071 n=6)
Query/sum_by_(le)(h_1),_range_query_with_100_steps                            70.23Mi ±  1%    74.91Mi ±  2%    +6.66% (p=0.002 n=6)
Query/sum_by_(le)(h_1),_range_query_with_1000_steps                           68.41Mi ±  1%    86.61Mi ±  1%   +26.61% (p=0.002 n=6)
Query/sum_by_(le)(h_100),_instant_query                                       67.10Mi ±  1%    66.30Mi ±  1%    -1.20% (p=0.030 n=6)
Query/sum_by_(le)(h_100),_range_query_with_100_steps                          69.29Mi ±  1%    66.02Mi ±  1%    -4.72% (p=0.002 n=6)
Query/sum_by_(le)(h_100),_range_query_with_1000_steps                         87.10Mi ±  2%    69.05Mi ±  1%   -20.73% (p=0.002 n=6)
Query/sum_by_(le)(h_2000),_instant_query                                      72.02Mi ±  2%    71.38Mi ±  3%         ~ (p=0.093 n=6)
Query/sum_by_(le)(h_2000),_range_query_with_100_steps                        113.55Mi ±  1%    69.91Mi ±  1%   -38.43% (p=0.002 n=6)
Query/sum_by_(le)(h_2000),_range_query_with_1000_steps                       431.33Mi ±  0%    73.33Mi ±  1%   -83.00% (p=0.002 n=6)
Query/rate(a_1[1m])_+_rate(b_1[1m]),_instant_query                            72.02Mi ±  1%    72.16Mi ±  1%         ~ (p=0.589 n=6)
Query/rate(a_1[1m])_+_rate(b_1[1m]),_range_query_with_100_steps               71.26Mi ±  1%    71.87Mi ±  1%    +0.86% (p=0.015 n=6)
Query/rate(a_1[1m])_+_rate(b_1[1m]),_range_query_with_1000_steps              67.88Mi ±  1%    70.08Mi ±  1%    +3.23% (p=0.002 n=6)
Query/rate(a_100[1m])_+_rate(b_100[1m]),_instant_query                        66.96Mi ±  1%    65.84Mi ±  1%    -1.68% (p=0.002 n=6)
Query/rate(a_100[1m])_+_rate(b_100[1m]),_range_query_with_100_steps           67.11Mi ±  1%    66.54Mi ±  1%         ~ (p=0.093 n=6)
Query/rate(a_100[1m])_+_rate(b_100[1m]),_range_query_with_1000_steps          72.39Mi ±  3%    67.70Mi ±  2%    -6.49% (p=0.002 n=6)
Query/rate(a_2000[1m])_+_rate(b_2000[1m]),_instant_query                      69.16Mi ±  2%    69.09Mi ±  2%         ~ (p=0.563 n=6)
Query/rate(a_2000[1m])_+_rate(b_2000[1m]),_range_query_with_100_steps         86.86Mi ±  4%    78.24Mi ±  2%    -9.92% (p=0.002 n=6)
Query/rate(a_2000[1m])_+_rate(b_2000[1m]),_range_query_with_1000_steps        211.6Mi ±  0%    140.8Mi ±  3%   -33.47% (p=0.002 n=6)
Query/sum(a_1_+_b_1),_instant_query                                           72.75Mi ±  1%    72.20Mi ±  1%         ~ (p=0.065 n=6)
Query/sum(a_1_+_b_1),_range_query_with_100_steps                              71.85Mi ±  1%    72.59Mi ±  1%    +1.03% (p=0.002 n=6)
Query/sum(a_1_+_b_1),_range_query_with_1000_steps                             68.41Mi ±  1%    75.12Mi ±  1%    +9.80% (p=0.002 n=6)
Query/sum(a_100_+_b_100),_instant_query                                       66.73Mi ±  1%    66.24Mi ±  1%         ~ (p=0.065 n=6)
Query/sum(a_100_+_b_100),_range_query_with_100_steps                          66.50Mi ±  1%    65.92Mi ±  1%    -0.87% (p=0.041 n=6)
Query/sum(a_100_+_b_100),_range_query_with_1000_steps                         73.99Mi ±  1%    65.73Mi ±  2%   -11.16% (p=0.002 n=6)
Query/sum(a_2000_+_b_2000),_instant_query                                     69.02Mi ±  1%    68.65Mi ±  3%         ~ (p=0.589 n=6)
Query/sum(a_2000_+_b_2000),_range_query_with_100_steps                        89.06Mi ±  2%    68.27Mi ±  2%   -23.35% (p=0.002 n=6)
Query/sum(a_2000_+_b_2000),_range_query_with_1000_steps                      213.24Mi ±  0%    77.19Mi ±  1%   -63.80% (p=0.002 n=6)
Query/sum_by_(le)(rate(h_1[1m])),_instant_query                               70.17Mi ±  1%    69.88Mi ±  1%         ~ (p=0.699 n=6)
Query/sum_by_(le)(rate(h_1[1m])),_range_query_with_100_steps                  69.22Mi ±  2%    74.95Mi ±  1%    +8.27% (p=0.002 n=6)
Query/sum_by_(le)(rate(h_1[1m])),_range_query_with_1000_steps                 67.19Mi ±  1%    87.00Mi ±  2%   +29.49% (p=0.002 n=6)
Query/sum_by_(le)(rate(h_100[1m])),_instant_query                             66.81Mi ±  1%    66.08Mi ±  1%    -1.10% (p=0.002 n=6)
Query/sum_by_(le)(rate(h_100[1m])),_range_query_with_100_steps                68.78Mi ±  2%    66.34Mi ±  1%    -3.56% (p=0.002 n=6)
Query/sum_by_(le)(rate(h_100[1m])),_range_query_with_1000_steps               84.90Mi ±  3%    68.48Mi ±  2%   -19.33% (p=0.002 n=6)
Query/sum_by_(le)(rate(h_2000[1m])),_instant_query                            70.59Mi ±  3%    70.88Mi ±  2%         ~ (p=0.589 n=6)
Query/sum_by_(le)(rate(h_2000[1m])),_range_query_with_100_steps              113.20Mi ±  2%    69.80Mi ±  1%   -38.33% (p=0.002 n=6)
Query/sum_by_(le)(rate(h_2000[1m])),_range_query_with_1000_steps             270.64Mi ±  3%    71.90Mi ±  2%   -73.43% (p=0.002 n=6)
geomean                                                                       85.81Mi          78.13Mi          -8.95%

* Add changelog entry

* Fix flaky test.

* Remove outdated comments

* Don't bother buffering series that won't be used.

* Clarify expected behaviour of Close

* Move `FallbackEngine` and `NotSupportedError` to their own package.

* Consolidate check for supported operator into one place

* Use string of group labels as map key when constructing output series

This solves the issue of hash conflicts, and it doesn't introduce a
significant performance or memory utilisation penalty.

* Fix indentation

* Add tests for sorting behaviour

* Reduce duplication in `favourRightSideSorter` and `favourRightSideSorter`

* Fix linting

* Add tests for `binaryOperationSeriesBuffer`.

* Add test cases for `on` and `ignoring` with multiple labels
  • Loading branch information
charleskorn authored and francoposa committed May 27, 2024
1 parent 440697a commit f82c953
Show file tree
Hide file tree
Showing 21 changed files with 2,120 additions and 603 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* [FEATURE] Continuous-test: now runable as a module with `mimir -target=continuous-test`. #7747
* [FEATURE] Store-gateway: Allow specific tenants to be enabled or disabled via `-store-gateway.enabled-tenants` or `-store-gateway.disabled-tenants` CLI flags or their corresponding YAML settings. #7653
* [FEATURE] New `-<prefix>.s3.bucket-lookup-type` flag configures lookup style type, used to access bucket in s3 compatible providers. #7684
* [FEATURE] Querier: add experimental streaming PromQL engine, enabled with `-querier.promql-engine=streaming`. #7693 #7898 #7899 #8023 #8058
* [FEATURE] Querier: add experimental streaming PromQL engine, enabled with `-querier.promql-engine=streaming`. #7693 #7898 #7899 #8023 #8058 #8096
* [FEATURE] New `/ingester/unregister-on-shutdown` HTTP endpoint allows dynamic access to ingesters' `-ingester.ring.unregister-on-shutdown` configuration. #7739
* [FEATURE] Server: added experimental [PROXY protocol support](https://www.haproxy.org/download/2.3/doc/proxy-protocol.txt). The PROXY protocol support can be enabled via `-server.proxy-protocol-enabled=true`. When enabled, the support is added both to HTTP and gRPC listening ports. #7698
* [FEATURE] mimirtool: Add `runtime-config verify` sub-command, for verifying Mimir runtime config files. #8123
Expand Down
3 changes: 2 additions & 1 deletion pkg/querier/querier.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
"github.com/grafana/mimir/pkg/storage/chunk"
"github.com/grafana/mimir/pkg/storage/lazyquery"
"github.com/grafana/mimir/pkg/streamingpromql"
"github.com/grafana/mimir/pkg/streamingpromql/compat"
"github.com/grafana/mimir/pkg/util"
"github.com/grafana/mimir/pkg/util/activitytracker"
"github.com/grafana/mimir/pkg/util/limiter"
Expand Down Expand Up @@ -170,7 +171,7 @@ func New(cfg Config, limits *validation.Overrides, distributor Distributor, stor

if cfg.EnablePromQLEngineFallback {
prometheusEngine := promql.NewEngine(opts)
eng = streamingpromql.NewEngineWithFallback(streamingEngine, prometheusEngine, reg, logger)
eng = compat.NewEngineWithFallback(streamingEngine, prometheusEngine, reg, logger)
} else {
eng = streamingEngine
}
Expand Down
30 changes: 20 additions & 10 deletions pkg/streamingpromql/benchmarks/benchmarks.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,20 @@ func TestCases(metricSizes []int) []BenchCase {
// Expr: "-a_X",
//},
//// Binary operators.
//{
// Expr: "a_X - b_X",
//},
//{
// Expr: "a_X - b_X",
// Steps: 10000,
//},
{
Expr: "a_X - b_X",
},
{
Expr: "a_X - b_X",
Steps: 10000,
},
// Test the case where one side of a binary operation has many more series than the other.
{
Expr: `a_100{l=~"[13579]."} - b_100`,
},
{
Expr: `a_2000{l=~"1..."} - b_2000`,
},
//{
// Expr: "a_X and b_X{l=~'.*[0-4]$'}",
//},
Expand Down Expand Up @@ -163,9 +170,12 @@ func TestCases(metricSizes []int) []BenchCase {
// Expr: "topk(5, a_X)",
//},
//// Combinations.
//{
// Expr: "rate(a_X[1m]) + rate(b_X[1m])",
//},
{
Expr: "rate(a_X[1m]) + rate(b_X[1m])",
},
{
Expr: "sum(a_X + b_X)",
},
{
Expr: "sum by (le)(rate(h_X[1m]))",
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: AGPL-3.0-only

package streamingpromql
package compat

import (
"errors"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: AGPL-3.0-only

package streamingpromql
package compat

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: AGPL-3.0-only

package streamingpromql
package compat

import (
"context"
Expand Down
33 changes: 20 additions & 13 deletions pkg/streamingpromql/engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import (
"github.com/prometheus/prometheus/promql"
"github.com/prometheus/prometheus/promql/promqltest"
"github.com/stretchr/testify/require"

"github.com/grafana/mimir/pkg/streamingpromql/compat"
)

func TestUnsupportedPromQLFeatures(t *testing.T) {
Expand All @@ -26,29 +28,34 @@ func TestUnsupportedPromQLFeatures(t *testing.T) {
// The goal of this is not to list every conceivable expression that is unsupported, but to cover all the
// different cases and make sure we produce a reasonable error message when these cases are encountered.
unsupportedExpressions := map[string]string{
"a + b": "PromQL expression type *parser.BinaryExpr",
"1 + 2": "scalar value as top-level expression",
"metric{} + other_metric{}": "PromQL expression type *parser.BinaryExpr",
"1": "scalar value as top-level expression",
"metric{} offset 2h": "instant vector selector with 'offset'",
"avg(metric{})": "'avg' aggregation",
"sum without(l) (metric{})": "grouping with 'without'",
"rate(metric{}[5m:1m])": "PromQL expression type *parser.SubqueryExpr",
"avg_over_time(metric{}[5m])": "'avg_over_time' function",
"-sum(metric{})": "PromQL expression type *parser.UnaryExpr",
"1 + 2": "scalar value as top-level expression",
"1 + metric{}": "binary expression with scalars",
"metric{} + 1": "binary expression with scalars",
"metric{} < other_metric{}": "binary expression with '<'",
"metric{} or other_metric{}": "binary expression with many-to-many matching",
"metric{} + on() group_left() other_metric{}": "binary expression with many-to-one matching",
"metric{} + on() group_right() other_metric{}": "binary expression with one-to-many matching",
"1": "scalar value as top-level expression",
"metric{} offset 2h": "instant vector selector with 'offset'",
"avg(metric{})": "'avg' aggregation",
"sum without(l) (metric{})": "grouping with 'without'",
"rate(metric{}[5m] offset 2h)": "range vector selector with 'offset'",
"rate(metric{}[5m:1m])": "PromQL expression type *parser.SubqueryExpr",
"avg_over_time(metric{}[5m])": "'avg_over_time' function",
"-sum(metric{})": "PromQL expression type *parser.UnaryExpr",
}

for expression, expectedError := range unsupportedExpressions {
t.Run(expression, func(t *testing.T) {
qry, err := engine.NewRangeQuery(ctx, nil, nil, expression, time.Now().Add(-time.Hour), time.Now(), time.Minute)
require.Error(t, err)
require.ErrorIs(t, err, NotSupportedError{})
require.ErrorIs(t, err, compat.NotSupportedError{})
require.EqualError(t, err, "not supported by streaming engine: "+expectedError)
require.Nil(t, qry)

qry, err = engine.NewInstantQuery(ctx, nil, nil, expression, time.Now())
require.Error(t, err)
require.ErrorIs(t, err, NotSupportedError{})
require.ErrorIs(t, err, compat.NotSupportedError{})
require.EqualError(t, err, "not supported by streaming engine: "+expectedError)
require.Nil(t, qry)
})
Expand All @@ -65,7 +72,7 @@ func TestUnsupportedPromQLFeatures(t *testing.T) {
t.Run(expression, func(t *testing.T) {
qry, err := engine.NewInstantQuery(ctx, nil, nil, expression, time.Now())
require.Error(t, err)
require.ErrorIs(t, err, NotSupportedError{})
require.ErrorIs(t, err, compat.NotSupportedError{})
require.EqualError(t, err, "not supported by streaming engine: "+expectedError)
require.Nil(t, qry)
})
Expand Down
16 changes: 0 additions & 16 deletions pkg/streamingpromql/operator/aggregation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,19 +97,3 @@ func labelsToSeriesMetadata(lbls []labels.Labels) []SeriesMetadata {

return m
}

type testOperator struct {
series []labels.Labels
}

func (t *testOperator) SeriesMetadata(_ context.Context) ([]SeriesMetadata, error) {
return labelsToSeriesMetadata(t.series), nil
}

func (t *testOperator) NextSeries(_ context.Context) (InstantVectorSeriesData, error) {
panic("NextSeries() not supported")
}

func (t *testOperator) Close() {
panic("Close() not supported")
}
Loading

0 comments on commit f82c953

Please sign in to comment.