Skip to content

feat(obs): the three remaining standalone alarms — failure rate, spot interruptions, impersonation volume (#877) - #1293

Merged
athvin merged 2 commits into
mainfrom
feat/877-standalone-alarms
Nov 27, 2026
Merged

athvin merged 2 commits into
mainfrom
feat/877-standalone-alarms

Conversation

@athvin

@athvin athvin commented Nov 27, 2026 •

Copy link
Copy Markdown
Owner

Closes #877

Post-merge is part of this pull request. The ledger below records whether
the follow-up work actually happened. /land-pr closes it.

Adds #877's last three alarms to modules/operational-observability (failure rate, spot interruptions, impersonation volume), the BFF log line the impersonation filter counts, tftest runs, and the alarm list in the observability skill.

#877 (child of #667): five alarms independent of the cost model; two already shipped in #1051.

Proof

  • terraform test in the module: 3 passed (new standalone_alarms_877 and no_log_group_no_impersonation_alarm runs). terraform validate ok.
  • make check exit 0; frontend unit suite 1104 passed; eslint/tsc/prettier on the audit change.

Risk & rollback

Additive Terraform (2 alarms, 1 rule, 1 filter + alarm per env); applied by infra on main. git revert <merge-sha> removes them.

Post-merge ledger

Closed by: agent · session Claude Code:24d16c2e-fec6-49d8-9797-060338df4848 on Mac · 2026-11-27T04:01:21Z

Specific to this change

Context — plan, discoveries, measurements, files

Plan

Discoveries

Measurements

Files

🤖 Generated with Claude Code

… interruptions, impersonation volume (#877)

#1051 shipped queue-oldest and pod-pending; these complete #877's five,
each an aggregate with no tenant dimension:

- attempt failure rate: failed ÷ (failed + done) of er.tasks.completed over
  an hour across classes, > 25% with at least 4 attempts. no_op/skipped are
  left out to stay within the alarm's ten-query ceiling.
- spot interruptions: an EventBridge rule on aws.ec2 "EC2 Spot Instance
  Interruption Warning" and an alarm on its MatchedEvents, > 5/h.
- impersonation volume: the BFF's writeAudit prints one identity-free
  `er.audit.impersonation` line per impersonation event; a log metric
  filter on the containers log group counts it, > 20/h.

Thresholds are module variables; the impersonation pair is skipped when no
log group is given. Wired in dev and prod; tftest covers each.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

github-actions Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

The marketing preview was removed because this PR is closed or merged.

The fmt + validate gate runs fmt -check recursively; the earlier fmt ran in
the module directory alone and skipped tests/.
@github-actions

Copy link
Copy Markdown
Contributor

terraform plan

a0c42f6 · run log and full plans

env add change destroy
state-backend (plan only) 0 0 0
core 0 0 0
dev 5 0 0
prod 5 0 0

Planned with -refresh=false, so this is the config-versus-state diff and
not out-of-band drift. That is a security choice, not a speed one: a refreshing
plan reads secret values, and the plan role is assumable from any PR branch —
which can edit the workflow it runs under. Drift is caught at apply time, which
refreshes fully.

dev — 5 to add, 0 to change
module.eks.data.aws_iam_policy_document.cluster_trust: Reading...
data.aws_iam_openid_connect_provider.github: Reading...
data.aws_region.current: Reading...
data.aws_iam_policy_document.er_api_pod_trust: Reading...
data.aws_iam_policy_document.obs_pod_trust: Reading...
data.aws_iam_policy_document.er_api_pod_trust: Read complete after 0s [id=819195744]
module.eks.data.aws_iam_policy_document.cluster_trust: Read complete after 0s [id=1029077455]
data.aws_region.current: Read complete after 0s [id=us-east-2]
data.aws_iam_policy_document.obs_pod_trust: Read complete after 0s [id=819195744]
data.aws_caller_identity.current: Reading...
data.aws_iam_policy_document.efs_csi_trust: Reading...
data.aws_rds_engine_version.aurora_pg: Reading...
data.aws_iam_policy_document.efs_csi_trust: Read complete after 0s [id=819195744]
module.network.data.aws_region.current: Reading...
module.network.data.aws_region.current: Read complete after 0s [id=us-east-2]
data.aws_iam_policy_document.eso: Reading...
data.aws_iam_policy_document.eso_trust: Reading...
data.aws_iam_policy_document.eso_trust: Read complete after 0s [id=819195744]
data.aws_iam_policy_document.eso: Read complete after 0s [id=1725605485]
module.eks.data.aws_iam_policy_document.node_trust: Reading...
module.eks.data.aws_iam_policy_document.node_trust: Read complete after 0s [id=2851119427]
data.aws_caller_identity.current: Read complete after 0s [id=797781631727]
module.network.data.aws_availability_zones.available: Reading...
data.aws_iam_policy_document.fluent_bit: Reading...
data.aws_iam_policy_document.fluent_bit: Read complete after 0s [id=4006586444]
data.aws_iam_policy_document.otel_collector: Reading...
module.lake.data.aws_iam_policy_document.lake_tls_only: Reading...
data.aws_iam_policy_document.otel_collector: Read complete after 0s [id=3111493560]
module.lake.data.aws_iam_policy_document.lake_tls_only: Read complete after 0s [id=4017345831]
data.aws_iam_policy_document.bedrock_invoke: Reading...
data.aws_iam_policy_document.bedrock_invoke: Read complete after 0s [id=3601248236]
data.aws_iam_policy_document.lake_access: Reading...
data.aws_iam_policy_document.lake_access: Read complete after 0s [id=2921565705]
data.aws_iam_openid_connect_provider.github: Read complete after 0s [id=arn:aws:iam::797781631727:oidc-provider/token.actions.githubusercontent.com]
data.aws_iam_policy_document.ci_deploy_dev_trust: Reading...
data.aws_iam_policy_document.ci_deploy_dev_trust: Read complete after 0s [id=4060172364]
data.aws_rds_engine_version.aurora_pg: Read complete after 0s [id=17.9]
module.network.data.aws_availability_zones.available: Read complete after 0s [id=us-east-2]
data.aws_iam_policy_document.ci_deploy_dev: Reading...
data.aws_iam_policy_document.ci_deploy_dev: Read complete after 0s [id=1754478413]

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # module.operations.aws_cloudwatch_event_rule.spot_interruption will be created
  + resource "aws_cloudwatch_event_rule" "spot_interruption" {
      + arn            = (known after apply)
      + description    = "EC2 Spot interruption warnings, counted for the spot-interruption alarm."
      + event_bus_name = "default"
      + event_pattern  = jsonencode(
            {
              + detail-type = [
                  + "EC2 Spot Instance Interruption Warning",
                ]
              + source      = [
                  + "aws.ec2",
                ]
            }
        )
      + force_destroy  = false
      + id             = (known after apply)
      + name           = "er-dev-spot-interruption"
      + name_prefix    = (known after apply)
      + region         = "us-east-2"
      + tags_all       = {
          + "Environment" = "dev"
          + "ManagedBy"   = "terraform"
          + "Project"     = "entity-resolution"
        }
    }

  # module.operations.aws_cloudwatch_log_metric_filter.impersonation[0] will be created
  + resource "aws_cloudwatch_log_metric_filter" "impersonation" {
      + apply_on_transformed_logs = (known after apply)
      + id                        = (known after apply)
      + log_group_name            = "/er/dev/containers"
      + name                      = "er-dev-impersonation"
      + pattern                   = "\"er.audit.impersonation\""
      + region                    = "us-east-2"

      + metric_transformation {
          + default_value = "0"
          + name          = "er.audit.impersonations"
          + namespace     = "ER/Dev"
          + unit          = "None"
          + value         = "1"
        }
    }

  # module.operations.aws_cloudwatch_metric_alarm.attempt_failure_rate will be created
  + resource "aws_cloudwatch_metric_alarm" "attempt_failure_rate" {
      + actions_enabled                       = true
      + alarm_actions                         = [
          + "arn:aws:sns:us-east-2:797781631727:er-alerts",
        ]
      + alarm_description                     = "More than 25% of finished task attempts failed in the last hour (with at least 4 attempts). Read the failing tasks' error_class: a config or precondition burst is a tenant's input, an internal or infrastructure burst is ours."
      + alarm_name                            = "er-dev-attempt-failure-rate"
      + arn                                   = (known after apply)
      + comparison_operator                   = "GreaterThanThreshold"
      + evaluate_low_sample_count_percentiles = (known after apply)
      + evaluation_periods                    = 1
      + id                                    = (known after apply)
      + ok_actions                            = [
          + "arn:aws:sns:us-east-2:797781631727:er-alerts",
        ]
      + region                                = "us-east-2"
      + tags_all                              = {
          + "Environment" = "dev"
          + "ManagedBy"   = "terraform"
          + "Project"     = "entity-resolution"
        }
      + threshold                             = 0.25
      + treat_missing_data                    = "notBreaching"

      + metric_query {
          + id          = "d0"
          + return_data = false
            # (3 unchanged attributes hidden)

          + metric {
              + dimensions  = {
                  + "OTelLib"        = "er-obs"
                  + "outcome"        = "done"
                  + "resource_class" = "S"
                }
              + metric_name = "er.tasks.completed"
              + namespace   = "ER/Dev"
              + period      = 3600
              + stat        = "Sum"
                # (1 unchanged attribute hidden)
            }
        }
      + metric_query {
          + id          = "d1"
          + return_data = false
            # (3 unchanged attributes hidden)

          + metric {
              + dimensions  = {
                  + "OTelLib"        = "er-obs"
                  + "outcome"        = "done"
                  + "resource_class" = "M"
                }
              + metric_name = "er.tasks.completed"
              + namespace   = "ER/Dev"
              + period      = 3600
              + stat        = "Sum"
                # (1 unchanged attribute hidden)
            }
        }
      + metric_query {
          + id          = "d2"
          + return_data = false
            # (3 unchanged attributes hidden)

          + metric {
              + dimensions  = {
                  + "OTelLib"        = "er-obs"
                  + "outcome"        = "done"
                  + "resource_class" = "L"
                }
              + metric_name = "er.tasks.completed"
              + namespace   = "ER/Dev"
              + period      = 3600
              + stat        = "Sum"
                # (1 unchanged attribute hidden)
            }
        }
      + metric_query {
          + id          = "d3"
          + return_data = false
            # (3 unchanged attributes hidden)

          + metric {
              + dimensions  = {
                  + "OTelLib"        = "er-obs"
                  + "outcome"        = "done"
                  + "resource_class" = "other"
                }
              + metric_name = "er.tasks.completed"
              + namespace   = "ER/Dev"
              + period      = 3600
              + stat        = "Sum"
                # (1 unchanged attribute hidden)
            }
        }
      + metric_query {
          + id          = "f0"
          + return_data = false
            # (3 unchanged attributes hidden)

          + metric {
              + dimensions  = {
                  + "OTelLib"        = "er-obs"
                  + "outcome"        = "failed"
                  + "resource_class" = "S"
                }
              + metric_name = "er.tasks.completed"
              + namespace   = "ER/Dev"
              + period      = 3600
              + stat        = "Sum"
                # (1 unchanged attribute hidden)
            }
        }
      + metric_query {
          + id          = "f1"
          + return_data = false
            # (3 unchanged attributes hidden)

          + metric {
              + dimensions  = {
                  + "OTelLib"        = "er-obs"
                  + "outcome"        = "failed"
                  + "resource_class" = "M"
                }
              + metric_name = "er.tasks.completed"
              + namespace   = "ER/Dev"
              + period      = 3600
              + stat        = "Sum"
                # (1 unchanged attribute hidden)
            }
        }
      + metric_query {
          + id          = "f2"
          + return_data = false
            # (3 unchanged attributes hidden)

          + metric {
              + dimensions  = {
                  + "OTelLib"        = "er-obs"
                  + "outcome"        = "failed"
                  + "resource_class" = "L"
                }
              + metric_name = "er.tasks.completed"
              + namespace   = "ER/Dev"
              + period      = 3600
              + stat        = "Sum"
                # (1 unchanged attribute hidden)
            }
        }
      + metric_query {
          + id          = "f3"
          + return_data = false
            # (3 unchanged attributes hidden)

          + metric {
              + dimensions  = {
                  + "OTelLib"        = "er-obs"
                  + "outcome"        = "failed"
                  + "resource_class" = "other"
                }
              + metric_name = "er.tasks.completed"
              + namespace   = "ER/Dev"
              + period      = 3600
              + stat        = "Sum"
                # (1 unchanged attribute hidden)
            }
        }
      + metric_query {
          + expression  = "IF((FILL(f0,0)+FILL(f1,0)+FILL(f2,0)+FILL(f3,0)+FILL(d0,0)+FILL(d1,0)+FILL(d2,0)+FILL(d3,0)) >= 4, (FILL(f0,0)+FILL(f1,0)+FILL(f2,0)+FILL(f3,0)) / (FILL(f0,0)+FILL(f1,0)+FILL(f2,0)+FILL(f3,0)+FILL(d0,0)+FILL(d1,0)+FILL(d2,0)+FILL(d3,0)), 0)"
          + id          = "rate"
          + return_data = true
            # (2 unchanged attributes hidden)
        }
    }

  # module.operations.aws_cloudwatch_metric_alarm.impersonation_volume[0] will be created
  + resource "aws_cloudwatch_metric_alarm" "impersonation_volume" {
      + actions_enabled                       = true
      + alarm_actions                         = [
          + "arn:aws:sns:us-east-2:797781631727:er-alerts",
        ]
      + alarm_description                     = "More than 20 impersonation events (start, stop or impersonated mutation) in an hour. Read erweb.audit for who and which org; operators impersonate to support a tenant, so a burst is either an incident being worked or a compromised operator session."
      + alarm_name                            = "er-dev-impersonation-volume"
      + arn                                   = (known after apply)
      + comparison_operator                   = "GreaterThanThreshold"
      + evaluate_low_sample_count_percentiles = (known after apply)
      + evaluation_periods                    = 1
      + id                                    = (known after apply)
      + metric_name                           = "er.audit.impersonations"
      + namespace                             = "ER/Dev"
      + ok_actions                            = [
          + "arn:aws:sns:us-east-2:797781631727:er-alerts",
        ]
      + period                                = 3600
      + region                                = "us-east-2"
      + statistic                             = "Sum"
      + tags_all                              = {
          + "Environment" = "dev"
          + "ManagedBy"   = "terraform"
          + "Project"     = "entity-resolution"
        }
      + threshold                             = 20
      + treat_missing_data                    = "notBreaching"
    }

  # module.operations.aws_cloudwatch_metric_alarm.spot_interruptions will be created
  + resource "aws_cloudwatch_metric_alarm" "spot_interruptions" {
      + actions_enabled                       = true
      + alarm_actions                         = [
          + "arn:aws:sns:us-east-2:797781631727:er-alerts",
        ]
      + alarm_description                     = "More than 5 EC2 Spot interruption warnings in an hour. Runner tasks survive one (do-not-disrupt pods are reclaimed under, then relaunched), but a sustained rate means the spot pools are a poor fit: widen the NodePools' instance families or move a class to on-demand."
      + alarm_name                            = "er-dev-spot-interruptions"
      + arn                                   = (known after apply)
      + comparison_operator                   = "GreaterThanThreshold"
      + dimensions                            = {
          + "RuleName" = "er-dev-spot-interruption"
        }
      + evaluate_low_sample_count_percentiles = (known after apply)
      + evaluation_periods                    = 1
      + id                                    = (known after apply)
      + metric_name                           = "MatchedEvents"
      + namespace                             = "AWS/Events"
      + ok_actions                            = [
          + "arn:aws:sns:us-east-2:797781631727:er-alerts",
        ]
      + period                                = 3600
      + region                                = "us-east-2"
      + statistic                             = "Sum"
      + tags_all                              = {
          + "Environment" = "dev"
          + "ManagedBy"   = "terraform"
          + "Project"     = "entity-resolution"
        }
      + threshold                             = 5
      + treat_missing_data                    = "notBreaching"
    }

Plan: 5 to add, 0 to change, 0 to destroy.
prod — 5 to add, 0 to change
module.ses.data.aws_region.current: Reading...
data.aws_iam_policy_document.efs_csi_trust: Reading...
module.ses.data.aws_region.current: Read complete after 0s [id=us-east-2]
data.aws_iam_policy_document.efs_csi_trust: Read complete after 0s [id=819195744]
data.aws_iam_openid_connect_provider.github: Reading...
data.aws_iam_policy_document.pod_trust: Reading...
data.aws_iam_policy_document.pod_trust: Read complete after 0s [id=819195744]
module.network.data.aws_availability_zones.available: Reading...
data.aws_iam_policy_document.eso_trust: Reading...
data.aws_caller_identity.current: Reading...
data.aws_iam_policy_document.eso_trust: Read complete after 0s [id=819195744]
module.eks.data.aws_iam_policy_document.cluster_trust: Reading...
data.aws_rds_engine_version.aurora_pg: Reading...
module.eks.data.aws_iam_policy_document.cluster_trust: Read complete after 0s [id=1029077455]
module.eks.data.aws_iam_policy_document.node_trust: Reading...
module.eks.data.aws_iam_policy_document.node_trust: Read complete after 0s [id=2851119427]
module.network.data.aws_region.current: Reading...
data.aws_iam_policy_document.fluent_bit: Reading...
module.network.data.aws_region.current: Read complete after 0s [id=us-east-2]
data.aws_iam_policy_document.fluent_bit: Read complete after 0s [id=2978074842]
data.aws_caller_identity.current: Read complete after 0s [id=797781631727]
data.aws_iam_policy_document.otel_collector: Reading...
data.aws_iam_policy_document.otel_collector: Read complete after 0s [id=1193716550]
data.aws_iam_policy_document.openobserve: Reading...
data.aws_iam_policy_document.openobserve: Read complete after 0s [id=2652188337]
data.aws_iam_policy_document.api_contract_bucket: Reading...
data.aws_iam_policy_document.api_contract_bucket: Read complete after 0s [id=1127163522]
module.lake.data.aws_iam_policy_document.lake_tls_only: Reading...
data.aws_iam_openid_connect_provider.github: Read complete after 0s [id=arn:aws:iam::797781631727:oidc-provider/token.actions.githubusercontent.com]
module.lake.data.aws_iam_policy_document.lake_tls_only: Read complete after 0s [id=2453399085]
data.aws_iam_policy_document.ci_deploy_prod_api_contract: Reading...
data.aws_iam_policy_document.eso: Reading...
data.aws_iam_policy_document.eso: Read complete after 0s [id=2178872705]
data.aws_iam_policy_document.ci_deploy_prod_api_contract: Read complete after 0s [id=3801820449]
module.ses.data.aws_iam_policy_document.send: Reading...
module.ses.data.aws_iam_policy_document.send: Read complete after 0s [id=3767633194]
data.aws_iam_policy_document.lake_access: Reading...
module.network.data.aws_availability_zones.available: Read complete after 1s [id=us-east-2]
data.aws_iam_policy_document.lake_access: Read complete after 0s [id=1033619361]
data.aws_iam_policy_document.ci_deploy_prod_trust: Reading...
data.aws_iam_policy_document.ci_deploy_prod_trust: Read complete after 0s [id=4060172364]
data.aws_rds_engine_version.aurora_pg: Read complete after 1s [id=17.9]
data.aws_iam_policy_document.ci_deploy_prod: Reading...
data.aws_iam_policy_document.ci_deploy_prod: Read complete after 0s [id=2891227359]

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # module.operations.aws_cloudwatch_event_rule.spot_interruption will be created
  + resource "aws_cloudwatch_event_rule" "spot_interruption" {
      + arn            = (known after apply)
      + description    = "EC2 Spot interruption warnings, counted for the spot-interruption alarm."
      + event_bus_name = "default"
      + event_pattern  = jsonencode(
            {
              + detail-type = [
                  + "EC2 Spot Instance Interruption Warning",
                ]
              + source      = [
                  + "aws.ec2",
                ]
            }
        )
      + force_destroy  = false
      + id             = (known after apply)
      + name           = "er-prod-spot-interruption"
      + name_prefix    = (known after apply)
      + region         = "us-east-2"
      + tags_all       = {
          + "Environment" = "prod"
          + "ManagedBy"   = "terraform"
          + "Project"     = "entity-resolution"
        }
    }

  # module.operations.aws_cloudwatch_log_metric_filter.impersonation[0] will be created
  + resource "aws_cloudwatch_log_metric_filter" "impersonation" {
      + apply_on_transformed_logs = (known after apply)
      + id                        = (known after apply)
      + log_group_name            = "/er/prod/containers"
      + name                      = "er-prod-impersonation"
      + pattern                   = "\"er.audit.impersonation\""
      + region                    = "us-east-2"

      + metric_transformation {
          + default_value = "0"
          + name          = "er.audit.impersonations"
          + namespace     = "ER/Prod"
          + unit          = "None"
          + value         = "1"
        }
    }

  # module.operations.aws_cloudwatch_metric_alarm.attempt_failure_rate will be created
  + resource "aws_cloudwatch_metric_alarm" "attempt_failure_rate" {
      + actions_enabled                       = true
      + alarm_actions                         = [
          + "arn:aws:sns:us-east-2:797781631727:er-alerts",
        ]
      + alarm_description                     = "More than 25% of finished task attempts failed in the last hour (with at least 4 attempts). Read the failing tasks' error_class: a config or precondition burst is a tenant's input, an internal or infrastructure burst is ours."
      + alarm_name                            = "er-prod-attempt-failure-rate"
      + arn                                   = (known after apply)
      + comparison_operator                   = "GreaterThanThreshold"
      + evaluate_low_sample_count_percentiles = (known after apply)
      + evaluation_periods                    = 1
      + id                                    = (known after apply)
      + ok_actions                            = [
          + "arn:aws:sns:us-east-2:797781631727:er-alerts",
        ]
      + region                                = "us-east-2"
      + tags_all                              = {
          + "Environment" = "prod"
          + "ManagedBy"   = "terraform"
          + "Project"     = "entity-resolution"
        }
      + threshold                             = 0.25
      + treat_missing_data                    = "notBreaching"

      + metric_query {
          + id          = "d0"
          + return_data = false
            # (3 unchanged attributes hidden)

          + metric {
              + dimensions  = {
                  + "OTelLib"        = "er-obs"
                  + "outcome"        = "done"
                  + "resource_class" = "S"
                }
              + metric_name = "er.tasks.completed"
              + namespace   = "ER/Prod"
              + period      = 3600
              + stat        = "Sum"
                # (1 unchanged attribute hidden)
            }
        }
      + metric_query {
          + id          = "d1"
          + return_data = false
            # (3 unchanged attributes hidden)

          + metric {
              + dimensions  = {
                  + "OTelLib"        = "er-obs"
                  + "outcome"        = "done"
                  + "resource_class" = "M"
                }
              + metric_name = "er.tasks.completed"
              + namespace   = "ER/Prod"
              + period      = 3600
              + stat        = "Sum"
                # (1 unchanged attribute hidden)
            }
        }
      + metric_query {
          + id          = "d2"
          + return_data = false
            # (3 unchanged attributes hidden)

          + metric {
              + dimensions  = {
                  + "OTelLib"        = "er-obs"
                  + "outcome"        = "done"
                  + "resource_class" = "L"
                }
              + metric_name = "er.tasks.completed"
              + namespace   = "ER/Prod"
              + period      = 3600
              + stat        = "Sum"
                # (1 unchanged attribute hidden)
            }
        }
      + metric_query {
          + id          = "d3"
          + return_data = false
            # (3 unchanged attributes hidden)

          + metric {
              + dimensions  = {
                  + "OTelLib"        = "er-obs"
                  + "outcome"        = "done"
                  + "resource_class" = "other"
                }
              + metric_name = "er.tasks.completed"
              + namespace   = "ER/Prod"
              + period      = 3600
              + stat        = "Sum"
                # (1 unchanged attribute hidden)
            }
        }
      + metric_query {
          + id          = "f0"
          + return_data = false
            # (3 unchanged attributes hidden)

          + metric {
              + dimensions  = {
                  + "OTelLib"        = "er-obs"
                  + "outcome"        = "failed"
                  + "resource_class" = "S"
                }
              + metric_name = "er.tasks.completed"
              + namespace   = "ER/Prod"
              + period      = 3600
              + stat        = "Sum"
                # (1 unchanged attribute hidden)
            }
        }
      + metric_query {
          + id          = "f1"
          + return_data = false
            # (3 unchanged attributes hidden)

          + metric {
              + dimensions  = {
                  + "OTelLib"        = "er-obs"
                  + "outcome"        = "failed"
                  + "resource_class" = "M"
                }
              + metric_name = "er.tasks.completed"
              + namespace   = "ER/Prod"
              + period      = 3600
              + stat        = "Sum"
                # (1 unchanged attribute hidden)
            }
        }
      + metric_query {
          + id          = "f2"
          + return_data = false
            # (3 unchanged attributes hidden)

          + metric {
              + dimensions  = {
                  + "OTelLib"        = "er-obs"
                  + "outcome"        = "failed"
                  + "resource_class" = "L"
                }
              + metric_name = "er.tasks.completed"
              + namespace   = "ER/Prod"
              + period      = 3600
              + stat        = "Sum"
                # (1 unchanged attribute hidden)
            }
        }
      + metric_query {
          + id          = "f3"
          + return_data = false
            # (3 unchanged attributes hidden)

          + metric {
              + dimensions  = {
                  + "OTelLib"        = "er-obs"
                  + "outcome"        = "failed"
                  + "resource_class" = "other"
                }
              + metric_name = "er.tasks.completed"
              + namespace   = "ER/Prod"
              + period      = 3600
              + stat        = "Sum"
                # (1 unchanged attribute hidden)
            }
        }
      + metric_query {
          + expression  = "IF((FILL(f0,0)+FILL(f1,0)+FILL(f2,0)+FILL(f3,0)+FILL(d0,0)+FILL(d1,0)+FILL(d2,0)+FILL(d3,0)) >= 4, (FILL(f0,0)+FILL(f1,0)+FILL(f2,0)+FILL(f3,0)) / (FILL(f0,0)+FILL(f1,0)+FILL(f2,0)+FILL(f3,0)+FILL(d0,0)+FILL(d1,0)+FILL(d2,0)+FILL(d3,0)), 0)"
          + id          = "rate"
          + return_data = true
            # (2 unchanged attributes hidden)
        }
    }

  # module.operations.aws_cloudwatch_metric_alarm.impersonation_volume[0] will be created
  + resource "aws_cloudwatch_metric_alarm" "impersonation_volume" {
      + actions_enabled                       = true
      + alarm_actions                         = [
          + "arn:aws:sns:us-east-2:797781631727:er-alerts",
        ]
      + alarm_description                     = "More than 20 impersonation events (start, stop or impersonated mutation) in an hour. Read erweb.audit for who and which org; operators impersonate to support a tenant, so a burst is either an incident being worked or a compromised operator session."
      + alarm_name                            = "er-prod-impersonation-volume"
      + arn                                   = (known after apply)
      + comparison_operator                   = "GreaterThanThreshold"
      + evaluate_low_sample_count_percentiles = (known after apply)
      + evaluation_periods                    = 1
      + id                                    = (known after apply)
      + metric_name                           = "er.audit.impersonations"
      + namespace                             = "ER/Prod"
      + ok_actions                            = [
          + "arn:aws:sns:us-east-2:797781631727:er-alerts",
        ]
      + period                                = 3600
      + region                                = "us-east-2"
      + statistic                             = "Sum"
      + tags_all                              = {
          + "Environment" = "prod"
          + "ManagedBy"   = "terraform"
          + "Project"     = "entity-resolution"
        }
      + threshold                             = 20
      + treat_missing_data                    = "notBreaching"
    }

  # module.operations.aws_cloudwatch_metric_alarm.spot_interruptions will be created
  + resource "aws_cloudwatch_metric_alarm" "spot_interruptions" {
      + actions_enabled                       = true
      + alarm_actions                         = [
          + "arn:aws:sns:us-east-2:797781631727:er-alerts",
        ]
      + alarm_description                     = "More than 5 EC2 Spot interruption warnings in an hour. Runner tasks survive one (do-not-disrupt pods are reclaimed under, then relaunched), but a sustained rate means the spot pools are a poor fit: widen the NodePools' instance families or move a class to on-demand."
      + alarm_name                            = "er-prod-spot-interruptions"
      + arn                                   = (known after apply)
      + comparison_operator                   = "GreaterThanThreshold"
      + dimensions                            = {
          + "RuleName" = "er-prod-spot-interruption"
        }
      + evaluate_low_sample_count_percentiles = (known after apply)
      + evaluation_periods                    = 1
      + id                                    = (known after apply)
      + metric_name                           = "MatchedEvents"
      + namespace                             = "AWS/Events"
      + ok_actions                            = [
          + "arn:aws:sns:us-east-2:797781631727:er-alerts",
        ]
      + period                                = 3600
      + region                                = "us-east-2"
      + statistic                             = "Sum"
      + tags_all                              = {
          + "Environment" = "prod"
          + "ManagedBy"   = "terraform"
          + "Project"     = "entity-resolution"
        }
      + threshold                             = 5
      + treat_missing_data                    = "notBreaching"
    }

Plan: 5 to add, 0 to change, 0 to destroy.

@athvin
athvin merged commit 2183d5e into main Nov 27, 2026
42 checks passed
@athvin
athvin temporarily deployed to marketing-preview November 27, 2026 03:24 — with GitHub Actions Inactive
athvin added a commit that referenced this pull request Nov 27, 2026
…fuses filters (#1302) ALLOW-DESTROY

#1293's filter on /er/{env}/containers was refused in dev and prod
(PutMetricFilter: only supported on the Standard log class); that group is
Infrequent Access by the P4 cost decision, so the infra workflow on main
would keep failing on it. The filter and its alarm come out; the failure
rate and spot interruption alarms stay. The BFF's er.audit.impersonation
line remains for #1301 to count through a Standard-class route.

Co-authored-by: bmoore813 <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>

This branch was previously deployed

1 inactive deployment
marketing-preview — df93fbbf Deployed Nov 27, 2026 by athvin via remove closed PR previews #88
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.

The five standalone telemetry alarms that need no cost model (runner-pending, queue age, failure rate, spot interruptions, impersonation volume)

2 participants