Alerting: Enable recording rules by default (#105603)
This commit is contained in:
+6
-19
@@ -63,31 +63,18 @@ To configure Grafana-managed recording rules, complete the following steps.
|
||||
|
||||
This section only applies to Grafana OSS and Grafana Enterprise.
|
||||
|
||||
Enable the feature by setting `enabled = true` in the `[recording_rules]` section of the Grafana configuration file. Provide the URL of your Prometheus-compatible remote-write endpoint in the `url` field, along with optional credentials or headers.
|
||||
If a rule does not explicitly specify a target data source for writing (for example, if it was created before Grafana 12.1), Grafana will fall back to the `default_datasource_uid` set in the configuration:
|
||||
|
||||
```
|
||||
[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
|
||||
```
|
||||
|
||||
### Per-rule data source
|
||||
|
||||
To choose the remote-write Prometheus data source individually for each recording rule, also enable the `grafanaManagedRecordingRulesDatasources` feature flag.
|
||||
|
||||
When this flag is on, Grafana does not use the `url` defined in the configuration file, and the rule editor shows a dropdown to select the target data source. If a rule does not specify a target, for example it was created before the flag was enabled, Grafana writes to the data source identified by `default_datasource_uid` in the Grafana configuration:
|
||||
|
||||
```
|
||||
[recording_rules]
|
||||
|
||||
default_datasource_uid = my-uid
|
||||
```
|
||||
|
||||
If you previously configured recording rules using the `url` and `basic_auth_*` configuration options, these are no longer supported. You must either:
|
||||
|
||||
- Set `default_datasource_uid` in the `[recording_rules]` section of the configuration file to point to the target data source
|
||||
- Or, before upgrading to Grafana 12.1, enable the `grafanaManagedRecordingRulesDatasources` feature flag and update each recording rule individually to include a target data source
|
||||
|
||||
## Add new recording rule
|
||||
|
||||
To create a new Grafana-managed recording rule:
|
||||
|
||||
Reference in New Issue
Block a user