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

[#IOPID-2346] Add alert rule for profile deletion poison queue + move alerts to error action group #1257

Merged
merged 3 commits into from
Oct 25, 2024

Conversation

gquadrati
Copy link
Contributor

Motivation and Context

Enable alert on profile deletion event on poison queue.
Move all alerts to prod_error action group.

Major Changes

Enable alert on profile deletion event on poison queue.
Move all alerts to prod_error action group.

Dependencies

Testing

Documentation

Other Considerations

Copy link

Copy link
Contributor

@BurnedMarshal BurnedMarshal left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

📖 Terraform Plan ('src/domains/elt/prod') - success

Terraform Plan
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create
  ~ update in-place

Terraform will perform the following actions:

  # module.function_apps.azurerm_monitor_scheduled_query_rules_alert_v2.profile_deletion_failure_alert_rule will be created
  + resource "azurerm_monitor_scheduled_query_rules_alert_v2" "profile_deletion_failure_alert_rule" {
      + auto_mitigation_enabled                = false
      + created_with_api_version               = (known after apply)
      + description                            = "Permanent failures processing Profiles export to PDND. REQUIRED MANUAL ACTION"
      + enabled                                = true
      + evaluation_frequency                   = "PT15M"
      + id                                     = (known after apply)
      + is_a_legacy_log_analytics_rule         = (known after apply)
      + is_workspace_alerts_storage_configured = (known after apply)
      + location                               = "westeurope"
      + name                                   = "[CITIZEN-AUTH | iopfneltsdt] Failures on pdnd-io-cosmosdb-profile-deletion-failure-poison"
      + resource_group_name                    = "io-p-elt-rg"
      + scopes                                 = [
          + "/subscriptions/ec285037-c673-4f58-b594-d7c480da4e8b/resourceGroups/io-p-elt-rg/providers/Microsoft.Storage/storageAccounts/iopfneltsdt",
        ]
      + severity                               = 1
      + tags                                   = {
          + "CostCenter"     = "TS310 - PAGAMENTI & SERVIZI"
          + "CreatedBy"      = "Terraform"
          + "Environment"    = "Prod"
          + "ManagementTeam" = "IO Platform"
          + "Owner"          = "IO"
          + "Source"         = "https://github.com/pagopa/io-infra/blob/main/src/domains/elt/prod"
        }
      + window_duration                        = "PT15M"
      + workspace_alerts_storage_enabled       = false

      + action {
          + action_groups = [
              + "/subscriptions/ec285037-c673-4f58-b594-d7c480da4e8b/resourceGroups/io-p-rg-common/providers/Microsoft.Insights/actionGroups/ioperror",
            ]
        }

      + criteria {
          + operator                = "GreaterThan"
          + query                   = <<-EOT
                StorageQueueLogs
                  | where OperationName contains "PutMessage"
                  | where Uri contains "pdnd-io-cosmosdb-profile-deletion-failure-poison"
            EOT
          + threshold               = 0
          + time_aggregation_method = "Count"
        }
    }

  # module.function_apps.azurerm_monitor_scheduled_query_rules_alert_v2.profiles_failure_alert_rule will be updated in-place
  ~ resource "azurerm_monitor_scheduled_query_rules_alert_v2" "profiles_failure_alert_rule" {
        id                                     = "/subscriptions/ec285037-c673-4f58-b594-d7c480da4e8b/resourceGroups/io-p-elt-rg/providers/Microsoft.Insights/scheduledQueryRules/[CITIZEN-AUTH | iopfneltsdt] Failures on pdnd-io-cosmosdb-profiles-failure-poison"
        name                                   = "[CITIZEN-AUTH | iopfneltsdt] Failures on pdnd-io-cosmosdb-profiles-failure-poison"
        tags                                   = {
            "CostCenter"     = "TS310 - PAGAMENTI & SERVIZI"
            "CreatedBy"      = "Terraform"
            "Environment"    = "Prod"
            "ManagementTeam" = "IO Platform"
            "Owner"          = "IO"
            "Source"         = "https://github.com/pagopa/io-infra/blob/main/src/domains/elt/prod"
        }
        # (15 unchanged attributes hidden)

      ~ action {
          ~ action_groups     = [
              - "/subscriptions/ec285037-c673-4f58-b594-d7c480da4e8b/resourceGroups/io-p-rg-common/providers/Microsoft.Insights/actionGroups/iopquarantineerror",
              + "/subscriptions/ec285037-c673-4f58-b594-d7c480da4e8b/resourceGroups/io-p-rg-common/providers/Microsoft.Insights/actionGroups/ioperror",
            ]
            # (1 unchanged attribute hidden)
        }

        # (1 unchanged block hidden)
    }

  # module.function_apps.azurerm_monitor_scheduled_query_rules_alert_v2.service_preferences_failure_alert_rule will be updated in-place
  ~ resource "azurerm_monitor_scheduled_query_rules_alert_v2" "service_preferences_failure_alert_rule" {
        id                                     = "/subscriptions/ec285037-c673-4f58-b594-d7c480da4e8b/resourceGroups/io-p-elt-rg/providers/Microsoft.Insights/scheduledQueryRules/[CITIZEN-AUTH | iopfneltsdt] Failures on pdnd-io-cosmosdb-service-preferences-failure-poison"
        name                                   = "[CITIZEN-AUTH | iopfneltsdt] Failures on pdnd-io-cosmosdb-service-preferences-failure-poison"
        tags                                   = {
            "CostCenter"     = "TS310 - PAGAMENTI & SERVIZI"
            "CreatedBy"      = "Terraform"
            "Environment"    = "Prod"
            "ManagementTeam" = "IO Platform"
            "Owner"          = "IO"
            "Source"         = "https://github.com/pagopa/io-infra/blob/main/src/domains/elt/prod"
        }
        # (15 unchanged attributes hidden)

      ~ action {
          ~ action_groups     = [
              - "/subscriptions/ec285037-c673-4f58-b594-d7c480da4e8b/resourceGroups/io-p-rg-common/providers/Microsoft.Insights/actionGroups/iopquarantineerror",
              + "/subscriptions/ec285037-c673-4f58-b594-d7c480da4e8b/resourceGroups/io-p-rg-common/providers/Microsoft.Insights/actionGroups/ioperror",
            ]
            # (1 unchanged attribute hidden)
        }

        # (1 unchanged block hidden)
    }

  # module.function_apps.module.function_elt.azurerm_linux_function_app.this will be updated in-place
  ~ resource "azurerm_linux_function_app" "this" {
        id                                             = "/subscriptions/ec285037-c673-4f58-b594-d7c480da4e8b/resourceGroups/io-p-elt-rg/providers/Microsoft.Web/sites/io-p-fn-elt"
        name                                           = "io-p-fn-elt"
        tags                                           = {
            "CostCenter"                                     = "TS310 - PAGAMENTI & SERVIZI"
            "CreatedBy"                                      = "Terraform"
            "Environment"                                    = "Prod"
            "ManagementTeam"                                 = "IO Platform"
            "Owner"                                          = "IO"
            "Source"                                         = "https://github.com/pagopa/io-infra/blob/main/src/domains/elt/prod"
        }
        # (28 unchanged attributes hidden)

      ~ site_config {
          ~ health_check_eviction_time_in_min       = 0 -> 10
            # (24 unchanged attributes hidden)

            # (8 unchanged blocks hidden)
        }

        # (1 unchanged block hidden)
    }

Plan: 1 to add, 3 to change, 0 to destroy.

─────────────────────────────────────────────────────────────────────────────

Note: You didn't use the -out option to save this plan, so Terraform can't
guarantee to take exactly these actions if you run "terraform apply" now.

@BurnedMarshal BurnedMarshal merged commit 0e24b3e into main Oct 25, 2024
6 checks passed
@BurnedMarshal BurnedMarshal deleted the IOPID-2346--fix branch October 25, 2024 06:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants