prometheus/util
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
..
annotations Add warnings (and annotations) to PromQL query results (#12152) 2023-09-14 18:57:31 +02:00
documentcli promtool docs: write flags between backtits in help 2023-07-15 22:32:59 +02:00
fmtutil fix: apply suggested changes 2023-06-27 09:30:39 +02:00
gate Move packages out of deprecated pkg directory 2021-11-09 08:03:10 +01:00
httputil Revert "Improving Performance on the API Gzip Handler (#12363)" 2023-06-20 13:39:32 +02:00
jsonutil Name float values as "floats", not as "values" 2023-04-13 19:25:24 +02:00
logging lint: Adjust to the lint warnings raised by current versions of golint-ci 2023-04-19 17:10:10 +02:00
osutil Format Go source files using 'gofumpt -w -s -extra' 2021-11-02 19:52:34 +01:00
pool Move packages out of deprecated pkg directory 2021-11-09 08:03:10 +01:00
runtime Merge pull request #12231 from Loongson-Cloud-Community/main 2023-05-28 15:12:34 +02:00
stats Replace sort.Sort with faster slices.SortFunc 2023-07-10 09:43:45 +00:00
strutil Implement SanitizeLabelName and Full variant 2023-02-03 15:28:33 +00:00
teststorage Add a feature flag to control native histogram ingestion (#11253) 2022-09-14 17:38:34 +05:30
testutil lint: Adjust to the lint warnings raised by current versions of golint-ci 2023-04-19 17:10:10 +02:00
treecache style: Replace `else if` cascades with `switch` 2023-04-19 17:22:31 +02:00
zeropool Use zeropool.Pool to workaround SA6002 (#12189) 2023-03-29 20:34:34 +01:00