Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding api-response time alert #1557

Merged
merged 5 commits into from
Nov 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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" {
jcrichlake marked this conversation as resolved.
Show resolved Hide resolved
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
jcrichlake marked this conversation as resolved.
Show resolved Hide resolved
frequency = "PT1M"
window_size = "PT15M"

criteria {
metric_name = "HttpResponseTime"
metric_namespace = "microsoft.Web/sites"
aggregation = "Average"
operator = "GreaterThan"
threshold = 5 # Value is in seconds
jcrichlake marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kinda curious on why 5 seconds? If it's a good reason, adding a comment could be useful for future selves

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a number I just picked. It's slightly on the high side but we had some iffy latency spikes in the last week well above that number. We can potentially tweak this value later.

}

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"]
]
}

}