Skip to content

feat(obs): span-export silence — self-reported counters and the absent-spans alarm (#941) - #942

Merged
athvin merged 7 commits into
mainfrom
issue/941-span-export-guard
Nov 9, 2026
Merged

athvin merged 7 commits into
mainfrom
issue/941-span-export-guard

Conversation

@athvin

@athvin athvin commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

Closes #941 (partially — the detection half; the root-cause half gets a reproducer if the counters reveal the wedge point).

Plan

The api pod exported zero spans for 40 minutes while its metrics flowed. Nothing paged because nothing watches span volume per role. This PR makes the process testify against itself:

  1. Counters in er-obs at the two seams that isolate the wedge:
    • er.telemetry.spans_ended — a SpanProcessor wrapper counting spans reaching the batch processor.
    • er.telemetry.spans_exported / er.telemetry.span_export_failures — an exporter wrapper counting batch outcomes.
      Both ride the existing metric pipeline (the one that stayed up through the outage), per the registry's cardinality rules — no new dimensions beyond the role identity already carried.
  2. The absent-spans alarm (terraform): er-api spans_exported rate ~ 0 for 15m while its db-query metric (liveness reference) is nonzero.

Evidence trail

The full live hunt is in #941 and the #660 closing comment.

Closed by: Codex · session 01a1be1b-0c92-7703-a4c2-25cb2c999baa on Mac.lan · 2026-11-09T02:45:34.712962+00:00

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

terraform plan

529719a · run log and full plans

env add change destroy
state-backend (plan only) 0 0 0
core 0 0 2
dev 2 0 0
prod 0 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.

Warning

This plan DESTROYS resources in: core. Merging applies it unattended.
The apply refuses to run unless the merge commit message carries
ALLOW-DESTROY. Retitling is not enough on a single-commit PR — GitHub
uses the commit message there, not the title. Merge with
gh pr merge <n> --squash --subject '<subject> ALLOW-DESTROY'.

core — 0 to add, 0 to change, 2 to DESTROY
module.identity_center.data.aws_ssoadmin_instances.this: Reading...
data.aws_iam_policy_document.ci_tf_drift_refresh: Reading...
data.aws_caller_identity.current: Reading...
data.aws_iam_policy_document.obs_pod_trust: Reading...
data.aws_iam_policy_document.obs_pod_trust: Read complete after 0s [id=819195744]
data.aws_iam_policy_document.ci_tf_drift_refresh: Read complete after 0s [id=2350222434]
data.aws_iam_policy_document.ci_tf_apply_no_prod_state: Reading...
data.aws_iam_policy_document.ci_tf_apply_no_prod_state: Read complete after 0s [id=2395007408]
data.aws_caller_identity.current: Read complete after 0s [id=797781631727]
data.aws_iam_policy_document.ci_tf_plan_state: Reading...
data.aws_iam_policy_document.ci_tf_plan_state: Read complete after 0s [id=2883378100]
module.github_oidc.data.aws_iam_policy_document.trust: Reading...
data.aws_iam_policy_document.sccache_write: Reading...
data.aws_iam_policy_document.sccache_read: Reading...
module.github_oidc.data.aws_iam_policy_document.trust: Read complete after 0s [id=4060172364]
data.aws_iam_policy_document.sccache_write: Read complete after 0s [id=786296009]
data.aws_iam_policy_document.sccache_read: Read complete after 0s [id=2701062528]
data.aws_iam_policy_document.cur_delivery: Reading...
data.aws_iam_policy_document.cur_delivery: Read complete after 0s [id=2207400467]
data.aws_iam_policy_document.audit_bucket: Reading...
data.aws_iam_policy_document.audit_bucket: Read complete after 0s [id=3031279952]
data.aws_iam_policy_document.config_bucket: Reading...
data.aws_iam_policy_document.openobserve: Reading...
data.aws_iam_policy_document.ci_tf_plan_trust: Reading...
data.aws_iam_policy_document.config_bucket: Read complete after 0s [id=4067691321]
data.aws_iam_policy_document.ci_tf_drift_trust: Reading...
data.aws_iam_policy_document.openobserve: Read complete after 0s [id=2662704728]
data.aws_iam_policy_document.ci_tf_drift_trust: Read complete after 0s [id=2357770959]
data.aws_iam_policy_document.sccache_trust_read: Reading...
data.aws_iam_policy_document.sccache_trust_write: Reading...
data.aws_iam_policy_document.ci_tf_apply_trust: Reading...
data.aws_iam_policy_document.ci_tf_plan_trust: Read complete after 0s [id=1630650595]
data.aws_iam_policy_document.sccache_trust_read: Read complete after 0s [id=1630650595]
data.aws_iam_policy_document.sccache_trust_write: Read complete after 0s [id=4060172364]
data.aws_iam_policy_document.ci_tf_apply_trust: Read complete after 0s [id=2538345208]
module.github_oidc.data.aws_iam_policy_document.push: Reading...
module.github_oidc.data.aws_iam_policy_document.push: Read complete after 0s [id=2177873069]
data.aws_iam_policy_document.ci_tf_apply_prod_trust: Reading...
data.aws_iam_policy_document.ci_tf_apply_prod_trust: Read complete after 0s [id=3513372776]
module.identity_center.data.aws_ssoadmin_instances.this: Read complete after 0s [id=us-east-2]
module.identity_center.data.aws_identitystore_user.admin: Reading...
module.identity_center.data.aws_identitystore_user.admin: Read complete after 0s [id=b17b2500-e0b1-7046-405b-23c088cf392b]

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

Terraform will perform the following actions:

  # cloudflare_r2_bucket.sccache[0] will be destroyed
  # (because index [0] is out of range for count)
  - resource "cloudflare_r2_bucket" "sccache" {
      - account_id    = "9eefbe6bc92d11b2bb4e962494765a4c" -> null
      - creation_date = "2026-11-08T20:59:18.644Z" -> null
      - id            = "er-ci-sccache" -> null
      - jurisdiction  = "default" -> null
      - location      = "ENAM" -> null
      - name          = "er-ci-sccache" -> null
      - storage_class = "Standard" -> null
    }

  # cloudflare_r2_bucket_lifecycle.sccache[0] will be destroyed
  # (because index [0] is out of range for count)
  - resource "cloudflare_r2_bucket_lifecycle" "sccache" {
      - account_id   = "9eefbe6bc92d11b2bb4e962494765a4c" -> null
      - bucket_name  = "er-ci-sccache" -> null
      - jurisdiction = "default" -> null
      - rules        = [
          - {
              - abort_multipart_uploads_transition = {
                  - condition = {
                      - max_age = 86400 -> null
                      - type    = "Age" -> null
                    } -> null
                } -> null
              - conditions                         = {
                    # (1 unchanged attribute hidden)
                } -> null
              - delete_objects_transition          = {
                  - condition = {
                      - max_age = 1209600 -> null
                      - type    = "Age" -> null
                    } -> null
                } -> null
              - enabled                            = true -> null
              - id                                 = "expire-cache-objects" -> null
            },
        ] -> null
    }

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

Changes to Outputs:
  - r2_sccache_bucket         = "er-ci-sccache" -> null
  - r2_sccache_endpoint       = "https://9eefbe6bc92d11b2bb4e962494765a4c.r2.cloudflarestorage.com" -> null

Warning: Resource Destruction Considerations

  with cloudflare_r2_bucket_lifecycle.sccache[0],
  on r2.tf line 96, in resource "cloudflare_r2_bucket_lifecycle" "sccache":
  96: resource "cloudflare_r2_bucket_lifecycle" "sccache" {

Applying this resource destruction will remove the resource from the
Terraform state but will not change it in the API. If you would like to
destroy or reset this resource in the API, refer to the documentation for how
to do it manually.
dev — 2 to add, 0 to change
module.eks.data.aws_iam_policy_document.cluster_trust: Reading...
module.eks.data.aws_iam_policy_document.node_trust: Reading...
data.aws_iam_policy_document.efs_csi_trust: Reading...
module.network.data.aws_availability_zones.available: Reading...
data.aws_iam_openid_connect_provider.github: Reading...
data.aws_iam_policy_document.efs_csi_trust: Read complete after 0s [id=819195744]
data.aws_iam_policy_document.er_api_pod_trust: Reading...
module.eks.data.aws_iam_policy_document.cluster_trust: Read complete after 0s [id=1029077455]
data.aws_iam_policy_document.er_api_pod_trust: Read complete after 0s [id=819195744]
module.eks.data.aws_iam_policy_document.node_trust: Read complete after 0s [id=2851119427]
data.aws_region.current: Reading...
data.aws_iam_policy_document.obs_pod_trust: Reading...
data.aws_region.current: Read complete after 0s [id=us-east-2]
data.aws_caller_identity.current: Reading...
data.aws_rds_engine_version.aurora_pg: Reading...
data.aws_iam_policy_document.obs_pod_trust: Read complete after 0s [id=819195744]
data.aws_iam_policy_document.eso: Reading...
data.aws_iam_policy_document.eso: Read complete after 0s [id=1725605485]
module.network.data.aws_region.current: Reading...
data.aws_iam_policy_document.eso_trust: Reading...
module.network.data.aws_region.current: Read complete after 0s [id=us-east-2]
data.aws_iam_policy_document.eso_trust: Read complete after 0s [id=819195744]
data.aws_caller_identity.current: Read complete after 0s [id=797781631727]
module.lake.data.aws_iam_policy_document.lake_tls_only: Reading...
data.aws_iam_policy_document.fluent_bit: Reading...
data.aws_iam_policy_document.otel_collector: Reading...
module.lake.data.aws_iam_policy_document.lake_tls_only: Read complete after 0s [id=2205495074]
data.aws_iam_policy_document.fluent_bit: Read complete after 0s [id=4006586444]
data.aws_iam_policy_document.otel_collector: Read complete after 0s [id=3111493560]
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=3442692123]
module.network.data.aws_availability_zones.available: Read complete after 0s [id=us-east-2]
data.aws_rds_engine_version.aurora_pg: Read complete after 0s [id=17.9]
data.aws_iam_policy_document.ci_deploy_dev: Reading...
data.aws_iam_policy_document.ci_deploy_dev: Read complete after 0s [id=1754478413]
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]

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:

  # aws_cloudwatch_metric_alarm.span_export_silence["api"] will be created
  + resource "aws_cloudwatch_metric_alarm" "span_export_silence" {
      + actions_enabled                       = true
      + alarm_actions                         = [
          + "arn:aws:sns:us-east-2:797781631727:er-alerts",
        ]
      + alarm_description                     = "er-api spans have been ending for 15 minutes with none exported — the #941 signature (a pod whose telemetry looks installed and exports nothing, self-healing only on restart). Check the er.telemetry.span_exports_failed counter and the pod log for 'OTLP span export batch failed'; if neither is present the wedge is in-process, between the batch processor and the wire. The divergence between the two input counters is the localization: ended>0/exported==0 = in-process, exports_failed rising = the collector or the network."
      + alarm_name                            = "er-dev-span-export-silence-api"
      + arn                                   = (known after apply)
      + comparison_operator                   = "GreaterThanThreshold"
      + datapoints_to_alarm                   = 3
      + evaluate_low_sample_count_percentiles = (known after apply)
      + evaluation_periods                    = 3
      + 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
      + treat_missing_data                    = "notBreaching"

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

          + metric {
              + dimensions  = {
                  + "er.role" = "api"
                }
              + metric_name = "er.telemetry.spans_ended"
              + namespace   = "ER/Dev"
              + period      = 300
              + stat        = "Maximum"
                # (1 unchanged attribute hidden)
            }
        }
      + metric_query {
          + id          = "exported"
          + return_data = false
            # (3 unchanged attributes hidden)

          + metric {
              + dimensions  = {
                  + "er.role" = "api"
                }
              + metric_name = "er.telemetry.spans_exported"
              + namespace   = "ER/Dev"
              + period      = 300
              + stat        = "Maximum"
                # (1 unchanged attribute hidden)
            }
        }
      + metric_query {
          + expression  = "IF(RATE(ended)>0 AND RATE(exported)==0, 1, 0)"
          + id          = "silence"
          + label       = "spans ending but none exported"
          + return_data = true
            # (1 unchanged attribute hidden)
        }
    }

  # aws_cloudwatch_metric_alarm.span_export_silence["dispatcher"] will be created
  + resource "aws_cloudwatch_metric_alarm" "span_export_silence" {
      + actions_enabled                       = true
      + alarm_actions                         = [
          + "arn:aws:sns:us-east-2:797781631727:er-alerts",
        ]
      + alarm_description                     = "er-dispatcher spans have been ending for 15 minutes with none exported — the #941 signature (a pod whose telemetry looks installed and exports nothing, self-healing only on restart). Check the er.telemetry.span_exports_failed counter and the pod log for 'OTLP span export batch failed'; if neither is present the wedge is in-process, between the batch processor and the wire. The divergence between the two input counters is the localization: ended>0/exported==0 = in-process, exports_failed rising = the collector or the network."
      + alarm_name                            = "er-dev-span-export-silence-dispatcher"
      + arn                                   = (known after apply)
      + comparison_operator                   = "GreaterThanThreshold"
      + datapoints_to_alarm                   = 3
      + evaluate_low_sample_count_percentiles = (known after apply)
      + evaluation_periods                    = 3
      + 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
      + treat_missing_data                    = "notBreaching"

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

          + metric {
              + dimensions  = {
                  + "er.role" = "dispatcher"
                }
              + metric_name = "er.telemetry.spans_ended"
              + namespace   = "ER/Dev"
              + period      = 300
              + stat        = "Maximum"
                # (1 unchanged attribute hidden)
            }
        }
      + metric_query {
          + id          = "exported"
          + return_data = false
            # (3 unchanged attributes hidden)

          + metric {
              + dimensions  = {
                  + "er.role" = "dispatcher"
                }
              + metric_name = "er.telemetry.spans_exported"
              + namespace   = "ER/Dev"
              + period      = 300
              + stat        = "Maximum"
                # (1 unchanged attribute hidden)
            }
        }
      + metric_query {
          + expression  = "IF(RATE(ended)>0 AND RATE(exported)==0, 1, 0)"
          + id          = "silence"
          + label       = "spans ending but none exported"
          + return_data = true
            # (1 unchanged attribute hidden)
        }
    }

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

…stify (#941)

An er-api pod exported zero spans for 40 minutes on 2026-11-08 while its
metrics flowed and its boot log said 'OTLP span export installed'. Nothing
paged, because nothing watched span volume per role; it was found by
accident during #660's live probe and self-healed on restart.

- er.telemetry.spans_ended (CountingProcessor beside the batch processor,
  so it keeps counting when the batch half is the broken one)
- er.telemetry.spans_exported / span_exports_failed (CountingExporter
  wrapper; a failed batch is a counter AND a tracing::warn in the pod log,
  the channel that survives telemetry being the broken part)
- er-dev-span-export-silence-{api,dispatcher}: RATE(ended)>0 AND
  RATE(exported)==0 for 15m. Self-referencing, so a quiet process never
  pages; task role excluded (flush-at-exit would false-alarm every long
  job)
- the divergence is the localisation: ended>0/exported==0 = in-process,
  failures rising = collector or network
…larms (#941)

The alarm count moves 3 -> 4 in the aws footprint (real drift), and the
failure description drops the literal macro spelling that put registry.rs
on the observability surface list — the generator greps prose too, and a
docstring is not an emitter.
… unattributed (#941)

The OTLP transform takes the resource from what the exporter was TOLD via
set_resource, not from each span — a wrapper answering with the trait's
default no-op ships every span with an empty resource: bytes arrive,
nothing is attributable, the span store reads exactly like the outage the
counters exist to catch. Both new tests were observed failing without the
delegation (the unit one on the batch thread's message ordering, the
integration one on the missing service.name in the payload).
…larm's replica assumption (#941)

pr-review, instrumentation dimension: the test comment said the batch
processor retries a refused export; SDK 0.31 logs and drops it — the drop
is why ended-minus-exported diverges at all. And the alarm file now states
the single-replica assumption its Maximum stat rests on, next to the bump
that would silently disarm it.
@athvin
athvin force-pushed the issue/941-span-export-guard branch from 9f770f3 to 462f6bb Compare November 9, 2026 01:41
@athvin
athvin marked this pull request as ready for review November 9, 2026 02:01
@athvin
athvin merged commit f64f03f into main Nov 9, 2026
46 checks passed
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.

er-api span export died silently for a whole pod lifetime — nothing alarms on absent spans

2 participants