Commit graph

9246 commits

Author SHA1 Message Date
Marco Pracucci 7aea989fad
Increase tests timeout
Signed-off-by: Marco Pracucci <marco@pracucci.com>
2021-10-07 14:26:46 +02:00
Cyril Tovena ce28912439
Fixes a test now that we support more setMatches.
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
2021-10-07 14:04:52 +02:00
Cyril Tovena 2d879c65fc
Avoid API break
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
2021-10-07 14:00:16 +02:00
Cyril Tovena f7f80a3abf
Update pkg/labels/regexp_test.go
Co-authored-by: Peter Štibraný <peter.stibrany@grafana.com>
2021-10-06 16:44:26 +02:00
Cyril Tovena 969497c5a3
more review feedback
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
2021-10-06 16:33:49 +02:00
Cyril Tovena 9733377257
Review feedback
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
2021-10-06 16:29:16 +02:00
Cyril Tovena f32ec95722
Add more tests and support begin/end text.
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
2021-10-06 16:22:48 +02:00
Cyril Tovena 92736182ce
Adding benchmark.
```
benchstat before.txt after.txt
name                                                      old time/op    new time/op    delta
PostingsForMatchers/Head/n="1"-16                            480ns ± 4%     469ns ± 4%      ~     (p=0.095 n=5+5)
PostingsForMatchers/Head/n="1",j="foo"-16                    720ns ± 1%     705ns ± 2%      ~     (p=0.056 n=5+5)
PostingsForMatchers/Head/j="foo",n="1"-16                    712ns ± 3%     726ns ± 7%      ~     (p=0.841 n=5+5)
PostingsForMatchers/Head/n="1",j!="foo"-16                   833ns ± 3%     827ns ± 1%      ~     (p=0.548 n=5+5)
PostingsForMatchers/Head/i=~"1[0-9]",j=~"foo|bar"-16        6.66ms ± 4%    0.00ms ± 1%   -99.97%  (p=0.008 n=5+5)
PostingsForMatchers/Head/j=~"foo|bar"-16                     897ns ± 2%     675ns ± 2%   -24.80%  (p=0.008 n=5+5)
PostingsForMatchers/Head/i=~"(1|2|3|4|5|6|20|55)"-16        20.1ms ± 2%     0.0ms ± 2%   -99.99%  (p=0.008 n=5+5)
PostingsForMatchers/Head/i=~".*"-16                         74.4ms ± 3%    81.3ms ± 3%    +9.29%  (p=0.008 n=5+5)
PostingsForMatchers/Head/i=~"1.*"-16                        20.3ms ±27%    17.2ms ± 2%   -15.15%  (p=0.008 n=5+5)
PostingsForMatchers/Head/i=~".*1"-16                        6.22ms ±10%    5.60ms ± 1%    -9.95%  (p=0.008 n=5+5)
PostingsForMatchers/Head/i=~".+"-16                          146ms ± 4%     126ms ± 1%   -13.63%  (p=0.016 n=4+5)
PostingsForMatchers/Head/i=~""-16                           77.0ms ±23%    68.2ms ± 5%   -11.47%  (p=0.032 n=5+5)
PostingsForMatchers/Head/i!=""-16                           57.0ms ± 4%    56.9ms ± 6%      ~     (p=1.000 n=5+5)
PostingsForMatchers/Head/n="1",i=~".*",j="foo"-16           77.1ms ± 2%    79.2ms ± 4%      ~     (p=0.095 n=5+5)
PostingsForMatchers/Head/n="1",i=~".*",i!="2",j="foo"-16    77.2ms ± 3%    81.2ms ± 3%    +5.17%  (p=0.016 n=5+5)
PostingsForMatchers/Head/n="1",i!=""-16                     64.7ms ±34%    58.4ms ± 7%      ~     (p=0.421 n=5+5)

name                                                      old alloc/op   new alloc/op   delta
PostingsForMatchers/Head/n="1"-16                            80.0B ± 0%     80.0B ± 0%      ~     (all equal)
PostingsForMatchers/Head/n="1",j="foo"-16                     208B ± 0%      208B ± 0%      ~     (all equal)
PostingsForMatchers/Head/j="foo",n="1"-16                     208B ± 0%      208B ± 0%      ~     (all equal)
PostingsForMatchers/Head/n="1",j!="foo"-16                    240B ± 0%      240B ± 0%      ~     (all equal)
PostingsForMatchers/Head/i=~"1[0-9]",j=~"foo|bar"-16        1.61MB ± 0%    0.00MB ± 0%      ~     (p=0.079 n=4+5)
PostingsForMatchers/Head/j=~"foo|bar"-16                      360B ± 0%      232B ± 0%   -35.56%  (p=0.008 n=5+5)
PostingsForMatchers/Head/i=~"(1|2|3|4|5|6|20|55)"-16        1.61MB ± 0%    0.00MB ± 0%   -99.97%  (p=0.008 n=5+5)
PostingsForMatchers/Head/i=~".*"-16                         1.61MB ± 0%    1.61MB ± 0%      ~     (all equal)
PostingsForMatchers/Head/i=~"1.*"-16                        3.15MB ± 0%    3.15MB ± 0%    -0.00%  (p=0.008 n=5+5)
PostingsForMatchers/Head/i=~".*1"-16                        1.61MB ± 0%    1.61MB ± 0%    -0.00%  (p=0.008 n=5+5)
PostingsForMatchers/Head/i=~".+"-16                         17.3MB ± 0%    17.3MB ± 0%    -0.00%  (p=0.008 n=5+5)
PostingsForMatchers/Head/i=~""-16                           17.3MB ± 0%    17.3MB ± 0%      ~     (p=0.238 n=5+5)
PostingsForMatchers/Head/i!=""-16                           17.3MB ± 0%    17.3MB ± 0%      ~     (all equal)
PostingsForMatchers/Head/n="1",i=~".*",j="foo"-16           1.61MB ± 0%    1.61MB ± 0%    -0.00%  (p=0.032 n=5+5)
PostingsForMatchers/Head/n="1",i=~".*",i!="2",j="foo"-16    1.61MB ± 0%    1.61MB ± 0%      ~     (p=0.651 n=5+4)
PostingsForMatchers/Head/n="1",i!=""-16                     17.3MB ± 0%    17.3MB ± 0%      ~     (all equal)

name                                                      old allocs/op  new allocs/op  delta
PostingsForMatchers/Head/n="1"-16                             4.00 ± 0%      4.00 ± 0%      ~     (all equal)
PostingsForMatchers/Head/n="1",j="foo"-16                     9.00 ± 0%      9.00 ± 0%      ~     (all equal)
PostingsForMatchers/Head/j="foo",n="1"-16                     9.00 ± 0%      9.00 ± 0%      ~     (all equal)
PostingsForMatchers/Head/n="1",j!="foo"-16                    10.0 ± 0%      10.0 ± 0%      ~     (all equal)
PostingsForMatchers/Head/i=~"1[0-9]",j=~"foo|bar"-16          19.0 ± 0%      23.0 ± 0%   +21.05%  (p=0.008 n=5+5)
PostingsForMatchers/Head/j=~"foo|bar"-16                      13.0 ± 0%       7.0 ± 0%   -46.15%  (p=0.008 n=5+5)
PostingsForMatchers/Head/i=~"(1|2|3|4|5|6|20|55)"-16          4.00 ± 0%     13.00 ± 0%  +225.00%  (p=0.008 n=5+5)
PostingsForMatchers/Head/i=~".*"-16                           7.00 ± 0%      7.00 ± 0%      ~     (all equal)
PostingsForMatchers/Head/i=~"1.*"-16                         11.1k ± 0%     11.1k ± 0%    -0.01%  (p=0.008 n=5+5)
PostingsForMatchers/Head/i=~".*1"-16                          4.00 ± 0%      3.00 ± 0%   -25.00%  (p=0.008 n=5+5)
PostingsForMatchers/Head/i=~".+"-16                           100k ± 0%      100k ± 0%    -0.00%  (p=0.008 n=5+5)
PostingsForMatchers/Head/i=~""-16                             100k ± 0%      100k ± 0%      ~     (all equal)
PostingsForMatchers/Head/i!=""-16                             100k ± 0%      100k ± 0%      ~     (all equal)
PostingsForMatchers/Head/n="1",i=~".*",j="foo"-16             12.0 ± 0%      12.0 ± 0%      ~     (all equal)
PostingsForMatchers/Head/n="1",i=~".*",i!="2",j="foo"-16      18.0 ± 0%      18.0 ± 0%      ~     (all equal)
PostingsForMatchers/Head/n="1",i!=""-16                       100k ± 0%      100k ± 0%      ~     (all equal)
```

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
2021-10-06 14:16:14 +02:00
Cyril Tovena d217825af8
guards against too many matches.
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
2021-10-05 16:46:24 +02:00
Cyril Tovena 639cd00721
Uses the variadic function.
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
2021-10-05 15:59:40 +02:00
Cyril Tovena 623c3ebeec
Remove redundant code and support charclass without base.
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
2021-10-05 15:16:21 +02:00
Cyril Tovena bd4d997bee
lint
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
2021-10-05 14:00:18 +02:00
Cyril Tovena 7ea8609024
typo
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
2021-10-05 13:54:55 +02:00
Cyril Tovena 453cc5de75
Add a comment for the charclass limit.
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
2021-10-05 13:52:12 +02:00
Cyril Tovena c751cfbfce
Improve findSetMatches to support concatenation.
This improves how we find `SetMatches` for regexp. Notably it allows to support concatenation
such as `api_(v1|prom)_push` for which the resulting set matches are `api_v1_push` and `api_prom_push`.

I had to support characters classes too since the syntax may try to optimize alternates with them.

In the end the code is also more robust than the previous implementation relying on the stringyfied version of the regexp.

This could be upstreamed later.

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
2021-10-05 13:43:41 +02:00
Peter Štibraný 04e7926b03
Merge pull request #13 from grafana/splitting-compactor
Compactor with support for splitting input blocks into multiple output blocks
2021-09-28 10:53:20 +02:00
Peter Štibraný 57daf79192 More review feedback. 2021-09-28 10:29:54 +02:00
Peter Štibraný db7fa7621c Use <ix+1>_of_<shardCount> formatting for better readibility. 2021-09-28 10:13:48 +02:00
Peter Štibraný 861f9083d8 Fix directory cleanup in case of compaction failure. 2021-09-27 17:05:14 +02:00
Peter Štibraný ffd281ab9d Address feedback. 2021-09-27 16:33:43 +02:00
Peter Štibraný 58dab3de8a Source blocks are deletable only if they are ALL empty. 2021-09-27 16:24:46 +02:00
Peter Štibraný 336f4260db Removed commented code. 2021-09-27 14:34:04 +02:00
Peter Štibraný 006c2d7d55 All output blocks will have the same timestamp.
Minor updates.
2021-09-27 14:22:51 +02:00
Peter Štibraný 63dbb1c69a Make lint happy. 2021-09-27 12:49:08 +02:00
Peter Štibraný 78396b67dd Compactor with support for splitting input blocks into multiple output blocks. 2021-09-27 12:40:11 +02:00
Ganesh Vernekar a9bc9c27ba
Merge pull request #11 from grafana/codesome/syncprom
Sync with upstream Prometheus
2021-09-21 18:37:41 +05:30
Ganesh Vernekar 0af335cfe8
Merge remote-tracking branch 'upstream/main' into codesome/syncprom 2021-09-21 17:38:40 +05:30
Bryan Boreham 5a754bc043
Short-circuit vector binary ops (#9362)
In degenerate cases we can save the effort of building a map.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2021-09-21 17:37:36 +05:30
Bryan Boreham c4942ef3b7
Optimise query_range by computing join signatures just once (#9360)
* Add benchmark case for many-to-one join

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* query_range: compute join signatures just once

For an expression like `a + on(p,q) b`, extract the `p,q` part from each
series once, instead of re-computing at every step of the range.

Although there was a cache, computing the key by concatenating all
labels was expensive.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2021-09-21 15:58:39 +05:30
Bryan Boreham 7d105277fe
Optimise topk where k==1 (#9365)
* Add benchmark for query_range with topk

Modify sample data so values within a metric differ

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Optimise topk where k==1

In this case we don't need a heap to keep track of values; just a single
slot is fine.

Simplify the initialization of the heap: since all cases start off as a
single-item heap we can just assign the value directly.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Allow at least one slot in results for topk, quantile

k isn't set for quantile, but we need space to start collecting values

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2021-09-21 15:57:28 +05:30
Julius Volz 03d084f862
Merge pull request #9351 from prometheus/set-npm-version
specify npm version in the engine
2021-09-20 13:39:32 +02:00
Julien Pivotto 629926268a
Merge pull request #9361 from hanjm/feature/upgrade-alecthomas-units
Upgrade github.com/alecthomas/units, which implement encoding.TextMarshaler
2021-09-20 09:41:50 +02:00
hanjm d1b16b4f21 Upgrade github.com/alecthomas/units, which implement encoding.TextMarshaler
Signed-off-by: hanjm <hanjinming@outlook.com>
2021-09-19 17:45:22 +08:00
Julien Pivotto 3f51c8bf39
Merge pull request #9358 from sennatitcomb/st
Typo fixes
2021-09-18 10:38:50 +02:00
sennatitcomb 9e7ae7b9ac Typo fixes
Signed-off-by: sennatitcomb <senna.titcomb@intel.com>
2021-09-17 15:48:02 -07:00
Ganesh Vernekar 84f8307aa1
Merge remote-tracking branch 'upstream/main' into codesome/syncprom
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-09-17 15:58:45 +05:30
Julien Pivotto da3fb842b4
Add Jessica as Promtool maintainer (#9348)
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2021-09-17 01:10:32 +02:00
Augustin Husson 545fbfd7f4 specify npm version in the engine
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2021-09-16 21:15:20 +02:00
Julius Volz d1f051381e
Merge pull request #9350 from roidelapluie/fix-tests
config: fix puppetdb tests
2021-09-16 19:53:36 +02:00
Julien Pivotto 9d65017798 config: fix puppetdb tests
This PR fixes the tests in main. The last merge introduced a failing
test in the config package.

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2021-09-16 18:31:28 +02:00
Julius Volz 62906c1b4f
Merge pull request #8883 from roidelapluie/puppetdb-sd
Add PuppetDB service discovery
2021-09-16 17:41:31 +02:00
Julien Pivotto 8920024323 Add PuppetDB service discovery
We have been Puppet user for 10 years and we are users of
https://github.com/camptocamp/prometheus-puppetdb-sd

However, that file_sd implementation contains business logic and
assumptions around e.g. the modules which you are using.

This pull request adds a simple PuppetDB service discovery, which will
enable more use cases than the upstream sd.

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2021-09-16 16:54:26 +02:00
Julius Volz 447d9401fc
Merge pull request #9239 from LeviHarrison/promql-trig-functions
PromQL: Add trigonometric functions
2021-09-16 14:11:40 +02:00
Julius Volz 6c9ded2854
Merge pull request #9344 from prometheus/fix-eslint-warning-cmp
fix eslint warning for codemirror-promql
2021-09-16 12:05:39 +02:00
Darshan Chaudhary 1f688657bf
Call delete on head if interval overlaps (#9151)
* Call delete on head if interval overlaps

Signed-off-by: darshanime <deathbullet@gmail.com>

* Garbage collect tombstones during head gc

Signed-off-by: darshanime <deathbullet@gmail.com>

* Truncate tombstones before min time during head gc

Signed-off-by: darshanime <deathbullet@gmail.com>

* Lock less by deleting all keys in a single pass

Signed-off-by: darshanime <deathbullet@gmail.com>

* Pass map to DeleteTombstones

Signed-off-by: darshanime <deathbullet@gmail.com>

* Create new slice to replace old one

Signed-off-by: darshanime <deathbullet@gmail.com>
2021-09-16 12:20:03 +05:30
Levi Harrison 2c7bec758d Tabs to spaces
Signed-off-by: Levi Harrison <git@leviharrison.dev>
2021-09-15 23:02:26 -04:00
Levi Harrison ed220c1ae7 Add grammar
Signed-off-by: Levi Harrison <git@leviharrison.dev>
2021-09-15 23:02:25 -04:00
Levi Harrison 4ac4e2ca4b Remove parenthesis
Signed-off-by: Levi Harrison <git@leviharrison.dev>
2021-09-15 22:47:10 -04:00
Levi Harrison 6faca22eec Add inverse hyperbolic functions
Signed-off-by: Levi Harrison <git@leviharrison.dev>
2021-09-15 22:47:10 -04:00
Levi Harrison 74faea64dd Removed specification of pi digits
Signed-off-by: Levi Harrison <git@leviharrison.dev>
2021-09-15 22:47:10 -04:00