Patrick Oyarzun
84841a4c4e
Fix regexp set matches for literal matchers
...
I was surprised to find out that posting lookups for `foo=~"(bar|bar)"`
are faster than `foo=~"bar"`. It turns out we introduced a performance
regression in https://github.com/grafana/mimir-prometheus/pull/463 .
When we added the `optimizeAlternatingLiterals` function, we subtly
broke one edge case. A regexp matcher which matches a single literal,
like `foo=~"bar"` used to return `bar` from `SetMatches()`, but
currently does not. The implication is that the tsdb will first do a
LabelValues call to get all values for `foo`, then match them against
the regexp `bar`. This PR restores the previous behavior which is able
to directly lookup postings for `foo="bar"` instead.
2024-01-02 13:42:01 -06:00
Marco Pracucci
b894301c3e
Fix FastRegexMatcher to skip nested capture groups
...
Signed-off-by: Marco Pracucci <marco@pracucci.com>
2023-12-20 13:00:59 +01:00
Marco Pracucci
0a92839843
Use slices.Clone()
...
Signed-off-by: Marco Pracucci <marco@pracucci.com>
2023-12-07 11:50:08 +01:00
Marco Pracucci
986ca1a16a
Ensure manipulating the returned FastRegexMatcher.SetMatches() doesn't pollute the matcher's internal state
...
Signed-off-by: Marco Pracucci <marco@pracucci.com>
2023-12-07 11:34:45 +01:00
Arve Knudsen
a3ee0990dd
Merge remote-tracking branch 'prometheus/main' into arve/sync-upstream
...
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2023-11-28 15:09:49 +01:00
Björn Rabenstein
a6d4b8d97b
Merge pull request #13190 from linasm/fix-float-histogram-add-sub-mutating-argument
...
Fix FloatHistogram.Add/Sub mutating its argument
2023-11-28 14:04:50 +01:00
Arve Knudsen
2b55858d8b
Merge remote-tracking branch 'prometheus/main' into arve/sync-upstream
...
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2023-11-27 17:04:10 +01:00
Linas Medziunas
f99ecc376e
Fix FloatHistogram.Add/Sub mutating its argument
...
Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>
2023-11-26 09:26:34 +02:00
Linas Medziunas
ea1862aab4
Explicit schema check in [Float]Histogram.ReduceResolution
...
Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>
2023-11-25 11:38:15 +02:00
Bryan Boreham
f0e1b592ab
Scraping: use slices.sort for exemplars
...
The sort implementation using Go generics is used everywhere else
in Prometheus.
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2023-11-24 14:42:26 +00:00
Arve Knudsen
f047647bb0
Merge remote-tracking branch 'prometheus/main' into arve/sync-upstream
...
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2023-11-24 14:36:13 +01:00
Bryan Boreham
a3e02f35d6
labels: extract common code between slice and stringlabels
...
This reduces bulk and should avoid issues if a fix is made in one file
and not the other.
A few methods now call `Range()` instead of `range`, but nothing
performance-sensitive.
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2023-11-17 18:20:03 +00:00
zenador
32ee1b15de
Fix error on ingesting out-of-order exemplars ( #13021 )
...
Fix and improve ingesting exemplars for native histograms.
See code comment for a detailed explanation of the algorithm.
Note that this changes the current behavior for all kind of samples slightly: We now allow exemplars with the same timestamp as during the last scrape if the value or the labels have changed.
Also note that we now do not ingest exemplars without timestamps for native histograms anymore.
Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
Co-authored-by: Björn Rabenstein <github@rabenste.in>
---------
Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
Signed-off-by: zenador <zenador@users.noreply.github.com>
Co-authored-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
Co-authored-by: Björn Rabenstein <github@rabenste.in>
2023-11-16 15:07:37 +01:00
Bryan Boreham
1bfb3ed062
Labels: reduce allocations when creating from TSDB WAL ( #13044 )
...
* Labels: reduce allocations when creating from TSDB
When reading the WAL, by passing references into the buffer we can avoid
copying strings under `-tags stringlabels`.
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2023-11-14 11:36:35 +00:00
Ziqi Zhao
e250f09b5d
change origin schema in ReduceResolution
method of histogram and float histogram ( #13116 )
...
* change origin schema in ReduceResolution method of histogram and float histogram
Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
---------
Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
2023-11-10 14:33:34 +01:00
Ziqi Zhao
ab2a7bb74f
add generic shrink function ( #13001 )
...
Add `ReduceResolution` method to `Histogram` and `FloatHistogram`
This takes the original `mergeToSchema` function and turns it into a more generic `reduceResolution` function, which is the building block for the new methods.
The methods will help with addressing #12864 .
---------
Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
2023-11-08 14:43:05 +01:00
Matthieu MOREL
05fba53e57
web : use Go standard package
...
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2023-11-08 06:37:59 +00:00
Julien Pivotto
cf01ec2119
Merge pull request #13091 from mmorel-35/errorlint/util
...
util: use Go standard errors package
2023-11-07 21:07:25 -06:00
Linas Medziunas
ebed7d0612
Change Validate to be a method on histogram structs
...
Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>
2023-11-03 16:47:59 +02:00
Linas Medziunas
1f8aea11d6
Move histogram validation code to model/histogram
...
Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>
2023-11-03 16:17:24 +02:00
Matthieu MOREL
fe057fc60d
use Go standard errors package
...
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2023-11-03 07:26:31 +00:00
Björn Rabenstein
fae4561369
Merge pull request #12954 from linasm/linasm/optimize-floatBucketIterator2
...
Histogram performance: optimize floatBucketIterator
2023-11-02 23:59:32 +01:00
György Krajcsovits
1149f7e9e1
Fix lint errors: dot at comment end
...
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2023-11-02 21:09:38 +01:00
György Krajcsovits
d42e296516
Merge remote-tracking branch 'upstream/main' into krajo/merge-upstream
2023-11-02 20:45:05 +01:00
Dimitar Dimitrov
601a2f91ed
Attempt to remove unused unused linter directives
2023-11-01 14:19:50 +01:00
Oleksandr Redko
fa90ca46e5
ci(lint): enable godot; append dot at the end of comments
...
Signed-off-by: Oleksandr Redko <Oleksandr_Redko@epam.com>
2023-10-31 19:53:38 +02:00
Jeanette Tan
6341ba7374
Merge remote-tracking branch 'upstream/main' into sync-upstream-20231026
2023-10-26 22:18:24 +08:00
Linas Medžiūnas
e3e22abadb
Merge branch 'main' into linasm/optimize-floatBucketIterator2
...
Signed-off-by: Linas Medžiūnas <linasm@users.noreply.github.com>
2023-10-24 16:27:10 +03:00
beorn7
b428416f06
textparse: Update comment about timestamp_ms protobuf parsing
...
By now, we know better what the plan is.
Signed-off-by: beorn7 <beorn@grafana.com>
2023-10-19 17:54:42 +02:00
Arthur Silva Sens
ef8e6ae780
Parse created timestamps from Prometheus Protobuf ( #12973 )
...
Signed-off-by: Arthur Silva Sens <arthur.sens@coralogix.com>
2023-10-18 19:04:02 +01:00
Marc Tuduri
1ce066e51c
More periods
...
Signed-off-by: Marc Tuduri <marctc@protonmail.com>
2023-10-18 11:53:50 +02:00
Marc Tuduri
af7c31ee10
PR feedback
...
Signed-off-by: Marc Tuduri <marctc@protonmail.com>
2023-10-18 11:53:50 +02:00
Marc Tuduri
8fededf6ad
promql(histograms): Change sample total calculation for histograms
...
Signed-off-by: Marc Tuduri <marctc@protonmail.com>
2023-10-18 11:51:11 +02:00
Jeanette Tan
f898005c69
Merge remote-tracking branch 'upstream/main' into sync-upstream-20231018
2023-10-18 11:43:51 +08:00
Björn Rabenstein
f33bffa788
Merge pull request #12891 from linasm/fix-gaps-in-histogram-equals
...
Fix NaN checks in [Float]Histogram.Equals method
2023-10-18 00:35:17 +02:00
Linas Medziunas
62bbb81e29
Mention bucket values in the comment
...
Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>
2023-10-14 21:30:40 +03:00
Linas Medziunas
ec823d9daf
Update comments, bitwise comparison of float buckets
...
Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>
2023-10-09 16:09:46 +03:00
Linas Medziunas
c5c5c569fa
Histogram performance: optimize floatBucketIterator
...
Signed-off-by: Linas Medziunas <linas.medziunas@gmail.com>
2023-10-09 09:40:59 +03:00
Arve Knudsen
35ab75918a
Merge remote-tracking branch 'prometheus/main' into arve/upgrade-exp
...
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2023-10-06 16:11:40 +02:00
Oleg Zaytsev
cd91345b76
Fix BenchmarkOptimizeEqualStringMatchers
...
The logic has changed, and we create a slice-based matcher for smaller
number of alternations. This fixes the benchmark.
Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
2023-10-02 12:00:18 +02:00
Matthieu MOREL
0a513f827d
ci(lint): enable errorlint linter on model
...
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2023-09-29 21:11:33 +00:00
Marco Pracucci
5d7eb6d8f9
Make linter happy
...
Signed-off-by: Marco Pracucci <marco@pracucci.com>
2023-09-29 15:33:38 +02:00
Marco Pracucci
0df8e0fac1
Clarify ordering
...
Signed-off-by: Marco Pracucci <marco@pracucci.com>
2023-09-29 15:33:38 +02:00
Marco Pracucci
79640b3eaf
Optimize .? in the FastRegexMatcher
...
Signed-off-by: Marco Pracucci <marco@pracucci.com>
2023-09-29 15:33:36 +02:00
Marco Pracucci
3ed2ca3c4c
Address offline feedback
...
Signed-off-by: Marco Pracucci <marco@pracucci.com>
2023-09-29 15:14:37 +02:00
Marco Pracucci
5ae9c194ce
Fix
...
Signed-off-by: Marco Pracucci <marco@pracucci.com>
2023-09-29 14:17:17 +02:00
Marco Pracucci
c28d940234
Improved regexp matcher in TestAnalyzeRealQueries
...
Signed-off-by: Marco Pracucci <marco@pracucci.com>
2023-09-29 12:48:55 +02:00
Marco Pracucci
20c56ae9e0
Revert change
...
Signed-off-by: Marco Pracucci <marco@pracucci.com>
2023-09-29 12:26:00 +02:00
Marco Pracucci
fe9124ffa3
Optimize regexp matcher with list of alternations ending with .*
...
Signed-off-by: Marco Pracucci <marco@pracucci.com>
2023-09-29 12:21:30 +02:00
Julien Pivotto
c52db2b196
Remove duplicate tests
...
Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2023-09-29 10:41:13 +02:00