Skip to content

Commit

Permalink
Adding api-response time alert (#1557)
Browse files Browse the repository at this point in the history
* Adding api-response time alert

* Adding count ternary

* Fixing metric_namespace

* Adjusting namespace again

* Fixing scope
  • Loading branch information
jcrichlake authored Nov 6, 2024
1 parent d70bd0b commit d87edbf
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions operations/template/alert.tf
Original file line number Diff line number Diff line change
Expand Up @@ -515,3 +515,45 @@ resource "azurerm_monitor_scheduled_query_rules_alert" "ti-log-errors-alert" {
]
}
}

resource "azurerm_monitor_metric_alert" "api-response-time-alert" {
count = local.non_pr_environment ? 1 : 0
name = "cdcti-${var.environment}-api-response-time-alert"
resource_group_name = data.azurerm_resource_group.group.name
scopes = [azurerm_linux_web_app.api.id]
description = "Alerts when the average API response time across the service plan is high"
severity = 2
frequency = "PT1M"
window_size = "PT15M"

criteria {
metric_name = "HttpResponseTime"
metric_namespace = "microsoft.Web/sites"
aggregation = "Average"
operator = "GreaterThan"
threshold = 5 # Value is in seconds
}

action {
action_group_id = azurerm_monitor_action_group.notify_slack_email[count.index].id
}

lifecycle {
# Ignore changes to tags because the CDC sets these automagically
ignore_changes = [
tags["business_steward"],
tags["center"],
tags["environment"],
tags["escid"],
tags["funding_source"],
tags["pii_data"],
tags["security_compliance"],
tags["security_steward"],
tags["support_group"],
tags["system"],
tags["technical_steward"],
tags["zone"]
]
}

}

0 comments on commit d87edbf

Please sign in to comment.