Skip to content

Commit

Permalink
fix: 00_alert_gpd_ingestion.tf (#2694)
Browse files Browse the repository at this point in the history
* fix: 00_alert_gpd_ingestion.tf

* fix: 00_alert_gpd_ingestion.tf

* fix

---------

Co-authored-by: pasqualespica <[email protected]>
  • Loading branch information
alessio-cialini and pasqualespica authored Dec 24, 2024
1 parent f373758 commit 7ce5991
Showing 1 changed file with 21 additions and 20 deletions.
41 changes: 21 additions & 20 deletions src/domains/gps-app/00_alert_gpd_ingestion.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ locals {

fn_name_for_alerts_exceptions = var.env_short != "p" ? [] : [
{
id : "paymentoptionprocessor"
name : "PaymentOptionProcessor"
id : "cdc-raw-auto.apd.payment_option"
name : "cdc-raw-auto.apd.payment_option"
},
{
id : "paymentpositionprocessor"
name : "PaymentPositionProcessor"
id : "cdc-raw-auto.apd.payment_position"
name : "cdc-raw-auto.apd.payment_position"
},
{
id : "transferprocessor"
name : "TransferProcessor"
id : "cdc-raw-auto.apd.transfer"
name : "cdc-raw-auto.apd.transfer"
}
]

Expand Down Expand Up @@ -41,7 +41,7 @@ resource "azurerm_monitor_scheduled_query_rules_alert" "gpd-ingestion-manager-av
query = format(<<-QUERY
let threshold = 0.99;
union traces, exceptions
| where cloud_RoleName == "pagopa-gpd-ingestion-manager"
| where cloud_RoleName == "pagopagpdingestionmanager"
| where operation_Name == "%s"
//| summarize count() by operation_Name, itemType
| summarize
Expand Down Expand Up @@ -75,15 +75,15 @@ resource "azurerm_monitor_scheduled_query_rules_alert" "gpd-ingestion-manager-er
custom_webhook_payload = "{}"
}
data_source_id = data.azurerm_application_insights.application_insights.id
description = "Error on JsonProcessing gpd-ingestion ${each.value.name}"
description = "${each.value.name} ingestion error JsonProcessingException"
enabled = true
query = format(<<-QUERY
traces
| where cloud_RoleName == "%s"
| order by timestamp desc
| where message contains "function error JsonProcessingException"
| where message contains "${each.value.name} ingestion error JsonProcessingException"
QUERY
, "pagopa-gpd-ingestion-manager"
, "pagopagpdingestionmanager"
)
severity = 2 // Sev 2 Warning
frequency = 15
Expand Down Expand Up @@ -115,7 +115,7 @@ resource "azurerm_monitor_scheduled_query_rules_alert" "gpd-ingestion-manager-er
| order by timestamp desc
| where message contains "function error Generic exception at"
QUERY
, "pagopa-gpd-ingestion-manager"
, "pagopagpdingestionmanager"
)
severity = 2 // Sev 2 Warning
frequency = 15
Expand All @@ -139,15 +139,15 @@ resource "azurerm_monitor_scheduled_query_rules_alert" "gpd-ingestion-manager-er
custom_webhook_payload = "{}"
}
data_source_id = data.azurerm_application_insights.application_insights.id
description = "Error on PDVTokenizerException gpd-ingestion ${each.value.name}"
description = "${each.value.name} ingestion error PDVTokenizerException"
enabled = true
query = format(<<-QUERY
traces
| where cloud_RoleName == "%s"
| order by timestamp desc
| where message contains "function error PDVTokenizerException exception at"
| where message contains "${each.value.name} ingestion error PDVTokenizerException"
QUERY
, "pagopa-gpd-ingestion-manager"
, "pagopagpdingestionmanager"
)
severity = 2 // Sev 2 Warning
frequency = 15
Expand All @@ -171,15 +171,15 @@ resource "azurerm_monitor_scheduled_query_rules_alert" "gpd-ingestion-manager-er
custom_webhook_payload = "{}"
}
data_source_id = data.azurerm_application_insights.application_insights.id
description = "Error on PDVTokenizerUnexpectedException gpd-ingestion ${each.value.name}"
description = "${each.value.name} ingestion error PDVTokenizerUnexpectedException"
enabled = true
query = format(<<-QUERY
traces
| where cloud_RoleName == "%s"
| order by timestamp desc
| where message contains "function error PDVTokenizerUnexpectedException exception at"
| where message contains "${each.value.name} ingestion error PDVTokenizerUnexpectedException"
QUERY
, "pagopa-gpd-ingestion-manager"
, "pagopagpdingestionmanager"
)
severity = 2 // Sev 2 Warning
frequency = 15
Expand Down Expand Up @@ -209,17 +209,18 @@ resource "azurerm_monitor_scheduled_query_rules_alert" "gpd-ingestion-manager-er
query = format(<<-QUERY
exceptions
| where cloud_RoleName == "%s"
| where outerMessage contains "Exception while executing function: Functions.${each.value.name}"
//| where outerMessage contains "${each.value.name} ingestion error Generic exception"
| where operation_Name startswith "${each.value.name}"
| order by timestamp desc
QUERY
, "pagopa-gpd-ingestion-manager" # from HELM's parameter WEBSITE_SITE_NAME
, "pagopagpdingestionmanager" # from HELM's parameter WEBSITE_SITE_NAME
)
severity = 2 // Sev 2 Warning
frequency = 15
time_window = 15
trigger {
operator = "GreaterThanOrEqual"
threshold = 20
threshold = 30
}

}

0 comments on commit 7ce5991

Please sign in to comment.