Skip to content

Commit

Permalink
[#IOPID-1925] Alert Profile poison (#1134)
Browse files Browse the repository at this point in the history
  • Loading branch information
BurnedMarshal authored Aug 30, 2024
1 parent c8c901e commit 17af2fd
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/domains/elt/_modules/function_apps/function_app_elt.tf
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ locals {
MESSAGE_STATUS_FAILURE_QUEUE_NAME = "pdnd-io-cosmosdb-message-status-failure"
SERVICES_FAILURE_QUEUE_NAME = "pdnd-io-cosmosdb-services-failure"
SERVICE_PREFERENCES_FAILURE_QUEUE_NAME = local.service_preferences_failure_queue_name
PROFILES_FAILURE_QUEUE_NAME = "pdnd-io-cosmosdb-profiles-failure"
PROFILES_FAILURE_QUEUE_NAME = local.profiles_failure_queue_name

INTERNAL_TEST_FISCAL_CODES = module.tests.test_users.all
}
Expand Down Expand Up @@ -168,8 +168,8 @@ module "function_elt" {
"${local.function_elt.app_settings.SERVICES_FAILURE_QUEUE_NAME}-poison",
local.service_preferences_failure_queue_name,
"${local.service_preferences_failure_queue_name}-poison",
local.function_elt.app_settings.PROFILES_FAILURE_QUEUE_NAME,
"${local.function_elt.app_settings.PROFILES_FAILURE_QUEUE_NAME}-poison"
local.profiles_failure_queue_name,
"${local.profiles_failure_queue_name}-poison"
],
"containers" = [],
"blobs_retention_days" = 1,
Expand Down
1 change: 1 addition & 0 deletions src/domains/elt/_modules/function_apps/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ locals {
pn_service_id = "01G40DWQGKY5GRWSNM4303VNRP"

service_preferences_failure_queue_name = "pdnd-io-cosmosdb-service-preferences-failure"
profiles_failure_queue_name = "pdnd-io-cosmosdb-profiles-failure"
}
34 changes: 34 additions & 0 deletions src/domains/elt/_modules/function_apps/monitor.tf
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,39 @@ resource "azurerm_monitor_scheduled_query_rules_alert_v2" "service_preferences_f
]
}

tags = var.tags
}

resource "azurerm_monitor_scheduled_query_rules_alert_v2" "profiles_failure_alert_rule" {
enabled = true
name = "[CITIZEN-AUTH | iopfneltsdt] Failures on pdnd-io-cosmosdb-profiles-failure-poison"
resource_group_name = var.resource_group_name
location = var.location

scopes = [data.azurerm_storage_account.function_elt_internal_storage.id]
description = "Permanent failures processing Profiles export to PDND. REQUIRED MANUAL ACTION"
severity = 1
auto_mitigation_enabled = false

window_duration = "PT15M" # Select the interval that's used to group the data points by using the aggregation type function. Choose an Aggregation granularity (period) that's greater than the Frequency of evaluation to reduce the likelihood of missing the first evaluation period of an added time series.
evaluation_frequency = "PT15M" # Select how often the alert rule is to be run. Select a frequency that's smaller than the aggregation granularity to generate a sliding window for the evaluation.

criteria {
query = <<-QUERY
StorageQueueLogs
| where OperationName contains "PutMessage"
| where Uri contains "${local.profiles_failure_queue_name}-poison"
QUERY
operator = "GreaterThan"
threshold = 0
time_aggregation_method = "Count"
}

action {
action_groups = [
data.azurerm_monitor_action_group.quarantine_error_action_group.id,
]
}

tags = var.tags
}

0 comments on commit 17af2fd

Please sign in to comment.