alerting: omit optional notification settings fields (#112049)

This commit is contained in:
Tito Lins
2025-10-06 14:23:21 +02:00
committed by GitHub
parent 548e739d75
commit 7e63a01a79
6 changed files with 192 additions and 15 deletions
@@ -0,0 +1,45 @@
resource "grafana_rule_group" "rule_group_2b12784d0e1454cd" {
org_id = 1
name = "group_simplified_routing"
folder_uid = "e4584834-1a87-4dff-8913-8a4748dfca79"
interval_seconds = 10
rule {
name = "test"
condition = "C"
data {
ref_id = "A"
relative_time_range {
from = 600
to = 0
}
datasource_uid = "grafanacloud-prom"
model = "{\"editorMode\":\"code\",\"expr\":\"vector(1)\",\"instant\":true,\"intervalMs\":1000,\"legendFormat\":\"__auto\",\"maxDataPoints\":43200,\"range\":false,\"refId\":\"A\"}"
}
data {
ref_id = "C"
relative_time_range {
from = 0
to = 0
}
datasource_uid = "__expr__"
model = "{\"conditions\":[{\"evaluator\":{\"params\":[1],\"type\":\"gt\"},\"operator\":{\"type\":\"and\"},\"query\":{\"params\":[\"C\"]},\"reducer\":{\"params\":[],\"type\":\"last\"},\"type\":\"query\"}],\"datasource\":{\"type\":\"__expr__\",\"uid\":\"__expr__\"},\"expression\":\"A\",\"intervalMs\":1000,\"maxDataPoints\":43200,\"refId\":\"C\",\"type\":\"threshold\"}"
}
no_data_state = "NoData"
exec_err_state = "Error"
for = "1m"
annotations = {}
labels = {}
is_paused = false
notification_settings {
contact_point = "email"
}
}
}
@@ -0,0 +1,94 @@
{
"name": "group_simplified_routing",
"interval": "10s",
"rules": [
{
"grafana_alert": {
"title": "test",
"condition": "C",
"data": [
{
"refId": "A",
"queryType": "",
"relativeTimeRange": {
"from": 600,
"to": 0
},
"datasourceUid": "grafanacloud-prom",
"model": {
"editorMode": "code",
"expr": "vector(1)",
"instant": true,
"intervalMs": 1000,
"legendFormat": "__auto",
"maxDataPoints": 43200,
"range": false,
"refId": "A"
}
},
{
"refId": "C",
"queryType": "",
"relativeTimeRange": {
"from": 0,
"to": 0
},
"datasourceUid": "__expr__",
"model": {
"conditions": [
{
"evaluator": {
"params": [
1
],
"type": "gt"
},
"operator": {
"type": "and"
},
"query": {
"params": [
"C"
]
},
"reducer": {
"params": [],
"type": "last"
},
"type": "query"
}
],
"datasource": {
"type": "__expr__",
"uid": "__expr__"
},
"expression": "A",
"intervalMs": 1000,
"maxDataPoints": 43200,
"refId": "C",
"type": "threshold"
}
}
],
"is_paused": false,
"no_data_state": "NoData",
"exec_err_state": "Error",
"notification_settings": {
"receiver": "email"
},
"metadata": {
"editor_settings": {
"simplified_query_and_expressions_section": false,
"simplified_notifications_section": true
}
},
"missing_series_evals_to_resolve": 0,
"uid": "alert-with-simplified-routing"
},
"annotations": {},
"labels": {},
"for": "1m",
"keep_firing_for": "0s"
}
]
}