File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed
infrastructure/modules/container-apps Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ resource "azurerm_monitor_scheduled_query_rules_alert_v2" "failure_event" {
2+ count = var. enable_alerting ? 1 : 0
3+
4+ auto_mitigation_enabled = false
5+ description = " An alert triggered by a custom event batch_marked_as_failed logged in code"
6+ enabled = var. enable_alerting
7+ evaluation_frequency = " PT5M"
8+ location = var. region
9+ name = " ${ var . app_short_name } -batch-failed-alert"
10+ resource_group_name = azurerm_resource_group. main . name
11+ scopes = [var . app_insights_id ]
12+ severity = 2
13+ skip_query_validation = false
14+ target_resource_types = [" microsoft.insights/components" ]
15+ window_duration = " PT5M"
16+ workspace_alerts_storage_enabled = false
17+
18+ action {
19+ action_groups = [var . action_group_id ]
20+ }
21+
22+ criteria {
23+ operator = " GreaterThan"
24+ query = <<- QUERY
25+ customEvents
26+ | where name == "batch_marked_as_failed"
27+ | project timestamp, name
28+ | project-rename TimeGenerated=timestamp
29+ QUERY
30+ threshold = 0
31+ time_aggregation_method = " Count"
32+
33+ failing_periods {
34+ minimum_failing_periods_to_trigger_alert = 1
35+ number_of_evaluation_periods = 1
36+ }
37+ }
38+ }
You can’t perform that action at this time.
0 commit comments