Browse Source

Documentation: Update example expressions to follow convention. (#7195)

Based out of conversation on #7193

Signed-off-by: Harold Dost <h.dost@criteo.com>
pull/7198/head
Harold Dost 5 years ago committed by GitHub
parent
commit
18d45e564b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      docs/configuration/recording_rules.md
  2. 5
      docs/migration.md
  3. 2
      docs/querying/api.md
  4. 4
      docs/querying/functions.md

2
docs/configuration/recording_rules.md

@ -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>`

5
docs/migration.md

@ -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

2
docs/querying/api.md

@ -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"
}
],

4
docs/querying/functions.md

@ -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…
Cancel
Save