Alerting: Allow selection of recording rule write target on per-rule basis. (#101778)

* Alerting: Allow selection of recording rule write target on per-rule basis.

Introduces a new feature flag (`grafanaManagedRecordingRulesDatasources`),
disabled by default, to enable the ability to write recording rules data using
data source settings, and selecting the data source to use on a per-rule basis.

To cope with the scenario of users upgrading, a configuration file option
allows setting the default data source to use, if none is specified in the rule,
emulating the behaviour of recording rules without the flag enabled.

* Lint

* Update conf/sample.ini

Co-authored-by: Alexander Akhmetov <me@alx.cx>

---------

Co-authored-by: Alexander Akhmetov <me@alx.cx>
This commit is contained in:
Steve Simpson
2025-03-07 14:30:40 +01:00
committed by GitHub
co-authored by Alexander Akhmetov
parent 5917ed8227
commit 14ebec527c
9 changed files with 76 additions and 14 deletions
+9
View File
@@ -1790,6 +1790,15 @@ var (
Owner: grafanaAlertingSquad,
Expression: "true", // enabled by default
},
{
Name: "grafanaManagedRecordingRulesDatasources",
Description: "Enables writing to data sources for Grafana-managed recording rules.",
Stage: FeatureStageExperimental,
Owner: grafanaAlertingSquad,
AllowSelfServe: false,
HideFromAdminPage: true,
HideFromDocs: true,
},
}
)
+1
View File
@@ -237,3 +237,4 @@ newShareReportDrawer,experimental,@grafana/sharing-squad,false,false,false
rendererDisableAppPluginsPreload,experimental,@grafana/sharing-squad,false,false,true
assetSriChecks,experimental,@grafana/frontend-ops,false,false,true
alertRuleRestore,preview,@grafana/alerting-squad,false,false,false
grafanaManagedRecordingRulesDatasources,experimental,@grafana/alerting-squad,false,false,false
1 Name Stage Owner requiresDevMode RequiresRestart FrontendOnly
237 rendererDisableAppPluginsPreload experimental @grafana/sharing-squad false false true
238 assetSriChecks experimental @grafana/frontend-ops false false true
239 alertRuleRestore preview @grafana/alerting-squad false false false
240 grafanaManagedRecordingRulesDatasources experimental @grafana/alerting-squad false false false
+4
View File
@@ -958,4 +958,8 @@ const (
// FlagAlertRuleRestore
// Enables the alert rule restore feature
FlagAlertRuleRestore = "alertRuleRestore"
// FlagGrafanaManagedRecordingRulesDatasources
// Enables writing to data sources for Grafana-managed recording rules.
FlagGrafanaManagedRecordingRulesDatasources = "grafanaManagedRecordingRulesDatasources"
)
+14
View File
@@ -1964,6 +1964,20 @@
"hideFromDocs": true
}
},
{
"metadata": {
"name": "grafanaManagedRecordingRulesDatasources",
"resourceVersion": "1741291902441",
"creationTimestamp": "2025-03-06T20:11:42Z"
},
"spec": {
"description": "Enables writing to data sources for Grafana-managed recording rules.",
"stage": "experimental",
"codeowner": "@grafana/alerting-squad",
"hideFromAdminPage": true,
"hideFromDocs": true
}
},
{
"metadata": {
"name": "grafanaconThemes",