mirror of
https://github.com/prometheus/prometheus
synced 2025-01-12 01:29:43 +00:00
Documentation: Update example expressions to follow convention. (#7195)
Based out of conversation on #7193 Signed-off-by: Harold Dost <h.dost@criteo.com>
This commit is contained in:
parent
5b4006ac86
commit
18d45e564b
@ -62,7 +62,7 @@ groups:
|
||||
- name: example
|
||||
rules:
|
||||
- record: job:http_inprogress_requests:sum
|
||||
expr: sum(http_inprogress_requests) by (job)
|
||||
expr: sum by (job) (http_inprogress_requests)
|
||||
```
|
||||
|
||||
### `<rule_group>`
|
||||
|
@ -88,7 +88,7 @@ An example of a recording rule and alert in the old format:
|
||||
|
||||
```
|
||||
job:request_duration_seconds:histogram_quantile99 =
|
||||
histogram_quantile(0.99, sum(rate(request_duration_seconds_bucket[1m])) by (le, job))
|
||||
histogram_quantile(0.99, sum by (le, job) (rate(request_duration_seconds_bucket[1m])))
|
||||
|
||||
ALERT FrontendRequestLatency
|
||||
IF job:request_duration_seconds:histogram_quantile99{job="frontend"} > 0.1
|
||||
@ -105,8 +105,7 @@ groups:
|
||||
- name: example.rules
|
||||
rules:
|
||||
- record: job:request_duration_seconds:histogram_quantile99
|
||||
expr: histogram_quantile(0.99, sum(rate(request_duration_seconds_bucket[1m]))
|
||||
BY (le, job))
|
||||
expr: histogram_quantile(0.99, sum by (le, job) (rate(request_duration_seconds_bucket[1m])))
|
||||
- alert: FrontendRequestLatency
|
||||
expr: job:request_duration_seconds:histogram_quantile99{job="frontend"} > 0.1
|
||||
for: 5m
|
||||
|
@ -523,7 +523,7 @@ $ curl http://localhost:9090/api/v1/rules
|
||||
{
|
||||
"health": "ok",
|
||||
"name": "job:http_inprogress_requests:sum",
|
||||
"query": "sum(http_inprogress_requests) by (job)",
|
||||
"query": "sum by (job) (http_inprogress_requests)",
|
||||
"type": "recording"
|
||||
}
|
||||
],
|
||||
|
@ -166,11 +166,11 @@ around the `rate()` function. Since the `le` label is required by
|
||||
`histogram_quantile()`, it has to be included in the `by` clause. The following
|
||||
expression aggregates the 90th percentile by `job`:
|
||||
|
||||
histogram_quantile(0.9, sum(rate(http_request_duration_seconds_bucket[10m])) by (job, le))
|
||||
histogram_quantile(0.9, sum by (job, le) (rate(http_request_duration_seconds_bucket[10m])))
|
||||
|
||||
To aggregate everything, specify only the `le` label:
|
||||
|
||||
histogram_quantile(0.9, sum(rate(http_request_duration_seconds_bucket[10m])) by (le))
|
||||
histogram_quantile(0.9, sum by (le) (rate(http_request_duration_seconds_bucket[10m])))
|
||||
|
||||
The `histogram_quantile()` function interpolates quantile values by
|
||||
assuming a linear distribution within a bucket. The highest bucket
|
||||
|
Loading…
Reference in New Issue
Block a user