Commit graph

12838 commits

Author SHA1 Message Date
beorn7 1838d56aee PromQL: Make lookback delta exclusive
This excludes samples that are precisely the full lookback delta
before the current evaluation timestamp. This is in line with the new
"left open" range selectors.

Signed-off-by: beorn7 <beorn@grafana.com>
2024-05-30 22:50:38 +02:00
Zhang Zhanpeng bcf9d77bbb wip: make lookback ignore sample on left bound 2024-05-26 17:31:54 +08:00
Zhang Zhanpeng 381f8d52e0 matrixIterSlice shall drop float and histogram at left bound
Signed-off-by: Zhang Zhanpeng <zhangzhanpeng.zzp@alibaba-inc.com>
2024-05-24 17:20:00 +08:00
Björn Rabenstein 1081e336a0
Merge pull request #14129 from prometheus/beorn7/doc
doc: Clarify the limits of dumping/backfilling via OpenMetrics
2024-05-23 13:37:42 +02:00
Jayapriya Pai 2d2b440304
fix: correct the typo in azuread sdk auth (#14106)
Signed-off-by: Jayapriya Pai <janantha@redhat.com>
2024-05-21 19:08:35 +02:00
Ayoub Mrini fabcd7e7c6
fix(api): Send warnings only if the limit is really exceeded (#14116)
for the the series, label names and label values APIs

Add warnings count check to TestEndpoints

The limit param was added in https://github.com/prometheus/prometheus/pull/13396

Signed-off-by: machine424 <ayoubmrini424@gmail.com>
2024-05-21 19:07:29 +02:00
Björn Rabenstein 5c85a55e3f
Merge pull request #14120 from kushalShukla-web/remote
added some lines prometheus.md and main.go
2024-05-21 17:49:33 +02:00
beorn7 3127a4029e doc: Clarify the limits of dumping/backfilling via OpenMetrics
This is about native histograms (not yet supported) and staleness
markers (for which OpenMetrics support isn't even planned).

Signed-off-by: beorn7 <beorn@grafana.com>
2024-05-21 14:50:06 +02:00
Björn Rabenstein 3119b8a055
Merge pull request #13218 from machine424/ro-promtool
Make DBReadOnly more RO
2024-05-21 13:27:40 +02:00
Oleg Zaytsev fe9cb5a803
Check context every 128 labels instead of 100 (#14118)
Follow up on https://github.com/prometheus/prometheus/pull/14096

As promised, I bring a benchmark, which shows a very small improvement
if context is checked every 128 iterations of label instead of every
100.

It's much easier for a computer to check modulo 128 than modulo 100.
This is a very small 0-2% improvement but I'd say this is one of the
hottest paths of the app so this is still relevant.

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
2024-05-21 11:30:43 +02:00
Björn Rabenstein 114dc5c393
Merge pull request #13638 from NeerajGartia21/promql-test
Converts existing native histogram unit tests to the PromQL testing framework
2024-05-19 19:35:36 +02:00
George Krajcsovits 52f68a96a4
web/api: export defaultStatsRenderer (#14121)
defaultStatsRenderer->DefaultStatsRenderer
Add short docstrings.

I'd like to use the stats renderer to peek at the statistics in
https://github.com/grafana/mimir/pull/7966

However I cannot call the original function without this export afterwards.

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2024-05-18 16:12:33 +02:00
kushagra Shukla 0fea1065fe added line When set, query.max-concurrency may need to be adjusted accordingly. Signed-off-by: kushagra Shukla <kushalshukla110@gmail.com>
Signed-off-by: kushagra Shukla <kushalshukla110@gmail.com>
2024-05-18 07:26:59 -04:00
Julien edf5ebd844
Merge pull request #13970 from jiekun/doc/ovh-dedicated-server-label
docs: [ovh sd] Added missing label for OVH dedicated server in SD
2024-05-16 12:19:06 +02:00
Julien d1eff95faf
Merge pull request #14100 from bboreham/windows-flake
[TEST] Rules: Sleep 15ms to fit Windows behaviour better
2024-05-16 12:04:42 +02:00
Arve Knudsen 5ca56eeb6b
tsdb/index: Refactor Reader tests (#14071)
tsdb/index: Refactor Reader tests

Co-authored-by: Björn Rabenstein <github@rabenste.in>
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

---------

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Co-authored-by: Björn Rabenstein <github@rabenste.in>
2024-05-16 11:51:46 +02:00
Bryan Boreham 1e0b0e250a
Merge pull request #14090 from colega/improve-zeroOrOneCharacterStringMatcher-Matches
Improve `zeroOrOneCharacterStringMatcher` by using `utf8.DecodeRuneInString`
2024-05-16 09:28:53 +01:00
Matthias Loibl 0b1a0c04d8
Merge pull request #14062 from rexagod/multicluster-opt-out
bugfix: allow opting-out of multi-cluster setups
2024-05-15 20:17:02 +01:00
Björn Rabenstein 806073ad63
Merge pull request #14091 from alexandear/enable-perfsprint-linter
Enable perfsprint linter and fix up code issues
2024-05-15 17:43:43 +02:00
Oleksandr Redko f10c3454e9 Enable perfsprint linter and fix up code
Signed-off-by: Oleksandr Redko <oleksandr.red+github@gmail.com>
2024-05-15 17:51:05 +03:00
Björn Rabenstein 179163a4c6
Merge pull request #14103 from krajorama/handle-context-cancel-in-postingsformatcher
tsdb/index/postings: fix missing lock unlock
2024-05-15 14:37:12 +02:00
György Krajcsovits b215a41be4 tsdb/index/postings: fix missing lock unlock
Followup to #14096

Unfortunately the previous PR introduced this bug by not releasing the
lock before returning.

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2024-05-15 14:02:39 +02:00
George Krajcsovits fdaafdb041
tsdb: check for context cancel before regex matching postings (#14096)
* tsdb: check for context cancel before regex matching postings

Regex matching can be heavy if the regex takes a lot of cycles to
evaluate and we can get stuck evaluating postings for a long time
without this fix. The constant checkContextEveryNIterations=100
may be changed later.

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2024-05-15 06:26:19 +02:00
Bryan Boreham 10eb23bd6b [TEST] Rules: Sleep 15ms to fit Windows behaviour better
On Windows, Go will sleep 15ms if you ask for less.  TestAsyncRuleEvaluation
compares actual delay to the nominal time, so using 15ms should work
better on Windows, and be hardly noticeable elsewhere.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2024-05-14 17:45:42 +01:00
Björn Rabenstein e6be4240be
Merge pull request #14068 from colega/quote-label-name-in-matchers-when-needed
Bugfix: quote label name in matchers when needed
2024-05-14 17:18:58 +02:00
Bryan Boreham dc926527ae
Merge pull request #13669 from aiwhj/optimization
[ENHANCEMENT] Relabeling: small speed-up of hashmod

Code optimization: The relabel operation is used very frequently, and strconv.FormatInt() with better performance should be used.
2024-05-14 12:54:00 +01:00
Bryan Boreham 67326d8e5c
Merge pull request #13758 from nemobis/federicol-remotewrite-tuning
[DOCS] Remote-Write: Clarify batch_send_deadline docs
2024-05-14 12:28:19 +01:00
Neeraj Gartia 661856cb65 removes the added tests from engine_test.go
Signed-off-by: Neeraj Gartia <neerajgartia211002@gmail.com>
2024-05-13 22:58:25 +05:30
Neeraj Gartia 6119124d0e some nits
Signed-off-by: Neeraj Gartia <neerajgartia211002@gmail.com>
2024-05-13 22:55:38 +05:30
Neeraj Gartia adf5a36c1e adds test for sum, count, stddev, stdvar, quantile and fraction func to promql testing framework
Signed-off-by: Neeraj Gartia <neerajgartia211002@gmail.com>
2024-05-13 22:55:38 +05:30
Neeraj Gartia 8b838a05d9 adds test for native histogram rate func in promql testing framework
Signed-off-by: Neeraj Gartia <neerajgartia211002@gmail.com>
2024-05-13 22:55:38 +05:30
Neeraj Gartia 548bd9d6fb adds TestNativeHistogramRate func to promql test framework
Signed-off-by: Neeraj Gartia <neerajgartia211002@gmail.com>
2024-05-13 22:55:38 +05:30
Oleg Zaytsev 8b4c9459a2
Check utf8.RuneError result
Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
2024-05-13 17:44:26 +02:00
Oleg Zaytsev dbe88fae22
Add invalid utf8 test cases to regexp
Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
2024-05-13 17:05:31 +02:00
Oleg Zaytsev bcff5059e6
Use utf8.DecodeRuneInString(s)
This replaces the custom `moreThanOneRune` function with the standard
`utf8.DecodeRuneInString(s)` that can be used to figure out the size of
the first rune.

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
2024-05-13 15:41:00 +02:00
Oleg Zaytsev fdfc6d4725
Benchmark zeroOrOneCharacterStringMatcher.Matches
This adds some more test cases for unicode values, and also a benchmark
for zeroOrOneCharacterStringMatcher.Matches()

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
2024-05-13 15:36:55 +02:00
Anthony Mirabella 3b8b57700c
otlp: Remove OTel feature gate registration from copied translation package (#13932)
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
Signed-off-by: Jesus Vazquez <jesusvzpg@gmail.com>
2024-05-10 10:41:21 +02:00
Bryan Boreham 3fd24d1cd7
Merge pull request #13999 from bboreham/extract-promqltest
[Test] Extract most PromQL test code into separate packages
2024-05-09 13:23:11 +01:00
Arve Knudsen 5c4310aa37
[ENHANCEMENT] TSDB: Optimize querying with regexp matchers
Add method `PostingsForLabelMatching` to `tsdb.IndexReader`, to obtain postings for labels with a certain name and values accepted by a provided callback, and use it from `tsdb.PostingsForMatchers`.
The intention is to optimize regexp matcher paths, especially not having to load all label values before matching on them.

Plus tests, and refactor some `tsdb/index.Reader` methods.

Benchmarking shows memory reduction up to ~100%, and speedup of up to ~50%.

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
2024-05-09 10:55:30 +01:00
Oleg Zaytsev b7b4355807
Use bytes.Buffer from stack buf in Matcher.String()
Also removed the growing until there's a benchmark for that.

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
2024-05-09 10:00:24 +02:00
Bryan Boreham 786e0e706c test: PromQL: stop using internal fields of engine
* set enablePerStepStats and lookback duration via
  `NewTestEngine` parameters.
* check maxSamples by recreating query engine
* check lookback without modifying internals

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2024-05-08 19:58:41 +01:00
Arve Knudsen d699dc3c77
Fix language in docs and comments (#14041)
Fix language in docs and comments

---------

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Co-authored-by: Björn Rabenstein <github@rabenste.in>
2024-05-08 17:57:09 +02:00
Bryan Boreham 0dbfd20b69 test: move most PromQL tests into separate test package
So that they can import promqltest which imports promql.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2024-05-08 16:28:56 +01:00
Bryan Boreham 4a72607c4a refactor: extract some PromQL Engine tests which use unexported structs
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2024-05-08 16:27:17 +01:00
Bryan Boreham 8fd96241ab test: add promqltest package references
To packages outside of promql.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2024-05-08 16:08:04 +01:00
Bryan Boreham e7c77f7b40 promql: export NewTestQuery
So that tests can call it from another package.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2024-05-08 16:08:04 +01:00
Bryan Boreham babfcfdd91 refactor: Move NewTestEngine into promqltest
And export `DefaultMaxSamplesPerQuery` so callers can replicate previous
behaviour.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2024-05-08 16:07:28 +01:00
Oleg Zaytsev 6ebda5a7bc
Optimize Matcher.String()
Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
2024-05-08 17:05:27 +02:00
Oleg Zaytsev dabd789fd5
Quote label name in matchers when needed
When the label name of a matcher contains non-standard characters, like
a dot, or starts with a digit, it should be quoted.

If it's not quoted, then `VectorSelector.String()` isn't a valid PromQL.

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
2024-05-08 16:58:51 +02:00
Arve Knudsen 0ba747187d
Merge pull request #14020 from aknuds1/arve/direct-otlp
prometheusremotewrite: Move TimeSeries method to timeseries.go
2024-05-08 15:03:57 +02:00