Skip to content

Commit 46620c6

Browse files
Alerting: Support conditional enrichments
1 parent 068c895 commit 46620c6

File tree

5 files changed

+827
-6
lines changed

5 files changed

+827
-6
lines changed

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ services:
3131
- GF_SERVER_ROOT_URL=${GRAFANA_URL}
3232
- GF_ENTERPRISE_LICENSE_TEXT=${GF_ENTERPRISE_LICENSE_TEXT:-}
3333
- GF_SERVER_SERVE_FROM_SUB_PATH=${GF_SERVER_SERVE_FROM_SUB_PATH:-}
34-
- GF_FEATURE_TOGGLES_ENABLE=nestedFolders,ssoSettingsApi,ssoSettingsSAML,ssoSettingsLDAP,grafanaManagedRecordingRulesDatasources,enableSCIM
34+
- GF_FEATURE_TOGGLES_ENABLE=nestedFolders,ssoSettingsApi,ssoSettingsSAML,ssoSettingsLDAP,grafanaManagedRecordingRulesDatasources,enableSCIM,alertEnrichmentMultiStep,alertEnrichmentConditional
3535
healthcheck:
3636
test: wget --no-verbose --tries=1 --spider http://0.0.0.0:3000/api/health || exit 1 # Use wget because older versions of Grafana don't have curl
3737
interval: 10s

examples/resources/grafana_apps_alertenrichment_alertenrichment_v1beta1/resource.tf

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,5 +106,46 @@ resource "grafana_apps_alertenrichment_alertenrichment_v1beta1" "enrichment" {
106106
step {
107107
assistant_investigations {}
108108
}
109+
110+
# Conditional step runs different actions based on alert severity
111+
step {
112+
conditional {
113+
# Condition: Check if severity is critical
114+
if {
115+
label_matchers = [{
116+
type = "="
117+
name = "severity"
118+
value = "critical"
119+
}]
120+
}
121+
122+
# Actions for critical alerts
123+
then {
124+
step {
125+
assign {
126+
annotations = {
127+
escalation_level = "immediate"
128+
}
129+
}
130+
}
131+
step {
132+
external {
133+
url = "https://irm.grafana.com/create-incident"
134+
}
135+
}
136+
}
137+
138+
# Actions for non-critical alerts
139+
else {
140+
step {
141+
assign {
142+
annotations = {
143+
escalation_level = "standard"
144+
}
145+
}
146+
}
147+
}
148+
}
149+
}
109150
}
110151
}

0 commit comments

Comments
 (0)