Commit Graph

272 Commits

Author SHA1 Message Date
Julius Volz
2e709c6567
Merge pull request #16695 from sujalshah-bit/block_endpoint
api: Create `/status/tsdb/blocks` endpoint.
2025-07-31 18:15:49 +02:00
Julien
fe67b30e9e
Merge pull request #16731 from roidelapluie/rename-master-main
docs: Direct link to remote read proto to the main branch
2025-07-28 16:34:55 +02:00
Charles Korn
8397b738bf
docs: clarify docs for PromQL aggregation operators (#16837)
Signed-off-by: Charles Korn <charles.korn@grafana.com>
2025-07-10 15:34:57 +02:00
sujal shah
4408a6bcaf api: Create /status/tsdb/blocks endpoint.
this endpoint serves blocks data to the client.

Signed-off-by: sujal shah <sujalshah28092004@gmail.com>
2025-07-04 03:13:54 +05:30
Julius Volz
bfbae39931
Merge pull request #16716 from charleskorn/charleskorn/binops-docs
docs: clarify and expand binary operations documentation
2025-07-02 10:02:17 +02:00
Charles Korn
d19a9ab673
Remove other instances of "obvious"
Signed-off-by: Charles Korn <charles.korn@grafana.com>
2025-07-01 20:13:46 +10:00
Charles Korn
1977452331
Address PR feedback: adjust docs to match current behaviour
Signed-off-by: Charles Korn <charles.korn@grafana.com>
2025-07-01 20:10:20 +10:00
Charles Korn
665eb3d6cb
Address PR feedback: remove use of "obvious"
Signed-off-by: Charles Korn <charles.korn@grafana.com>
2025-07-01 20:08:18 +10:00
Charles Korn
70df21a680
Address PR feedback: format Inf and NaN as monospace
Signed-off-by: Charles Korn <charles.korn@grafana.com>
2025-07-01 20:07:07 +10:00
Charles Korn
9c6916f4f9
Address PR feedback: add blank lines before lists
Signed-off-by: Charles Korn <charles.korn@grafana.com>
2025-07-01 20:06:15 +10:00
George Krajcsovits
5b7ff92d95
fix(promql): histogram_quantile and histogram_fraction NaN observed in native histogram (#16724)
* fix(promql): histogram_quantile NaN observed in native histogram

Fixes: #16578

See the issue for detailed explanation.
When a histogram had only NaN observations and no normal observations,
we returned 0 from the quantile, which is completely wrong. If there were
normal observations but we went over them, we returned the upper bound of
the existing buckets, however that contradicts expectations on
histogram_fraction. Now we return NaN if the quantile is calculated to be
over all normal observations, falling into NaNs (in a virtual +Inf bucket).

We also return info level annotations if we see any NaN observations.
The annotation calls out if we returned NaN or even if we took the
virtual +Inf bucket into account.

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>

* fix(promql): histogram_fraction NaN observed in native histogram

Fixes: #16580

According to the specification we should not take NaN observations
into account when calculating the fraction. This commit fixes that
and adds an info level annotation to let the user know about this.

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2025-06-25 13:37:43 +02:00
Julien Pivotto
c07950e5e9 docs: remote read: Mention buf.build
Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
2025-06-20 16:25:55 +02:00
Julien Pivotto
0fb698675c docs: Direct link to remote read proto to the main branch
Left over of the master->main branch rename.

Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
2025-06-16 11:47:58 +02:00
Michael Hoffmann
a5fa9431d8 promql: add ts_of_(max,min,last)_over_time functions
This commit adds the ts_of_(max,min,last)_over_time functions behind the experimental feature flag.

Signed-off-by: Michael Hoffmann <mhoffmann@cloudflare.com>
2025-06-12 15:03:28 +00:00
Charles Korn
5926159f2a
Clarify expected behaviour of on(__name__)
See https://github.com/prometheus/prometheus/issues/16631

Signed-off-by: Charles Korn <charles.korn@grafana.com>
2025-06-11 13:38:06 +10:00
Charles Korn
0c6ef1b23c
Clarify behaviour of bool modifier
Signed-off-by: Charles Korn <charles.korn@grafana.com>
2025-06-11 13:38:05 +10:00
Charles Korn
40bed6281e
Clarify behaviour of metric names with bool modifier
Based on discussion in https://github.com/prometheus/prometheus/issues/15471

Signed-off-by: Charles Korn <charles.korn@grafana.com>
2025-06-11 13:38:02 +10:00
Charles Korn
1e794f7ef9
Break large paragraphs into smaller pieces
Signed-off-by: Charles Korn <charles.korn@grafana.com>
2025-06-11 13:21:10 +10:00
Julius Volz
13564c03ef Standardize doc page title handling
See https://groups.google.com/g/prometheus-developers/c/cwL3cM66Em8

Signed-off-by: Julius Volz <julius.volz@gmail.com>
2025-05-28 21:37:27 +02:00
marcoderama
778d49bbfb
docs: fix typo in operators.md
Signed-off-by: marcoderama <marcoderamagit@gmail.com>
2025-05-16 12:03:24 -07:00
Julius Volz
1b818b03d5 Clean up codeboxes and headings in docs
The new docs site will have syntax highlighting, so this adds language tags
to code boxes that are currently missing them. I didn't add `promql` as a
language yet since the highlighter doesn't support it yet, plus a lot of
the PromQL codeboxes in our docs aren't strictly valid PromQL, they are
more like multiple expressions listed in the same code box on multiple
lines. So I'm leaving that for sometime later.

In the HTTP API page, I moved the curl examples from the JSON codeboxes to
their own ones above the JSON output. I considered putting an "Output:"
text between the curl + JSON output, but I think the way it currently looks
without it is probably fine.

I also fixed a number of headings which were at the wrong level relative to
their nesting in the document.

I also removed `go` as a language from the Go template language examples,
because the Go template language isn't Go at all.

I also adjusted the indent on one codebox to be more reasonable (2 spaces
instead of 8).

And then finally, my editor made a bunch of whitespace changes
automatically, like removing trailing spaces.

Signed-off-by: Julius Volz <julius.volz@gmail.com>

Signed-off-by: Julius Volz <julius.volz@gmail.com>
2025-05-13 15:38:29 +02:00
Aman
26bddcf068
promql: histogram_stddev and histogram_stdvar should use arithmetic mean for custom buckets
Signed-off-by: amanycodes <amanycodes@gmail.com>
2025-04-24 14:48:58 +02:00
Michael Hoffmann
d6d9f97bac
promql: histogram_fraction for bucket histograms (#16095)
* promql: histogram_fraction for bucket histograms

This PR extends the histogram_fraction function to also work with classic bucket histograms. This is beneficial because it allows expressions like sum(increase(my_bucket{le="0.5"}[10m]))/sum(increase(my_total[10m])) to be written without knowing the actual values of the "le" label, easing the transition to native histograms later on.
It also feels natural since histogram_quantile also can deal with classic histograms.

Signed-off-by: Michael Hoffmann <mhoffmann@cloudflare.com>

* promql: histogram_fraction for bucket histograms

* Add documentation and reduce code duplication
* Fix a bug in linear interpolation between bucket boundaries
* Add more PromQL tests

Signed-off-by: Michael Hoffmann <mhoffmann@cloudflare.com>

* Update docs/querying/functions.md

Co-authored-by: Björn Rabenstein <github@rabenste.in>
Signed-off-by: Michael Hoffmann <mhoffm@posteo.de>

---------

Signed-off-by: Michael Hoffmann <mhoffmann@cloudflare.com>
Signed-off-by: Michael Hoffmann <mhoffm@posteo.de>
Co-authored-by: Björn Rabenstein <github@rabenste.in>
2025-04-23 00:28:31 +02:00
co63oc
0e4e5a71bd
Fix typos (#16076)
Signed-off-by: co63oc <co63oc@users.noreply.github.com>
2025-02-28 11:24:25 +11:00
Julius Volz
4be2243f06 Include scrape pool name for dropped targets in /api/v1/targets
This is needed so we can display dropped targets in the right scrape pool
in the web interface even if they have a non-default job name.

See also https://github.com/prometheus/prometheus/pull/16078

Fixes https://github.com/prometheus/prometheus/issues/16065

Signed-off-by: Julius Volz <julius.volz@gmail.com>
2025-02-27 15:17:22 +01:00
Charles Korn
2cfd402b3a
Clarify sorting behaviour of topk and bottomk.
Signed-off-by: Charles Korn <charles.korn@grafana.com>
2025-02-11 14:55:39 +11:00
Charles Korn
acd74b02fb
Fix typo
Signed-off-by: Charles Korn <charles.korn@grafana.com>
2025-02-11 14:46:03 +11:00
Björn Rabenstein
585a219622
Merge pull request #15845 from prometheus/beorn7/doc
docs: Update PromQL documentation to match the native histogram spec
2025-02-08 00:24:29 +01:00
beorn7
993d4e71c9 docs: Update PromQL documentation to match the native histogram spec
This is also meant to document the actual implementation, but
see #13934 for the current state.

This also improves and streamlines some parts of the documentation
that are not strictly native histogram related, but are colocated with
them. In particular, the section about aggregation operators got
restructured quite a bit, including the removal of a quite verbose
example for `limit_ratio` (which was just too long an this location
and also a bit questionabl in its usefulness).

Signed-off-by: beorn7 <beorn@grafana.com>
2025-02-07 22:47:59 +01:00
asymmetric
96f31e370b
doc: clarify rate values are averaged (#14045)
* doc: clarify `rate` values are averaged

Signed-off-by: asymmetric <101816+asymmetric@users.noreply.github.com>
Co-authored-by: Björn Rabenstein <github@rabenste.in>
2025-02-04 11:34:59 +00:00
sh0rez
5303e515af
remote/otlp: convert delta to cumulative (#15165)
What

Adds support for OTLP delta temporality to the OTLP endpoint.
This is done by calling the deltatocumulative processor from the OpenTelemetry collector during OTLP conversion.

Why

Delta conversion is a naturally stateful process, which requires careful request routing when operated inside a collector.
Prometheus is already stateful and doing the conversion in-server reduces the operational burden on the ingest architecture by only having one stateful component.

How

deltatocumulative is a OTel collector component that works as follows:

* pmetric.Metrics come from a receiver or in this case from the HTTP client
* It operates as an in-place update loop:
    * for each sample, if not delta, leave unmodified
    * if delta, do:
      * state += sample, where state is the in-memory sum of all previous samples
      * sample = state, sample value is now cumulative
    * this is supported for sums (counters), gauges, histograms (old histograms) and exponential histograms (native histograms)
If a series receives no new samples for 5m, its state is removed from memory


Performance

Delta performance is a stateful operation and the OTel code is not highly optimized yet, e.g. it locks the entire processor for each request. Nonetheless, care has been taken to mitigate those effects:

delta conversion is behind a feature flag. If disabled, no conversion code is ever invoked
if enabled, conversion is not invoked if request not actually contains delta samples. This leads to no measureable performance difference between default-cumulative to convert-cumulative (only cumulative, feature on/off)

Signed-off-by: sh0rez <me@shorez.de>
2025-01-14 11:33:31 -03:00
Vandit Singh
6339989e25
web/api: Add a limit parameter to /query and /query_range (#15552)
add limit param to query and rangeQuery

---------

Signed-off-by: Vandit Singh <vanditsinghkv@gmail.com>
Signed-off-by: Vandit Singh <107131545+Vandit1604@users.noreply.github.com>
Co-authored-by: Björn Rabenstein <github@rabenste.in>
2025-01-09 17:27:39 +01:00
sujal shah
73a3438c1b api: Add two new fields Node and ServerTime.
This commit introduced two field in `/status` endpoint:
- The node currently serving the request.
- The current server time for debugging time drift issues.

fixes #15394.

Signed-off-by: sujal shah <sujalshah28092004@gmail.com>
2025-01-07 16:05:50 +05:30
TJ Hoplock
aa8e067f13 Merge release-3.0 into main 2024-11-27 17:51:51 -05:00
Owen Williams
12577e3851 Add support for values unescaping on /v1/label/:name/values endpoint
Signed-off-by: Owen Williams <owen.williams@grafana.com>
2024-11-27 14:03:03 -05:00
Kateryna Pavlova
d6e43b89f4 docs: add regex section in querying basics
Signed-off-by: Kateryna Pavlova <kathrinett@gmail.com>
2024-11-24 22:03:04 +01:00
Kateryna Pavlova
bc008f1b0e docs: fix range queries link
Signed-off-by: Kateryna Pavlova <kathrinett@gmail.com>
2024-11-24 22:02:01 +01:00
Jan Fajerski
284135a905
Merge pull request #15223 from jan--f/release-3.0.0-rc.0
Prepare release 3.0.0 rc.0
2024-10-31 20:33:37 +01:00
Jan Fajerski
38fd48e6b5 v2.55.0
-----BEGIN SSH SIGNATURE-----
 U1NIU0lHAAAAAQAAADMAAAALc3NoLWVkMjU1MTkAAAAgX42TrpDUXJbbi9yZ3hs6cDg+kz
 G6d3nAlAb2XQInrEgAAAADZ2l0AAAAAAAAAAZzaGE1MTIAAABTAAAAC3NzaC1lZDI1NTE5
 AAAAQGoSEKIFT/BfavtG2qW9n7NYonNQk/9r6gCLvxln9elt1hiY0ZGcwRhm1QNx6FotxJ
 Y3LB9dt4s5akB3fOPkYwc=
 -----END SSH SIGNATURE-----

Merge tag 'v2.55.0' into release-3.0.0-rc.0

v2.55.0
2024-10-25 14:16:22 +02:00
Jonathan Ballet
7ca90e5729 doc: fix formatting
Signed-off-by: Jonathan Ballet <jon@multani.info>
2024-10-24 08:55:23 +02:00
Yijie Qin
d2802c6fac
api: Add rule group pagination to list rules api (#14017)
* Add paginated feature to list rules api

Signed-off-by: Yijie Qin <qinyijie@amazon.com>

* Refactor to simplify code:

* Reduce number of variables
* Reduce type convesion

Signed-off-by: Raphael Silva <rapphil@gmail.com>

* Simplify paginated implementation

* Remove maxAlerts parameter.
* Reuse existing API responses by using omitempty in some fields

Signed-off-by: Raphael Silva <rapphil@gmail.com>

* Simplify pagination implementation

* Eliminate the need to sort the rule groups.

Signed-off-by: Raphael Silva <rapphil@gmail.com>

* Fix linting error

Signed-off-by: Raphael Silva <rapphil@gmail.com>

* Add more unit tests

Signed-off-by: Raphael Silva <rapphil@gmail.com>

* Update pagination parameters to be consistent with existing parameters

Signed-off-by: Raphael Silva <rapphil@gmail.com>

* Rename max_rule_groups to max_groups

Signed-off-by: Raphael Silva <rapphil@gmail.com>

* Refactor to simplify code

Signed-off-by: Raphael Silva <rapphil@gmail.com>

* Refactor to simplify the calculation of next token

Signed-off-by: Raphael Silva <rapphil@gmail.com>

* Handle corner case in pagination request

Signed-off-by: Raphael Silva <rapphil@gmail.com>

* Handle corner cases for pagination of list rules

Signed-off-by: Raphael Silva <rapphil@gmail.com>

* Update documentation for list rules parameters

Signed-off-by: Raphael Silva <rapphil@gmail.com>

* Refactor comments

Signed-off-by: Raphael Silva <rapphil@gmail.com>

* Simplify pagination implementation

* Eliminate need for extra structs to store pagination parameters

Signed-off-by: Raphael Silva <rapphil@gmail.com>

* Update docs/querying/api.md

Co-authored-by: Julius Volz <julius.volz@gmail.com>
Signed-off-by: Raphael Philipe Mendes da Silva <rapphil@gmail.com>

* Update web/api/v1/api.go

Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: Raphael Philipe Mendes da Silva <rapphil@gmail.com>

* Update comment describing the need for next token

Signed-off-by: Raphael Silva <rapphil@gmail.com>

---------

Signed-off-by: Yijie Qin <qinyijie@amazon.com>
Signed-off-by: Raphael Silva <rapphil@gmail.com>
Signed-off-by: Raphael Philipe Mendes da Silva <rapphil@gmail.com>
Co-authored-by: Raphael Silva <rapphil@gmail.com>
Co-authored-by: Julius Volz <julius.volz@gmail.com>
Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
2024-10-22 00:04:40 +01:00
Arve Knudsen
de16f5e387
[FEATURE] PromQL: Add experimental info function MVP (#14495)
The `info` function is an experiment to improve UX
around including labels from info metrics.
`info` has to be enabled via the feature flag `--enable-feature=promql-experimental-functions`.

This MVP of info simplifies the implementation by assuming:
* Only support for the target_info metric
* That target_info's identifying labels are job and instance

Also:
* Encode info samples' original timestamp as sample value
* Deduce info series select hints from top-most VectorSelector

---------

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Co-authored-by: Ying WANG <ying.wang@grafana.com>
Co-authored-by: Augustin Husson <augustin.husson@amadeus.com>
Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Co-authored-by: Björn Rabenstein <github@rabenste.in>
Co-authored-by: Bryan Boreham <bjboreham@gmail.com>
2024-10-16 13:52:11 +01:00
Björn Rabenstein
5e987e7c7d
Merge pull request #15092 from jan--f/clarify-storage-contract
storage: require selectors to always return matching results
2024-10-09 13:07:59 +02:00
Julius Volz
90f7832447
Merge pull request #15084 from hvnsweeting/patch-1
docs: Querying basics: remove what can be graphed
2024-10-08 14:59:07 +02:00
Viet Hung Nguyen
f0a9f62ce8 [DOCS] Querying basics: what can be graphed
Put a scalar to query, it can be graphed.

So the doc says "an expression that returns an instant vector is the only type which can be graphed." is not correct?

And also, a query_range, which used for graph, always return a range vector <https://promlabs.com/blog/2020/06/18/the-anatomy-of-a-promql-query/#range-queries> , so it's confusing to read the above statement.

Signed-off-by: Viet Hung Nguyen <hvn@familug.org>
2024-10-08 21:16:26 +09:00
Björn Rabenstein
576000a457
Merge pull request #15111 from prometheus/beorn7/doc
docs: Declare "float literals are time durations" as stable
2024-10-08 12:49:40 +02:00
beorn7
08d4b034da docs: Declare "float literals are time durations" as stable
This unifies the documentation of float literals and time durations
and updates all references to the old definitions.

Signed-off-by: beorn7 <beorn@grafana.com>
2024-10-07 14:22:49 +02:00
Julien
db730fcade Document the notifications API
Signed-off-by: Julien <roidelapluie@o11y.eu>
2024-10-07 14:18:54 +02:00
Jan Fajerski
563bfdd384 storage: require selectors to always return matching results
Signed-off-by: Jan Fajerski <jfajersk@redhat.com>
2024-10-04 12:10:16 +02:00
Jesus Vazquez
77d3b3aff3
OTLP: Remove experimental word form OTLP receiver (#14894)
The OTLP receiver can now considered stable. We've had it for longer
than a year in main and has received constant improvements.

Signed-off-by: Jesus Vazquez <jesusvzpg@gmail.com>
2024-10-01 14:36:52 +02:00