Commit graph

20 commits

Author SHA1 Message Date
Cyril Tovena 715274ec9d
Reintroduce tests.
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
2021-10-08 10:10:18 +02:00
Cyril Tovena 7dab60e56d
More optimization.
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
2021-10-07 17:15:20 +02:00
Cyril Tovena 852b553c00
Fixes the code and improve tests.
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
2021-10-07 15:10:26 +02:00
Cyril Tovena 3c13a5e9bd
Improve tests and bench.
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
2021-10-07 14:25:31 +02:00
Cyril Tovena 54b3371060
Merge branch 'improvesetmatches' into regexpopti 2021-10-07 14:05:14 +02:00
Cyril Tovena 74c5667b63
implement optimization.
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
2021-10-07 13:56:31 +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 a1f6c747ed
Merge branch 'improvesetmatches' into regexpopti 2021-10-06 16:36:29 +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 e9f0f0ebed
Improves test and benchmark
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
2021-10-06 15:24:57 +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 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
Julien Pivotto 6c56a1faaa
Testify: move to require (#8122)
* Testify: move to require

Moving testify to require to fail tests early in case of errors.

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>

* More moves

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-10-29 09:43:23 +00:00
Julien Pivotto 4e5b1722b3
Move away from testutil, refactor imports (#8087)
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-10-22 11:00:08 +02:00
Brian Brazil cf273f21bb
Add a testcase for #8040 (#8042)
This was already fixed by #8013, but add a test case anyway
in case the regexp engine changes in future.

Signed-off-by: Brian Brazil <brian.brazil@robustperception.io>
2020-10-12 12:17:29 +01:00
Brian Brazil 924ce978b7
Don't do literal regex matching optimisation when case insensitive. (#8013)
Fixes #7994

Signed-off-by: Brian Brazil <brian.brazil@robustperception.io>
2020-10-06 13:16:26 +01:00
Marco Pracucci 2f6bf7de4c
Optimise labels regex matchers containing a literal within the pattern (#7503)
* Added labels matchers regex fast path for literals within the regex

Signed-off-by: Marco Pracucci <marco@pracucci.com>
2020-07-07 09:38:04 +01:00
Marco Pracucci cef4dd6fff
Optimized label regex matcher with literal prefix and/or suffix (#7453)
* Optimized label regex matcher with literal prefix and/or suffix

Signed-off-by: Marco Pracucci <marco@pracucci.com>

* Added license

Signed-off-by: Marco Pracucci <marco@pracucci.com>

* Added more tests cases with newlines

Signed-off-by: Marco Pracucci <marco@pracucci.com>

* Restored deleted test

Signed-off-by: Marco Pracucci <marco@pracucci.com>
2020-06-26 15:19:09 +05:30