Commit graph

1368 commits

Author SHA1 Message Date
Callum Styan eb63f30459 fix minor things
Signed-off-by: Callum Styan <callumstyan@gmail.com>
2023-11-09 10:35:43 -03:00
Callum Styan 3e5facc0c0 add functionality for new minimized remote write request format
Signed-off-by: Callum Styan <callumstyan@gmail.com>
2023-11-09 10:35:43 -03:00
Callum Styan 82c1df0aa1 add functions for translating between new proto formats symbol table and
actual prometheus labels

Co-authored-by: Marco Pracucci <marco@pracucci.com>
Signed-off-by: Callum Styan <callumstyan@gmail.com>
2023-11-09 10:35:43 -03:00
Nicolás Pazos 46b84ab3fb lint 2023-11-09 10:18:12 -03:00
Nicolás Pazos cef9891cdd remote write handler to checks version header 2023-11-09 10:18:12 -03:00
Nicolás Pazos e3f27aa2c7 fields rewording in handler 2023-11-09 10:18:12 -03:00
Nicolás Pazos 6f21272ca7 fix NewWriteClient and change new flags wording 2023-11-09 10:18:12 -03:00
alexgreenbank 1cddea1501 gofmt 2023-11-09 10:18:12 -03:00
alexgreenbank 8ab14f2456 Remove config, update proto 2023-11-09 10:18:12 -03:00
alexgreenbank 15c4d45635 Add 1.1 version handling code 2023-11-09 10:18:12 -03:00
Nicolás Pazos 06b486b41e cleanup: remove hardcoded fake url for testing 2023-11-09 10:18:12 -03:00
Nicolás Pazos 44f166d066 Use github.com/golang/snappy 2023-11-09 10:18:12 -03:00
Nicolás Pazos c1593fd35a Improve sender benchmarks and some allocations 2023-11-09 10:18:12 -03:00
Nicolás Pazos b35ab6c080 fix build 2023-11-09 10:18:12 -03:00
Nicolás Pazos 2f815ee3dd refactor queue manager code to remove some duplication 2023-11-09 10:18:12 -03:00
Nicolás Pazos 3be59f0ca6 add sender-side tests and fix failing ones 2023-11-09 10:18:12 -03:00
Nicolás Pazos eebf7ac1fc fix: queue manager to include float histograms in new requests 2023-11-09 10:18:12 -03:00
Nicolás Pazos 17aa5b5557 refactor out common code between write methods 2023-11-09 10:18:12 -03:00
Nicolás Pazos 111bf0fcaf add basic reduce remote write handler benchmark 2023-11-09 10:18:12 -03:00
Nicolás Pazos 0dc96d6221 fix mocks and fixture 2023-11-09 10:18:12 -03:00
Nicolás Pazos ed34405d68 remove some comented code 2023-11-09 10:18:12 -03:00
Nicolás Pazos fff56c0df7 no-brainer copypaste but more performance write support 2023-11-09 10:18:12 -03:00
Nicolás Pazos 337f9ae7ae add new proto support on receiver end 2023-11-09 10:18:12 -03:00
Nicolás Pazos f65eb1c8d9 tests and new -> original proto mapping util 2023-11-09 10:18:12 -03:00
Callum Styan 867cc97d2f Add new test client
Signed-off-by: Callum Styan <callumstyan@gmail.com>
2023-11-09 10:18:12 -03:00
Callum Styan f1992591b2 Implement code paths for new proto format
Signed-off-by: Callum Styan <callumstyan@gmail.com>
2023-11-09 10:18:12 -03:00
Callum Styan 4910a33d78 add lookup table struct that is used to build the symbol table in new
write request format

Signed-off-by: Callum Styan <callumstyan@gmail.com>
2023-11-09 10:18:12 -03:00
Callum Styan 36a30c9cd9 add decode function for new write request proto
Signed-off-by: Callum Styan <callumstyan@gmail.com>
2023-11-09 10:18:12 -03:00
Callum Styan 7a862d265f replace snappy encoding library
Signed-off-by: Callum Styan <callumstyan@gmail.com>
2023-11-09 10:18:12 -03:00
Levi Harrison dcaca86958
Update dependencies for 2.48 (#12964) 2023-10-15 10:53:59 -04:00
Bryan Boreham a5a4eab679
Storage: reduce memory allocations when merging series sets (#12938)
Instead of setting to nil and allocating a new slice every time the
merge is advanced, re-use the previous slice.
This is safe because the `currentSets` member is only used inside member
functions, and explicitly copied in `At()`, the only place it leaves the
struct.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2023-10-06 12:28:07 +01:00
rakshith210 cdad64002a
Added Azure OAuth support (#12572)
* Added Azure OAuth support

Signed-off-by: rakshith210 <rakshith.me@gmail.com>

* Added missing comment

Signed-off-by: rakshith210 <rakshith.me@gmail.com>

* Addressing comment

Signed-off-by: rakshith210 <rakshith.me@gmail.com>

* Fixed lint issue

Signed-off-by: rakshith210 <rakshith.me@gmail.com>

* Fix test

Signed-off-by: rakshith210 <rakshith.me@gmail.com>

* Addressing comments

Signed-off-by: rakshith210 <rakshith.me@gmail.com>

* Added documentation and updated unit tests

Signed-off-by: rakshith210 <rakshith.me@gmail.com>

* Addressing comments

Signed-off-by: rakshith210 <rakshith.me@gmail.com>

---------

Signed-off-by: rakshith210 <rakshith.me@gmail.com>
2023-10-04 22:16:36 -04:00
Goutham Veeramachaneni 86729d4d7b
Update exp package (#12650) 2023-09-21 22:53:51 +02:00
Björn Rabenstein ade2ee3fe4
Merge pull request #12716 from bboreham/simplify-seek
storage: simplify Seek on BufferedSeriesIterator
2023-09-21 13:56:29 +02:00
William Dumont ce6ad15422 remote-write: TestClientRetryAfter status code 500
and compare the retryAfter values.

Signed-off-by: William Dumont <william.dumont@grafana.com>
2023-09-20 10:25:43 +00:00
William Dumont febd62a23e remote-write: refactor TestClientRetryAfter
The new version features a set of test cases that simplify the addition
of new HTTP status codes.

Signed-off-by: William Dumont <william.dumont@grafana.com>
2023-09-20 10:24:52 +00:00
Bryan Boreham 9b85354acd remote-write: respect Retry-After header on 5xx errors
If the server sent it to us, we should assume it knows better than we
do and respect it.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2023-09-20 10:14:38 +00:00
Paschalis Tsilias c173cd57c9
Add a header to count retried remote write requests (#12729)
Header name is `Retry-Attempt`, only set when >0.

Signed-off-by: Marc Tuduri <marctc@protonmail.com>
Signed-off-by: Paschalis Tsilias <paschalis.tsilias@grafana.com>
2023-09-20 11:11:03 +01:00
George Krajcsovits 3512b2d678
storage: make histogram reset handling consistent in chainSampleIterator (#12779)
storage: make histogram reset handling consistent in chainSampleIterator

---------

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2023-09-19 17:06:46 +02:00
zenador 69edd8709b
Add warnings (and annotations) to PromQL query results (#12152)
Return annotations (warnings and infos) from PromQL queries

This generalizes the warnings we have already used before (but only for problems with remote read) as "annotations".

Annotations can be warnings or infos (the latter could be false positives). We do not treat them different in the API for now and return them all as "warnings". It would be easy to distinguish them and return infos separately, should that appear useful in the future.

The new annotations are then used to create a lot of warnings or infos during PromQL evaluations. Partially these are things we have wanted for a long time (e.g. inform the user that they have applied `rate` to a metric that doesn't look like a counter), but the new native histograms have created even more needs for those annotations (e.g. if a query tries to aggregate float numbers with histograms).

The annotations added here are not yet complete. A prominent example would be a warning about a range too short for a rate calculation. But such a warnings is more tricky to create with good fidelity and we will tackle it later.

Another TODO is to take annotations into account when evaluating recording rules.

---------

Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
2023-09-14 18:57:31 +02:00
Arve Knudsen 156222cc50
Add context argument to LabelQuerier.LabelValues (#12665)
Add context argument to LabelQuerier.LabelValues and
LabelQuerier.SortedLabelValues.

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2023-09-14 16:02:04 +02:00
Arve Knudsen a964349e97
Add context argument to LabelQuerier.LabelNames (#12666)
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2023-09-14 10:39:51 +02:00
beorn7 0521ec12af storage: remove obsolete TODO
This was solved one layer deeper with #11687.

Signed-off-by: beorn7 <beorn@grafana.com>
2023-09-13 15:10:22 +02:00
Arve Knudsen 6daee89e5f
Add context argument to Querier.Select (#12660)
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2023-09-12 12:37:38 +02:00
Gregor Zeitlinger f01718262a
Unit tests for native histograms (#12668)
promql: Extend testing framework to support native histograms

This includes both the internal testing framework as well as the rules unit test feature of promtool.

This also adds a bunch of basic tests. Many of the code level tests can now be converted to tests within the framework, and more tests can be added easily.

---------

Signed-off-by: Harold Dost <h.dost@criteo.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Stephen Lang <stephen.lang@grafana.com>
Co-authored-by: Harold Dost <h.dost@criteo.com>
Co-authored-by: Stephen Lang <stephen.lang@grafana.com>
Co-authored-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
2023-08-25 23:35:42 +02:00
Justin Lei 8ef7dfdeeb
Add a chunk size limit in bytes (#12054)
Add a chunk size limit in bytes

This creates a hard cap for XOR chunks of 1024 bytes.

The limit for histogram chunk is also 1024 bytes, but it is a soft limit as a histogram has a dynamic size, and even a single one could be larger than 1024 bytes.

This also avoids cutting new histogram chunks if the existing chunk has fewer than 10 histograms yet. In that way, we are accepting "jumbo chunks" in order to have at least 10 histograms in a chunk, allowing compression to kick in.

Signed-off-by: Justin Lei <justin.lei@grafana.com>
2023-08-24 15:21:17 +02:00
beorn7 aa82fe198f tsdb: Fix histogram validation
So far, `ValidateHistogram` would not detect if the count did not
include the count in the zero bucket. This commit fixes the problem
and updates all the tests that have been undetected offenders so far.

Note that this problem would only ever create false negatives, so we
never falsely rejected to store a histogram because of it.

On the other hand, `ValidateFloatHistogram` has been to strict with
the count being at least as large as the sum of the counts in all the
buckets. Float precision issues could create false positives here, see
products of PromQL evaluations, it's actually quite hard to put an
upper limit no the floating point imprecision. Users could produce the
weirdest expressions, maxing out float precision problems. Therefore,
this commit simply removes that particular check from
`ValidateFloatHistogram`.

Signed-off-by: beorn7 <beorn@grafana.com>
2023-08-22 23:04:01 +02:00
Michael Hoffmann 4d8e380269
promql: allow tests to be imported (#12050)
Signed-off-by: Michael Hoffmann <mhoffm@posteo.de>
2023-08-18 20:48:59 +02:00
Bryan Boreham a018a7ef53 storage: simplify Seek on BufferedSeriesIterator
Small tweak to call a simpler method

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2023-08-17 07:42:18 +01:00
Bryan Boreham d2ae8dc3cb remote-write: add http.resend_count tracing attribute
As recommended by the OpenTelemetry semantic conventions.

https://opentelemetry.io/docs/specs/otel/trace/semantic_conventions/http/#http-client
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2023-08-11 16:20:12 +00:00