Skip to content
Merged
Show file tree
Hide file tree
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
62 changes: 31 additions & 31 deletions infrastructure/modules/container-apps/alerts.tf
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
resource "azurerm_monitor_scheduled_query_rules_alert_v2" "five_hundred_error_alert" {
count = var.enable_alerting ? 1 : 0
# resource "azurerm_monitor_scheduled_query_rules_alert_v2" "five_hundred_error_alert" {
# count = var.enable_alerting ? 1 : 0

auto_mitigation_enabled = false
description = "An alert triggered by 500 errors logged in code"
enabled = var.enable_alerting
evaluation_frequency = "PT5M"
location = var.region
name = "${var.app_short_name}-500-error-alert"
resource_group_name = azurerm_resource_group.main.name
scopes = [var.action_group_id]
severity = 2
skip_query_validation = false
window_duration = "PT5M"
workspace_alerts_storage_enabled = false
# auto_mitigation_enabled = false
# description = "An alert triggered by 500 errors logged in code"
# enabled = var.enable_alerting
# evaluation_frequency = "PT5M"
# location = var.region
# name = "${var.app_short_name}-500-error-alert"
# resource_group_name = azurerm_resource_group.main.name
# scopes = [var.action_group_id]
# severity = 2
# skip_query_validation = false
# window_duration = "PT5M"
# workspace_alerts_storage_enabled = false

action {
action_groups = [var.action_group_id]
}
# action {
# action_groups = [var.action_group_id]
# }

criteria {
operator = "GreaterThan"
query = <<-QUERY
ContainerAppConsoleLogs_CL
| where Log contains "[ERROR]"
QUERY
threshold = 0
time_aggregation_method = "Count"
# criteria {
# operator = "GreaterThan"
# query = <<-QUERY
# ContainerAppConsoleLogs_CL
# | where Log contains "[ERROR]"
# QUERY
# threshold = 0
# time_aggregation_method = "Count"

failing_periods {
minimum_failing_periods_to_trigger_alert = 1
number_of_evaluation_periods = 1
}
}
}
# failing_periods {
# minimum_failing_periods_to_trigger_alert = 1
# number_of_evaluation_periods = 1
# }
# }
# }
3 changes: 3 additions & 0 deletions infrastructure/modules/container-apps/jobs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
}

module "scheduled_jobs" {
# TODO: This should be on a scheduled job bases and NOT for the entire module

Check warning on line 43 in infrastructure/modules/container-apps/jobs.tf

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Complete the task associated to this "TODO" comment.

See more on https://sonarcloud.io/project/issues?id=NHSDigital_lung_cancer_screening&issues=AZ3fBQOxA8il3_qwkno9&open=AZ3fBQOxA8il3_qwkno9&pullRequest=454
count = var.enable_alerting ? 1 : 0

source = "../dtos-devops-templates/infrastructure/modules/container-app-job"

for_each = local.scheduled_jobs
Expand Down
Loading