mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Docs: Update Grafana-Managed Recording Rule docs (#94895)
* Config ini section * Extend header * Drop hysteresis line which doesnt apply to recording rules * Touch up evaluation behavior section * Dissolve incorrect/unrelated section * Update docs/sources/alerting/alerting-rules/create-mimir-loki-managed-recording-rule.md Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com> * Update docs/sources/alerting/alerting-rules/create-mimir-loki-managed-recording-rule.md Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com> * Update docs/sources/alerting/alerting-rules/create-mimir-loki-managed-recording-rule.md Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com> * Update docs/sources/alerting/alerting-rules/create-mimir-loki-managed-recording-rule.md Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com> * Update docs/sources/alerting/alerting-rules/create-mimir-loki-managed-recording-rule.md Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com> * Update docs/sources/alerting/alerting-rules/create-mimir-loki-managed-recording-rule.md Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com> * Run linter --------- Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>
This commit is contained in:
parent
5fe5e8a5a6
commit
be0d8b4f19
@ -33,14 +33,10 @@ refs:
|
||||
|
||||
Recording rules calculate frequently needed expressions or computationally expensive expressions in advance and save the result as a new set of time series. Querying this new time series is faster, especially for dashboards since they query the same expression every time the dashboards refresh.
|
||||
|
||||
Grafana-managed recording rules offer the same Prometheus-like semantics, but allow you to query any Grafana data source supported by alerting. In addition to the above, you can use this to import and map data from other data sources into Prometheus.
|
||||
|
||||
For more information on recording rules in Prometheus, refer to [Defining recording rules in Prometheus](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/).
|
||||
|
||||
Recording rules are run as instant rules, which means that they run every 10s. To overwrite this configuration, update the min_interval in your custom configuration file.
|
||||
|
||||
[min_interval](ref:configure-grafana) sets the minimum interval to enforce between rule evaluations. The default value is 10s which equals the scheduler interval. Rules will be adjusted if they are less than this value or if they are not multiple of the scheduler interval (10s). Higher values can help with resource management as fewer evaluations are scheduled over time.
|
||||
|
||||
This setting has precedence over each individual rule frequency. If a rule frequency is lower than this value, then this value is enforced.
|
||||
|
||||
## Configure data source-managed recording rules
|
||||
|
||||
Configure data source-managed recording rules.
|
||||
@ -67,7 +63,7 @@ The recording rule name must be a Prometheus metric name and contain no whitespa
|
||||
|
||||
#### Define recording rule
|
||||
|
||||
Select your data source and enter a query.
|
||||
Select your data source and enter a query. The queries used in data source-managed recording rules always run as instant queries.
|
||||
|
||||
#### Add namespace and group
|
||||
|
||||
@ -100,6 +96,23 @@ For more information on enabling feature toggles, refer to [Configure feature to
|
||||
|
||||
- Enable the `grafanaManagedRecordingRules` [feature flag](https://grafana.com/docs/grafana/<GRAFANA_VERSION>/setup-grafana/configure-grafana/feature-toggles/).
|
||||
|
||||
Grafana does not contain an embedded time-series database. You must bring your own Prometheus-compatible database to store series generated by Grafana-managed recording rules.
|
||||
|
||||
First, enable the feature by setting `enabled = true` in the `[recording_rules]` section of the Grafana config .ini. Then, provide the URL of your Prometheus-compatible remote-write endpoint in the `url` field, along with optional credentials or headers.
|
||||
|
||||
```
|
||||
[recording_rules]
|
||||
enabled = true
|
||||
url = http://my-example-prometheus.local:9090/api/prom/push
|
||||
basic_auth_username = my-user
|
||||
basic_auth_password = my-pass
|
||||
|
||||
[recording_rules.custom_headers]
|
||||
X-My-Header = MyValue
|
||||
```
|
||||
|
||||
You must provide a URL if `enabled` is set to `true`.
|
||||
|
||||
To configure Grafana-managed recording rules, complete the following steps.
|
||||
|
||||
1. Click **Alerts & IRM** -> **Alerting** ->
|
||||
@ -139,24 +152,20 @@ It does not support absolute time ranges: `2021-12-02 00:00:00 to 2021-12-05 23:
|
||||
|
||||
b. Click **Preview** to verify that the expression is successful.
|
||||
|
||||
3. To add a recovery threshold, turn the **Custom recovery threshold** toggle on and fill in a value for when your recording rule should stop meeting the condition.
|
||||
|
||||
You can only add one recovery threshold in a query and it must be the recording rule output.
|
||||
|
||||
4. Click **Set as recording rule output** on the query or expression you want to set as your rule output.
|
||||
3. Click **Set as recording rule output** on the query or expression you want to set as your rule output.
|
||||
|
||||
#### Set evaluation behavior
|
||||
|
||||
Use recording rule evaluation to determine how frequently a recording rule should be evaluated and how quickly it should change its state.
|
||||
Use recording rule evaluation to determine how frequently a recording rule should be evaluated.
|
||||
|
||||
To do this, you need to make sure that your recording rule is in the right evaluation group and set a pending period time that works best for your use case.
|
||||
To do this, you need to make sure that your recording rule is in the right evaluation group with an interval that works best for your use case.
|
||||
|
||||
1. Select a folder or click **+ New folder**.
|
||||
1. Select an evaluation group or click **+ New evaluation group**.
|
||||
|
||||
If you are creating a new evaluation group, specify the interval for the group.
|
||||
|
||||
All rules within the same group are evaluated concurrently over the same time interval.
|
||||
All rules within the same group are evaluated concurrently over the same time interval. Every recording rule in a group uses the same evaluation time, meaning that all queries from the same group are always aligned with each other.
|
||||
|
||||
1. Turn on pause recording rule evaluation, if required.
|
||||
|
||||
@ -169,3 +178,11 @@ To do this, you need to make sure that your recording rule is in the right evalu
|
||||
1. Add custom labels selecting existing key-value pairs from the drop down, or add new labels by entering the new key or value.
|
||||
|
||||
1. Click **Save rule** to save the rule or **Save rule and exit** to save the rule and go back to the Alerting page.
|
||||
|
||||
#### Advanced Configuration
|
||||
|
||||
[min_interval](ref:configure-grafana) sets the minimum interval to enforce between rule evaluations. The default value is 10s which equals the scheduler interval. Rules are adjusted if they are less than this value or if they are not multiple of the scheduler interval (10s). Higher values can help with resource management as fewer evaluations are scheduled over time.
|
||||
|
||||
This setting has precedence over each individual rule frequency. If a rule frequency is lower than this value, then this value is enforced.
|
||||
|
||||
This setting applies to both Grafana-managed alert and recording rules.
|
||||
|
Loading…
Reference in New Issue
Block a user