Skip to content

Commit

Permalink
feat(fdr-common): enable Alerts for FDR NDP (fase 1) (#2729)
Browse files Browse the repository at this point in the history
feat(fdr-common): enable low availability alert in production environment

                ✨ Set alerts_enabled to true to enable low availability alert in production.

                PAGOPA-2513

Co-authored-by: Pasquale Spica <[email protected]>
  • Loading branch information
jacopocarlini and pasqualespica authored Jan 21, 2025
1 parent 45299d4 commit 9d53baa
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 29 deletions.
37 changes: 37 additions & 0 deletions src/domains/fdr-app/00_alert_fdr_fase1.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,41 @@ resource "azurerm_monitor_scheduled_query_rules_alert" "alert-fdr-nodo-error" {
}
}

resource "azurerm_monitor_scheduled_query_rules_alert" "pagopa-fdr-nodo-rest-availability" {
count = var.env_short == "p" ? 1 : 0

resource_group_name = "dashboards"
name = "pagopa-${var.env_short}-pagopa-fdr-nodo-rest-availability"
location = var.location

action {
action_group = concat(local.action_groups_default, [data.azurerm_monitor_action_group.opsgenie[0].id])
email_subject = "Email Header"
custom_webhook_payload = "{}"
}

data_source_id = data.azurerm_api_management.apim.id
description = "Availability of pagopa-fdr-nodo REST APIs is less than or equal to 99%"
enabled = true
query = (<<-QUERY
let threshold = 0.99;
AzureDiagnostics
| where url_s matches regex "/fdr-legacy/"
| summarize
Total=count(),
Success=count(responseCode_d < 500)
by bin(TimeGenerated, 5m)
| extend availability=toreal(Success) / Total
| where availability < threshold
QUERY
)
severity = 1
frequency = 5
time_window = 5
trigger {
operator = "GreaterThanOrEqual"
threshold = 1
}
}


Loading

0 comments on commit 9d53baa

Please sign in to comment.