Alerting: Enable simplified routing FF by default (#84856)

This commit is contained in:
Matthew Jacobson 2024-03-22 13:45:20 -04:00 committed by GitHub
parent c57c033522
commit 980b9a62c6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 53 additions and 49 deletions

View File

@ -117,10 +117,6 @@ To do this, you need to make sure that your alert rule is in the right evaluatio
## Configure labels and notifications
{{< admonition type="note" >}}
This section is for all Cloud instances and OSS instances with the alertingSimplifiedRouting feature toggle enabled.
{{< /admonition >}}
In the **Labels** section, you can optionally choose whether to add labels to organize your alert rules, make searching easier, as well as set which notification policy should handle your firing alert instance.
In the **Configure notifications** section, you can choose to select a contact point directly from the alert rule form or choose to use notification policy routing as well as set up mute timings and groupings.
@ -160,30 +156,6 @@ Complete the following steps to set up labels and notifications.
6. Click **See details** to view alert routing details and an email preview.
## Configure notifications
{{< admonition type="note" >}}
This section is for OSS instances without the alertingSimplifiedRouting feature toggle enabled.
{{< /admonition >}}
1. Add labels to your alert rules to set which notification policy should handle your firing alert instances.
All alert rules and instances, irrespective of their labels, match the default notification policy. If there are no nested policies, or no nested policies match the labels in the alert rule or alert instance, then the default notification policy is the matching policy.
Add labels if you want to change the way your notifications are routed.
Add custom labels by selecting existing key-value pairs from the drop down, or add new labels by entering the new key or value.
2. Preview your alert instance routing set up.
Based on the labels added, alert instances are routed to the following notification policies displayed.
3. Expand each notification policy below to view more details.
4. Click **See details** to view alert routing details and an email preview.
5. Click **Save rule**.
## Add annotations
Add [annotations][annotation-label]. to provide more context on the alert in your alert notification message.

View File

@ -54,6 +54,7 @@ Some features are enabled by default. You can disable these feature by setting t
| `lokiStructuredMetadata` | Enables the loki data source to request structured metadata from the Loki server | Yes |
| `managedPluginsInstall` | Install managed plugins directly from plugins catalog | Yes |
| `annotationPermissionUpdate` | Change the way annotation permissions work by scoping them to folders and dashboards. | Yes |
| `alertingSimplifiedRouting` | Enables users to easily configure alert notifications by specifying a contact point directly when editing or creating an alert rule | Yes |
| `logRowsPopoverMenu` | Enable filtering menu displayed when text of a log line is selected | Yes |
| `lokiQueryHints` | Enables query hints for Loki | Yes |
| `enablePluginsTracingByDefault` | Enable plugin tracing for all external plugins | Yes |
@ -95,7 +96,6 @@ Some features are enabled by default. You can disable these feature by setting t
| `pdfTables` | Enables generating table data as PDF in reporting |
| `ssoSettingsApi` | Enables the SSO settings API and the OAuth configuration UIs in Grafana |
| `canvasPanelPanZoom` | Allow pan and zoom in canvas panel |
| `alertingSimplifiedRouting` | Enables users to easily configure alert notifications by specifying a contact point directly when editing or creating an alert rule |
| `regressionTransformation` | Enables regression analysis transformation |
| `groupToNestedTableTransformation` | Enables the group to nested table transformation |
| `newPDFRendering` | New implementation for the dashboard-to-PDF rendering |

View File

@ -989,9 +989,10 @@ var (
{
Name: "alertingSimplifiedRouting",
Description: "Enables users to easily configure alert notifications by specifying a contact point directly when editing or creating an alert rule",
Stage: FeatureStagePublicPreview,
Stage: FeatureStageGeneralAvailability,
FrontendOnly: false,
Owner: grafanaAlertingSquad,
Expression: "true", // enabled by default
},
{
Name: "logRowsPopoverMenu",

View File

@ -132,7 +132,7 @@ canvasPanelPanZoom,preview,@grafana/dataviz-squad,false,false,true
logsInfiniteScrolling,experimental,@grafana/observability-logs,false,false,true
flameGraphItemCollapsing,experimental,@grafana/observability-traces-and-profiling,false,false,true
datatrails,experimental,@grafana/dashboards-squad,false,false,true
alertingSimplifiedRouting,preview,@grafana/alerting-squad,false,false,false
alertingSimplifiedRouting,GA,@grafana/alerting-squad,false,false,false
logRowsPopoverMenu,GA,@grafana/observability-logs,false,false,true
pluginsSkipHostEnvVars,experimental,@grafana/plugins-platform-backend,false,false,false
tableSharedCrosshair,experimental,@grafana/dataviz-squad,false,false,true

1 Name Stage Owner requiresDevMode RequiresRestart FrontendOnly
132 logsInfiniteScrolling experimental @grafana/observability-logs false false true
133 flameGraphItemCollapsing experimental @grafana/observability-traces-and-profiling false false true
134 datatrails experimental @grafana/dashboards-squad false false true
135 alertingSimplifiedRouting preview GA @grafana/alerting-squad false false false
136 logRowsPopoverMenu GA @grafana/observability-logs false false true
137 pluginsSkipHostEnvVars experimental @grafana/plugins-platform-backend false false false
138 tableSharedCrosshair experimental @grafana/dataviz-squad false false true

View File

@ -1546,12 +1546,15 @@
{
"metadata": {
"name": "alertingSimplifiedRouting",
"resourceVersion": "1709648236447",
"creationTimestamp": "2024-03-05T14:17:16Z"
"resourceVersion": "1710956489717",
"creationTimestamp": "2024-03-05T14:17:16Z",
"annotations": {
"grafana.app/updatedTimestamp": "2024-03-20 17:41:29.717557527 +0000 UTC"
}
},
"spec": {
"description": "Enables users to easily configure alert notifications by specifying a contact point directly when editing or creating an alert rule",
"stage": "preview",
"stage": "GA",
"codeowner": "@grafana/alerting-squad"
}
},

View File

@ -145,13 +145,11 @@ func TestIntegrationAMConfigAccess(t *testing.T) {
})
t.Run("when retrieve alertmanager configuration", func(t *testing.T) {
cfgBody := `
cfgTemplate := `
{
"template_files": null,
"alertmanager_config": {
"route": {
"receiver": "grafana-default-email"
},
"route": %s,
"templates": null,
"receivers": [{
"name": "grafana-default-email",
@ -169,6 +167,22 @@ func TestIntegrationAMConfigAccess(t *testing.T) {
}
}
`
cfgWithoutAutogen := fmt.Sprintf(cfgTemplate, `{
"receiver": "grafana-default-email"
}`)
cfgWithAutogen := fmt.Sprintf(cfgTemplate, `{
"receiver": "grafana-default-email",
"routes": [{
"receiver": "grafana-default-email",
"object_matchers": [["__grafana_autogenerated__", "=", "true"]],
"routes": [{
"receiver": "grafana-default-email",
"group_by": ["grafana_folder", "alertname"],
"object_matchers": [["__grafana_receiver__", "=", "grafana-default-email"]]
}]
}]
}`)
testCases := []testCase{
{
desc: "un-authenticated request should fail",
@ -180,19 +194,19 @@ func TestIntegrationAMConfigAccess(t *testing.T) {
desc: "viewer request should succeed",
url: "http://viewer:viewer@%s/api/alertmanager/grafana/config/api/v1/alerts",
expStatus: http.StatusOK,
expBody: cfgBody,
expBody: cfgWithoutAutogen,
},
{
desc: "editor request should succeed",
url: "http://editor:editor@%s/api/alertmanager/grafana/config/api/v1/alerts",
expStatus: http.StatusOK,
expBody: cfgBody,
expBody: cfgWithoutAutogen,
},
{
desc: "admin request should succeed",
url: "http://admin:admin@%s/api/alertmanager/grafana/config/api/v1/alerts",
expStatus: http.StatusOK,
expBody: cfgBody,
expBody: cfgWithAutogen,
},
}
@ -2030,17 +2044,14 @@ func TestIntegrationAlertmanagerStatus(t *testing.T) {
expBody string
}
cfgBody := `
cfgTemplate := `
{
"cluster": {
"peers": [],
"status": "disabled"
},
"config": {
"route": {
"receiver": "grafana-default-email",
"group_by": ["grafana_folder", "alertname"]
},
"route": %s,
"templates": null,
"receivers": [{
"name": "grafana-default-email",
@ -2067,6 +2078,23 @@ func TestIntegrationAlertmanagerStatus(t *testing.T) {
}
}
`
cfgWithoutAutogen := fmt.Sprintf(cfgTemplate, `{
"receiver": "grafana-default-email",
"group_by": ["grafana_folder", "alertname"]
}`)
cfgWithAutogen := fmt.Sprintf(cfgTemplate, `{
"receiver": "grafana-default-email",
"routes": [{
"receiver": "grafana-default-email",
"object_matchers": [["__grafana_autogenerated__", "=", "true"]],
"routes": [{
"receiver": "grafana-default-email",
"group_by": ["grafana_folder", "alertname"],
"object_matchers": [["__grafana_receiver__", "=", "grafana-default-email"]]
}]
}],
"group_by": ["grafana_folder", "alertname"]
}`)
testCases := []testCase{
{
@ -2079,19 +2107,19 @@ func TestIntegrationAlertmanagerStatus(t *testing.T) {
desc: "viewer request should succeed",
url: "http://viewer:viewer@%s/api/alertmanager/grafana/api/v2/status",
expStatus: http.StatusOK,
expBody: cfgBody,
expBody: cfgWithoutAutogen,
},
{
desc: "editor request should succeed",
url: "http://editor:editor@%s/api/alertmanager/grafana/api/v2/status",
expStatus: http.StatusOK,
expBody: cfgBody,
expBody: cfgWithoutAutogen,
},
{
desc: "admin request should succeed",
url: "http://admin:admin@%s/api/alertmanager/grafana/api/v2/status",
expStatus: http.StatusOK,
expBody: cfgBody,
expBody: cfgWithAutogen,
},
}