* web/api: optimize labelnames/values with 1 set of matchers
If there is exactly one set of matchers provided, we can skip adding
the results to a map and getting them back out again.
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
---------
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
With this commit we make it possible to adjust the request headers sent
to Prometheus by the codemirror-promql extension. This enables
customizing the headers sent, without re-implementing the Prometheus
client completely.
Signed-off-by: Jacob Baungard Hansen <jacobbaungard@redhat.com>
* Show group interval in Rules display
Signed-off-by: Danny Kopping <danny.kopping@grafana.com>
* Humanise interval
Signed-off-by: Danny Kopping <danny.kopping@grafana.com>
---------
Signed-off-by: Danny Kopping <danny.kopping@grafana.com>
Add unit tests for Web API's query endpoint (GET/POST).
Also modify the endpoint handler to use context.WithDeadline instead of
context.WithTimeout, so the deadline is deterministic for the tests.
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
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>
* Move /targets page discovered labels to expandable section
The current tooltip for showing the pre-relabeling discovered labels for a
target is notoriously unreliable and can get cut off when there are many
labels. This PR introduces a (hopefully unobtuse enough) expander/collapser
button for the discovered labels of each target, and then the discovered labels
are shown in a more persistent way underneath the final target labels, instead
of using a tooltip.
Fixes https://github.com/prometheus/prometheus/issues/9175#issuecomment-1713074341
Signed-off-by: Julius Volz <julius.volz@gmail.com>
* Remove obsolete test snapshot
Signed-off-by: Julius Volz <julius.volz@gmail.com>
---------
Signed-off-by: Julius Volz <julius.volz@gmail.com>
This commit adds the option --include-workspace-root in ui_release.sh
npm scripts in order to also include the version in web/ui/pagkage jsons
files when bumping the version. This also avoids issues when building
directly with npm install on some systems.
Signed-off-by: Daniel Mellado <dmellado@redhat.com>