Skip to content

Commit

Permalink
Merge pull request #15722 from CDCgov/josiahsiegel/update/ignore-caug…
Browse files Browse the repository at this point in the history
…ht-exceptions

update exception alerts to exclude dependencies
  • Loading branch information
JosiahSiegel committed Aug 30, 2024
2 parents eee3ae9 + 5b37652 commit 4358a18
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,83 +4,98 @@
# Severity 3 - Informational
# Severity 4 - Verbose

resource "azurerm_monitor_metric_alert" "exception_alert_critical" {
resource "azurerm_monitor_scheduled_query_rules_alert" "exception_alert_critical" {
count = local.alerting_enabled
name = "Over 100 Exceptions Raised in the Last Hour"
description = "Over 100 Exceptions Raised in the Last Hour"
location = var.location
resource_group_name = var.resource_group
scopes = [azurerm_application_insights.app_insights.id]
window_size = "PT1H"
frequency = "PT1M"
severity = 0

criteria {
metric_namespace = "microsoft.insights/components"
metric_name = "exceptions/count"
aggregation = "Count"
operator = "GreaterThan"
threshold = 99
}

action {
action_group_id = azurerm_monitor_action_group.action_group[0].id
action_group = [azurerm_monitor_action_group.action_group[0].id]
}
data_source_id = azurerm_application_insights.app_insights.id
enabled = true
query = <<-EOT
let requests = requests
| distinct id;
let pageViews = pageViews
| distinct id;
let trace = union requests, pageViews;
exceptions
| join kind=inner trace on $left.operation_ParentId == $right.id
EOT
throttling = 120
severity = 0
frequency = 15
time_window = 60

tags = {
environment = var.environment
trigger {
operator = "GreaterThanOrEqual"
threshold = 100
}
}

resource "azurerm_monitor_metric_alert" "exception_alert_error" {
resource "azurerm_monitor_scheduled_query_rules_alert" "exception_alert_error" {
count = local.alerting_enabled
name = "Over 10 Exceptions Raised in the Last Hour"
description = "Over 10 Exceptions Raised in the Last Hour"
location = var.location
resource_group_name = var.resource_group
scopes = [azurerm_application_insights.app_insights.id]
window_size = "PT1H"
frequency = "PT1M"
severity = 1

criteria {
metric_namespace = "microsoft.insights/components"
metric_name = "exceptions/count"
aggregation = "Count"
operator = "GreaterThan"
threshold = 9
}

action {
action_group_id = azurerm_monitor_action_group.action_group[0].id
action_group = [azurerm_monitor_action_group.action_group[0].id]
}
data_source_id = azurerm_application_insights.app_insights.id
enabled = true
query = <<-EOT
let requests = requests
| distinct id;
let pageViews = pageViews
| distinct id;
let trace = union requests, pageViews;
exceptions
| join kind=inner trace on $left.operation_ParentId == $right.id
EOT
throttling = 120
severity = 2
frequency = 15
time_window = 60

tags = {
environment = var.environment
trigger {
operator = "GreaterThanOrEqual"
threshold = 10
}
}

resource "azurerm_monitor_metric_alert" "exception_alert_warn" {
count = local.prod_exclusive_alerting
resource "azurerm_monitor_scheduled_query_rules_alert" "exception_alert_warn" {
count = local.alerting_enabled
name = "One or More Exceptions Raised in the Last Hour"
description = "One or More Exceptions Raised in the Last Hour"
location = var.location
resource_group_name = var.resource_group
scopes = [azurerm_application_insights.app_insights.id]
window_size = "PT30M"
frequency = "PT5M"
severity = 3

criteria {
metric_namespace = "microsoft.insights/components"
metric_name = "exceptions/count"
aggregation = "Count"
operator = "GreaterThan"
threshold = 0
}

action {
action_group_id = azurerm_monitor_action_group.action_group[0].id
action_group = [azurerm_monitor_action_group.action_group[0].id]
}
data_source_id = azurerm_application_insights.app_insights.id
enabled = true
query = <<-EOT
let requests = requests
| distinct id;
let pageViews = pageViews
| distinct id;
let trace = union requests, pageViews;
exceptions
| join kind=inner trace on $left.operation_ParentId == $right.id
EOT
throttling = 120
severity = 3
frequency = 15
time_window = 60

tags = {
environment = var.environment
trigger {
operator = "GreaterThanOrEqual"
threshold = 1
}
}
6 changes: 4 additions & 2 deletions operations/app/terraform/modules/metabase/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ resource "azurerm_linux_web_app" "metabase" {
site_config {

application_stack {
docker_image_name = "metabase/metabase:latest"
docker_registry_url = "https://index.docker.io"
docker_image_name = "metabase/metabase:v0.50.7"
docker_registry_url = "https://index.docker.io/v1"
}

ip_restriction {
Expand Down Expand Up @@ -122,6 +122,8 @@ resource "azurerm_linux_web_app" "metabase" {
# If the virtual network is set via the resource app_service_virtual_network_swift_connection
# then ignore_changes should be used in the web app configuration.
virtual_network_subnet_id,
# Ignore auto-generated hidden-links
tags
]
}
}
Expand Down

0 comments on commit 4358a18

Please sign in to comment.