Skip to content

feat(infra): the destination — one OpenObserve for every environment, dual export, and the log-level knob (telemetry P23/P9/P4) - #418

Merged
athvin merged 4 commits into
mainfrom
bm/telemetry-p23-destination
Nov 3, 2026
Merged

athvin merged 4 commits into
mainfrom
bm/telemetry-p23-destination

Conversation

@athvin

@athvin athvin commented Nov 3, 2026

Copy link
Copy Markdown
Owner

Eight phases have produced a full job → run → stage → statement span chain with 245 attributed statements, and all of it has had nowhere to go. This is the destination.

One store, every environment

Dev, prod and local all ship here; the environment is a field on the data (deployment.environment.name, already a resource attribute), not a separate stack.

That follows the account model this repo already has — a single account where environments are separated by name prefix and permission set rather than by account — so a per-environment observability stack would re-split exactly what that model treats as one place. The bucket and role live in envs/core; only the Pod Identity association lives in envs/dev, because it names a cluster.

Answering D-OTEL clause by clause, rather than ignoring it

"Four stateful services to operate and back up for a two-person team, running on the same cluster and competing for the nodes §5.3 sized for 141 GiB of spill. An observability stack that degrades when the system it observes gets busy is worse than none."

Clause Answer
four stateful services One. Parquet in S3, metadata in the Postgres this account already runs. Nothing new is stateful → no PVC, no StatefulSet. Upstream dropped its etcd requirement, which is what made this one service instead of four.
competing for spill nodes No runner toleration, so the scheduler cannot place it on a tainted node. Fluent Bit tolerates that taint because it must collect from those nodes; a store has no such reason.
degrades under load An ingest spike hits object storage, not a local disk, so the failure mode is bounded by S3 rather than by a volume filling under the thing being observed.

And that is why it can hold logs too

§8.5 rejected SaaS log backends because "logs are the signal that could carry record values" — which is why §10.5 splits the signals. A self-hosted store on our own S3 in our own account is in-account by construction, so that boundary doesn't apply.

Fluent Bit gains an OpenObserve output beside its CloudWatch one, so logs land in the same store as the traces. Without that, traces would be here and logs in CloudWatch: two places, the opposite of the point.

Both outputs stay, past any trial period — one shared store is one point of failure, and a fallback is only a fallback while it's still connected. The audit trails never move (CloudTrail + Postgres tables, D-RETENTION): a compliance artifact must not depend on a service we operate.

Two things verified rather than assumed, each of which would have shipped broken

The chart version I first pinned does not exist. 0.14.3 was from memory; helm search repo gives 1.0.x–1.1.3. A pin to a nonexistent version fails at install, not at review.

The values file was written against a guessed schema. The real chart has no envFrom, uses service.http_port not service.port, and takes credentials through auth:. Four keys would have been silently ignored — the worst failure mode for a values file, since nothing complains and the setting just doesn't apply. Rewritten against helm show values; every key verified present.

That second finding forced a better decision: the chart offers no existing-secret indirection, so auth: {} stays empty and make obs-up injects the root credentials and metadata DSN from Secrets Manager at install time. The S3 keys stay permanently unset — the pod signs with Pod Identity, and deliberately carries no eks.amazonaws.com/role-arn annotation, because that's the IRSA convention and this account uses Pod Identity everywhere (§9).

Tail sampling, with the trap written down

tail_sampling goes before batch — batching first would hand the sampler fragments of traces. Always keep: pipeline runs, errors, slow requests, every mutation, every impersonation. Head-sample the GET read path at 10%, where the volume is.

It requires every span of a trace to reach one collector instance. replicaCount: 1 is load-bearing for that, and scaling to 2 splits traces across sampling decisions with no error anywhere. The fix is a two-tier gateway with a loadbalancing exporter keyed on trace id — not a replica bump. Both facts are now stated in the values file, where someone would otherwise scale it.

Retiring the Python wiring, and the knob it never provided

templates/instrumentation.yaml and otel.autoInstrument are deleted. The CR injected a Python agent into a pod that has run a Rust binary since the all-Rust cutover, targeting a deployment-api.yaml that no longer exists, behind an annotation no template carried. It could never have worked — and it read as though §10.6 Phase 1 were done while both pipelines had zero producers.

In its place the chart finally carries the environment-configured log level §10.4 has always specified and no chart has ever had: RUST_LOG (empty = the compiled DEFAULT_FILTER, which already pins the noisy dependencies) plus OTEL_EXPORTER_OTLP_ENDPOINT, so the exporter becomes a no-deploy change.

ER_RESOURCE_CLASS reaches task pods as a Helm value, deliberately not an ${ER_…} placeholder: er_k8s::manifest::render_job refuses any placeholder it didn't substitute, so a placeholder there would fail every launch.

Status — read this before merging

terraform validate passes in both envs. helm template renders with ER_RESOURCE_CLASS resolving per class (L/M/S) and the endpoint reaching all eight env blocks.

Schema-verified, not runtime-verified. Nothing here has been applied to a cluster, so the first make obs-up is the real test. Two expected consequences:

  • The X-Ray exporter will log errors until CloudWatch Transaction Search is enabled on the account. That's noisy, not data loss — OpenObserve has the spans.
  • er/shared/openobserve must exist in Secrets Manager with root_email, root_password and meta_dsn before make obs-up will succeed.

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

terraform plan

8a17de8 · run log and full plans

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

core — 6 to add, 0 to change
data.aws_iam_policy_document.ci_tf_drift_refresh: Reading...
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_plan_state: Reading...
module.identity_center.data.aws_ssoadmin_instances.this: Reading...
data.aws_iam_policy_document.obs_pod_trust: Reading...
data.aws_iam_policy_document.ci_tf_apply_no_prod_state: Read complete after 0s [id=2395007408]
data.aws_iam_policy_document.ci_tf_plan_state: Read complete after 0s [id=2883378100]
data.aws_iam_policy_document.obs_pod_trust: Read complete after 0s [id=819195744]
data.aws_iam_policy_document.audit_bucket: Reading...
data.aws_iam_policy_document.audit_bucket: Read complete after 0s [id=3031279952]
module.github_oidc.data.aws_iam_policy_document.trust: Reading...
data.aws_iam_policy_document.cur_delivery: Reading...
data.aws_iam_policy_document.config_bucket: Reading...
module.github_oidc.data.aws_iam_policy_document.trust: Read complete after 0s [id=4060172364]
data.aws_iam_policy_document.sccache_write: Reading...
data.aws_iam_policy_document.config_bucket: Read complete after 0s [id=4067691321]
data.aws_iam_policy_document.cur_delivery: Read complete after 0s [id=2207400467]
data.aws_iam_policy_document.sccache_write: Read complete after 0s [id=786296009]
data.aws_iam_policy_document.sccache_read: Reading...
data.aws_iam_policy_document.sccache_read: Read complete after 0s [id=2701062528]
data.aws_iam_policy_document.sccache_trust_read: Reading...
data.aws_iam_policy_document.sccache_trust_write: Reading...
data.aws_iam_policy_document.sccache_trust_read: Read complete after 0s [id=1630650595]
data.aws_iam_policy_document.ci_tf_drift_trust: Reading...
data.aws_iam_policy_document.ci_tf_plan_trust: Reading...
data.aws_iam_policy_document.ci_tf_apply_trust: Reading...
data.aws_iam_policy_document.sccache_trust_write: Read complete after 0s [id=4060172364]
module.github_oidc.data.aws_iam_policy_document.push: Reading...
data.aws_iam_policy_document.ci_tf_apply_trust: Read complete after 0s [id=2538345208]
data.aws_iam_policy_document.ci_tf_drift_trust: Read complete after 0s [id=2357770959]
module.github_oidc.data.aws_iam_policy_document.push: Read complete after 0s [id=2177873069]
data.aws_iam_policy_document.ci_tf_plan_trust: Read complete after 0s [id=1630650595]
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 1s [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:
  + create
 <= read (data resources)

Terraform will perform the following actions:

  # data.aws_iam_policy_document.openobserve will be read during apply
  # (config refers to values not yet known)
 <= data "aws_iam_policy_document" "openobserve" {
      + id            = (known after apply)
      + json          = (known after apply)
      + minified_json = (known after apply)

      + statement {
          + actions   = [
              + "s3:AbortMultipartUpload",
              + "s3:DeleteObject",
              + "s3:GetObject",
              + "s3:ListMultipartUploadParts",
              + "s3:PutObject",
            ]
          + effect    = "Allow"
          + resources = [
              + (known after apply),
            ]
          + sid       = "SpanObjects"
        }
      + statement {
          + actions   = [
              + "s3:GetBucketLocation",
              + "s3:ListBucket",
              + "s3:ListBucketMultipartUploads",
            ]
          + effect    = "Allow"
          + resources = [
              + (known after apply),
            ]
          + sid       = "SpanList"
        }
    }

  # aws_iam_role.openobserve will be created
  + resource "aws_iam_role" "openobserve" {
      + arn                   = (known after apply)
      + assume_role_policy    = jsonencode(
            {
              + Statement = [
                  + {
                      + Action    = [
                          + "sts:TagSession",
                          + "sts:AssumeRole",
                        ]
                      + Effect    = "Allow"
                      + Principal = {
                          + Service = "pods.eks.amazonaws.com"
                        }
                    },
                ]
              + Version   = "2012-10-17"
            }
        )
      + create_date           = (known after apply)
      + force_detach_policies = false
      + id                    = (known after apply)
      + managed_policy_arns   = (known after apply)
      + max_session_duration  = 3600
      + name                  = "er-openobserve"
      + name_prefix           = (known after apply)
      + path                  = "/"
      + tags_all              = {
          + "Environment" = "core"
          + "ManagedBy"   = "terraform"
          + "Project"     = "entity-resolution"
        }
      + unique_id             = (known after apply)

      + inline_policy (known after apply)
    }

  # aws_iam_role_policy.openobserve will be created
  + resource "aws_iam_role_policy" "openobserve" {
      + id          = (known after apply)
      + name        = "span-store-objects"
      + name_prefix = (known after apply)
      + policy      = (known after apply)
      + role        = (known after apply)
    }

  # aws_s3_bucket.obs will be created
  + resource "aws_s3_bucket" "obs" {
      + acceleration_status         = (known after apply)
      + acl                         = (known after apply)
      + arn                         = (known after apply)
      + bucket                      = "er-obs-797781631727"
      + bucket_domain_name          = (known after apply)
      + bucket_namespace            = (known after apply)
      + bucket_prefix               = (known after apply)
      + bucket_region               = (known after apply)
      + bucket_regional_domain_name = (known after apply)
      + force_destroy               = false
      + hosted_zone_id              = (known after apply)
      + id                          = (known after apply)
      + object_lock_enabled         = (known after apply)
      + policy                      = (known after apply)
      + region                      = "us-east-2"
      + request_payer               = (known after apply)
      + tags_all                    = {
          + "Environment" = "core"
          + "ManagedBy"   = "terraform"
          + "Project"     = "entity-resolution"
        }
      + website_domain              = (known after apply)
      + website_endpoint            = (known after apply)

      + cors_rule (known after apply)

      + grant (known after apply)

      + lifecycle_rule (known after apply)

      + logging (known after apply)

      + object_lock_configuration (known after apply)

      + replication_configuration (known after apply)

      + server_side_encryption_configuration (known after apply)

      + versioning (known after apply)

      + website (known after apply)
    }

  # aws_s3_bucket_lifecycle_configuration.obs will be created
  + resource "aws_s3_bucket_lifecycle_configuration" "obs" {
      + bucket                                 = (known after apply)
      + expected_bucket_owner                  = (known after apply)
      + id                                     = (known after apply)
      + region                                 = "us-east-2"
      + transition_default_minimum_object_size = "all_storage_classes_128K"

      + rule {
          + id     = "expire-telemetry"
          + status = "Enabled"
            # (1 unchanged attribute hidden)

          + abort_incomplete_multipart_upload {
              + days_after_initiation = 3
            }

          + expiration {
              + days                         = 30
              + expired_object_delete_marker = false
            }

          + filter {
                # (1 unchanged attribute hidden)
            }
        }
    }

  # aws_s3_bucket_public_access_block.obs will be created
  + resource "aws_s3_bucket_public_access_block" "obs" {
      + block_public_acls       = true
      + block_public_policy     = true
      + bucket                  = (known after apply)
      + id                      = (known after apply)
      + ignore_public_acls      = true
      + region                  = "us-east-2"
      + restrict_public_buckets = true
    }

  # aws_s3_bucket_server_side_encryption_configuration.obs will be created
  + resource "aws_s3_bucket_server_side_encryption_configuration" "obs" {
      + bucket = (known after apply)
      + id     = (known after apply)
      + region = "us-east-2"

      + rule {
          + blocked_encryption_types = (known after apply)
          + bucket_key_enabled       = (known after apply)

          + apply_server_side_encryption_by_default {
              + kms_master_key_id = (known after apply)
              + sse_algorithm     = "AES256"
            }
        }
    }

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

Changes to Outputs:
  + obs_bucket                = "er-obs-797781631727"
  + openobserve_role_arn      = (known after apply)
dev — 4 to add, 1 to change
data.aws_iam_policy_document.efs_csi_trust: Reading...
data.aws_rds_engine_version.aurora_pg: Reading...
data.aws_iam_policy_document.er_api_pod_trust: Reading...
data.aws_iam_openid_connect_provider.github: Reading...
module.network.data.aws_region.current: Reading...
module.eks.data.aws_iam_policy_document.node_trust: Reading...
data.aws_iam_policy_document.efs_csi_trust: Read complete after 0s [id=819195744]
module.eks.data.aws_iam_policy_document.cluster_trust: Reading...
module.eks.data.aws_iam_policy_document.node_trust: Read complete after 0s [id=2851119427]
module.eks.data.aws_iam_policy_document.cluster_trust: Read complete after 0s [id=1029077455]
data.aws_region.current: Reading...
module.network.data.aws_region.current: Read complete after 0s [id=us-east-2]
data.aws_iam_policy_document.er_api_pod_trust: Read complete after 0s [id=819195744]
data.aws_iam_policy_document.obs_pod_trust: Reading...
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_iam_policy_document.eso: Reading...
data.aws_iam_policy_document.eso: Read complete after 0s [id=1725605485]
data.aws_caller_identity.current: Reading...
data.aws_iam_policy_document.eso_trust: Reading...
module.network.data.aws_availability_zones.available: Reading...
data.aws_iam_policy_document.eso_trust: Read complete after 0s [id=819195744]
data.aws_iam_policy_document.otel_collector: Reading...
data.aws_iam_policy_document.otel_collector: Read complete after 0s [id=3111493560]
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...
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.bedrock_invoke: Reading...
data.aws_iam_policy_document.bedrock_invoke: Read complete after 0s [id=3601248236]
data.aws_iam_policy_document.s3_user: Reading...
data.aws_iam_policy_document.s3_user: Read complete after 0s [id=3442692123]
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_rds_engine_version.aurora_pg: Read complete after 0s [id=17.9]
data.aws_iam_policy_document.ci_deploy_dev_trust: Read complete after 0s [id=4060172364]
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
  ~ update in-place

Terraform will perform the following actions:

  # aws_eks_pod_identity_association.openobserve will be created
  + resource "aws_eks_pod_identity_association" "openobserve" {
      + association_arn      = (known after apply)
      + association_id       = (known after apply)
      + cluster_name         = "er-dev"
      + disable_session_tags = false
      + external_id          = (known after apply)
      + id                   = (known after apply)
      + namespace            = "observability"
      + region               = "us-east-2"
      + role_arn             = "arn:aws:iam::797781631727:role/er-openobserve"
      + service_account      = "openobserve"
      + tags_all             = {
          + "Environment" = "dev"
          + "ManagedBy"   = "terraform"
          + "Project"     = "entity-resolution"
        }
    }

  # aws_iam_role_policy.ci_deploy_dev will be updated in-place
  ~ resource "aws_iam_role_policy" "ci_deploy_dev" {
        id          = "er-ci-deploy-dev:deploy-dev"
        name        = "deploy-dev"
      ~ policy      = jsonencode(
          ~ {
              ~ Statement = [
                    # (3 unchanged elements hidden)
                    {
                        Action   = [
                            "secretsmanager:GetSecretValue",
                            "secretsmanager:DescribeSecret",
                        ]
                        Effect   = "Allow"
                        Resource = "arn:aws:secretsmanager:us-east-2:797781631727:secret:er/dev/shared/postgres-*"
                    },
                  + {
                      + Action   = [
                          + "secretsmanager:GetSecretValue",
                          + "secretsmanager:DescribeSecret",
                        ]
                      + Effect   = "Allow"
                      + Resource = "arn:aws:secretsmanager:us-east-2:797781631727:secret:er/shared/openobserve-*"
                    },
                    {
                        Action   = [
                            "ecr:ListImages",
                            "ecr:GetAuthorizationToken",
                            "ecr:DescribeImages",
                            "ecr:BatchGetImage",
                        ]
                        Effect   = "Allow"
                        Resource = "*"
                    },
                ]
                # (1 unchanged attribute hidden)
            }
        )
        # (2 unchanged attributes hidden)
    }

  # aws_secretsmanager_secret.openobserve will be created
  + resource "aws_secretsmanager_secret" "openobserve" {
      + arn                            = (known after apply)
      + description                    = "Root credentials and metadata DSN for the shared span store; consumed by scripts/obs_up.sh (and the CI deploy that calls it)."
      + force_overwrite_replica_secret = false
      + id                             = (known after apply)
      + name                           = "er/shared/openobserve"
      + name_prefix                    = (known after apply)
      + policy                         = (known after apply)
      + recovery_window_in_days        = 30
      + region                         = "us-east-2"
      + tags_all                       = {
          + "Environment" = "dev"
          + "ManagedBy"   = "terraform"
          + "Project"     = "entity-resolution"
        }
    }

  # aws_secretsmanager_secret_version.openobserve will be created
  + resource "aws_secretsmanager_secret_version" "openobserve" {
      + arn                  = (known after apply)
      + has_secret_string_wo = (known after apply)
      + id                   = (known after apply)
      + region               = "us-east-2"
      + secret_arn           = (known after apply)
      + secret_id            = (known after apply)
      + secret_string        = (sensitive value)
      + secret_string_wo     = (write-only attribute)
      + version_id           = (known after apply)
      + version_stages       = (known after apply)
    }

  # random_password.openobserve_root will be created
  + resource "random_password" "openobserve_root" {
      + bcrypt_hash      = (sensitive value)
      + id               = (known after apply)
      + length           = 32
      + lower            = true
      + min_lower        = 2
      + min_numeric      = 2
      + min_special      = 2
      + min_upper        = 2
      + number           = true
      + numeric          = true
      + override_special = "!#$%*()-_=+[]{}<>:?"
      + result           = (sensitive value)
      + special          = true
      + upper            = true
    }

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

Changes to Outputs:
  + openobserve_secret_arn       = (known after apply)

@athvin
athvin force-pushed the bm/telemetry-p23-destination branch from 1b13624 to 8983fe7 Compare November 3, 2026 01:37
athvin added a commit that referenced this pull request Nov 3, 2026
…ry (#422)

Every Rust PR opened after #376 fails to compile, on a commit that has nothing
to do with it:

    error: failed to run custom build command for `libduckdb-sys v1.20000.1`
    panicked at build_bundled_cc.rs:65:
      unpacking bundled DuckDB sources: Os { code: 39, kind: DirectoryNotEmpty }

`libduckdb-sys` unpacks the bundled C++ sources into its `OUT_DIR` and panics
if that directory is not empty. The saved `target/` carries a populated
`debug/build/libduckdb-sys-<hash>/out`; on restore cargo re-runs the build
script but does not clear the directory, so every job that compiles duckdb
dies before a single test runs.

## Why it looked like the PR's fault

Main's run for #376 went GREEN — all twelve test and e2e jobs. Its jobs
restored the PRE-bump entry, and `lint`, the single writer, only saved the
poisoned one at the end of the run. So the breakage never lands on the commit
that caused it; it lands on every PR afterwards.

That asymmetry cost real time on #418 (an infra-only PR with no Rust in it, so
six Rust failures made no sense). The sequence that eventually distinguished
"my change" from "the cache" was: another open PR passing the same gate →
`git diff HEAD~1 -- Cargo.lock` showing no new crates → main's run for the bump
having run the identical jobs green. Each step eliminated a hypothesis that
otherwise looks plausible. The one that looked right and was not: "the PR lost
a race with main's cache write, so just re-run" — it fails identically on a
re-run, because the poisoned entry is the one being restored, not a missing one.

#417 appears unaffected only because it touches CI files, so `detect` skips its
Rust tier entirely.

## The fix is the lever the file already documents

"`prefix-key` makes the v0 entries unreachable (restore-keys are prefixed too)
so they age out instead of being downloaded for nothing." Same situation, same
remedy: v1 -> v2, so no partial restore can resurrect the poisoned entry. One
cold cycle, then normal.

All EIGHT occurrences move together — the `lint` writer and the seven
restore-only jobs. Bumping only the writer would leave every other job
restoring v1, which is the broken state with extra steps.

## Not fixed here, deliberately

`.github/workflows/shared/rust-gate.md` and the two `*.lock.yml` files
generated from it still carry `v1-rust`, so the agentic workflows will hit the
same panic. They are not required checks, so this is noise rather than a block
— and their lock files are generated artifacts, which I am not going to
hand-edit. Bumping the `.md` and recompiling with gh-aw belongs to whoever owns
that workflow.

Co-authored-by: bmoore813 <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
bmoore813 and others added 3 commits November 2, 2026 20:58
… dual export, and the log-level knob (telemetry P23/P9/P4)

Eight phases have produced a full `job -> run -> stage -> statement` span chain
with 245 attributed statements, and all of it has had nowhere to go. This is
the destination.

## One store, every environment

Dev, prod and local all ship here; the environment is a FIELD on the data
(`deployment.environment.name`, already a resource attribute), not a separate
stack. That follows the account model this repo has — a single account where
environments are separated by name prefix and permission set rather than by
account — so a per-environment observability stack would re-split exactly what
that model already treats as one place. The bucket and role therefore live in
`envs/core`; only the Pod Identity association lives in `envs/dev`, because it
names a cluster.

## Answering D-OTEL rather than ignoring it

D-OTEL rejected self-hosting: "Four stateful services to operate and back up
for a two-person team, running on the same cluster and competing for the nodes
§5.3 sized for 141 GiB of spill."

- **Not four services.** Parquet in S3, metadata in the Postgres this account
  already runs. Nothing new is stateful, so no PVC and no StatefulSet.
  Upstream dropped its etcd requirement, which is what made this one service
  instead of four.
- **It cannot compete with the runner nodes.** No runner toleration, so the
  scheduler cannot place it on a tainted spill node. Fluent Bit tolerates that
  taint because it must collect FROM those nodes; a store has no such reason.
- **An ingest spike hits object storage, not a local disk**, so the
  degrade-under-load mode is bounded by S3 rather than by a volume filling
  under the thing being observed.

## And this is why it can hold logs too

§8.5 rejected SaaS log backends because "logs are the signal that could carry
record values" — which is why §10.5 splits the signals. A SELF-HOSTED store on
our own S3 in our own account is in-account by construction, so that boundary
does not apply. Fluent Bit gains an OpenObserve output BESIDE its CloudWatch
one, so logs land in the same store as the traces. Without that, traces would
be here and logs in CloudWatch: two places, which is the opposite of the point.

Both outputs stay, past any trial period: one shared store is one point of
failure, and a fallback is only a fallback while it is still connected. The
audit trails never move — CloudTrail and Postgres tables (D-RETENTION) — because
a compliance artifact must not depend on a service we operate.

## Two things verified rather than assumed, each of which would have shipped broken

- **The chart version I first pinned does not exist.** `0.14.3` was from
  memory; `helm search repo` gives 1.0.x–**1.1.3**. A pin to a nonexistent
  version fails at install, not at review.
- **The values file was written against a guessed schema.** The real chart has
  no `envFrom`, uses `service.http_port` not `service.port`, and takes
  credentials through `auth:`. Four keys would have been **silently ignored** —
  the worst failure mode for a values file. Rewritten against
  `helm show values`, every key verified present.

That second finding forced a better decision: the chart offers no
existing-secret indirection, so `auth: {}` stays empty and `make obs-up`
injects the root credentials and metadata DSN from Secrets Manager at install
time. The S3 keys stay permanently unset — the pod signs with Pod Identity, and
deliberately carries no `eks.amazonaws.com/role-arn` annotation, because that
is the IRSA convention and this account uses Pod Identity everywhere (§9).

## Tail sampling, with the trap written down

The collector gains `tail_sampling` before `batch` (batching first would hand
the sampler fragments of traces). Always keep: pipeline runs, errors, slow
requests, every mutation, every impersonation. Head-sample the GET read path at
10%, where the volume is.

It requires every span of a trace to reach ONE collector instance.
`replicaCount: 1` is load-bearing for that, and scaling to 2 splits traces
across sampling decisions **with no error anywhere** — the fix is a two-tier
gateway with a `loadbalancing` exporter keyed on trace id, not a replica bump.
Both are now stated in the values file where someone would otherwise scale it.

## Retiring the Python wiring, and the knob it never provided

`templates/instrumentation.yaml` and `otel.autoInstrument` are deleted. The CR
injected a PYTHON agent into a pod that has run a Rust binary since the
all-Rust cutover, targeting a `deployment-api.yaml` that no longer exists,
behind an annotation no template carried. It could never have worked, and it
read as though §10.6 Phase 1 were done while both pipelines had zero producers.

In its place the chart finally carries the environment-configured log level
§10.4 has always specified and no chart has ever had: `RUST_LOG` (empty means
the compiled `er_obs::init::DEFAULT_FILTER`, which already pins the noisy
dependencies) plus `OTEL_EXPORTER_OTLP_ENDPOINT`, so the exporter becomes a
no-deploy change.

`ER_RESOURCE_CLASS` reaches task pods as a Helm value, deliberately NOT an
`${ER_…}` placeholder: `er_k8s::manifest::render_job` refuses any placeholder it
did not substitute, so a placeholder there would fail every launch.

## Status

`terraform validate` passes in both envs; `helm template` renders with
`ER_RESOURCE_CLASS` resolving per class and the endpoint reaching all eight env
blocks. **Schema-verified, not runtime-verified** — nothing here has been
applied to a cluster, so the first `make obs-up` is the real test. The X-Ray
exporter will log errors until CloudWatch Transaction Search is enabled on the
account; that is noisy rather than data loss, because OpenObserve has the spans.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…s Terraform mints

Follow-up to the destination commit, closing the gap between "written" and
"running". The stack was `make obs-up`-only — hand-installed, in no GitOps
loop, invisible to the drift check — and the span store needed a secret someone
had to create by hand first. Neither is true now.

`er/shared/openobserve` is a Secrets Manager entry with a generated root
password and the metadata DSN built from the Aurora endpoint, so there is no
manual step before the first deploy. It lives in `envs/dev` rather than beside
the bucket in `envs/core` for one reason: the DSN names a Postgres, and the only
Postgres in this account is the dev Aurora. The STORE is shared; its metadata
happens to live in the one database that exists.

OpenObserve creates its own tables on first boot, and a dedicated `openobserve`
database would need a CREATE DATABASE this stack has no connection to run — so
it shares `er` under its own tables. Still unreachable from a tenant's
credentials (a tenant gets `er_t_<org>`), and one less bootstrap step.

`scripts/obs_up.sh` is called by BOTH `make obs-up` and the CI deploy job, for
the reason `images.yml` already gives about namespace provisioning: "so CI and a
human provision a namespace identically rather than by two drifting paths".
Chart versions are pinned in the script and nowhere else.

Ordering is load-bearing: the store installs BEFORE the collector, because the
collector's traces pipeline exports to it. Reversed, the collector simply logs
connection errors until the store lands.

The step is deliberately NOT `continue-on-error`. A telemetry stack that
silently fails to install is worse than a red deploy, because the absence of
spans reads as "nothing happened" rather than as a broken deploy.

`er-ci-deploy-dev` is scoped to `er/dev/<namespace>/*`, so `er/shared/openobserve`
would have been AccessDenied on the first real run. The existing policy already
explains why the tempting fix is wrong: `er/dev/shared/*` would also grant read
of `er/dev/shared/builder`, which holds the temporary never-expiring
AdministratorAccess key (builder.tf) — "turning a namespace deploy role into a
path to account admin for anything that can run on `main`". So this grant names
the one secret exactly, the same way that one does.

`scripts/obs_up.sh` joins the workflow's trigger paths: a change to the
installer IS a dev platform release, for the same reason a chart change is.

Terraform applies the bucket, role, Pod Identity association and secret on
merge; `deploy-dev` then runs the installer and the store comes up with the
collector pointed at it. That takes the stack from schema-verified to actually
running, which is the only way the remaining exporter work can be verified
rather than asserted.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
`plan (dev)` failed: "reading IAM Role (er-openobserve): couldn't find
resource". A `data "aws_iam_role"` resolves at PLAN time, core and dev plan
in the same CI run, and the role is created by core — so dev could never plan
until core had already applied. That is a chicken-and-egg that red-lights the
PR permanently, not the "right order of operations to enforce" an earlier
version of this comment claimed.

A constructed ARN is plan-safe because it is a string. The cost is that a
missing role surfaces at APPLY rather than at plan, which is the better place
for it: apply is where the dependency actually matters, and envs/core applies
before envs/dev in the same workflow. eks.tf constructs the one ARN it needs
from core the same way.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
athvin pushed a commit that referenced this pull request Nov 3, 2026
#418 sets OTEL_SERVICE_NAMESPACE on both the deployments and the task
template. It is not an OTLP SDK variable — the spec carries service.namespace
inside OTEL_RESOURCE_ATTRIBUTES — so the value was shipped to no effect.

Reading it here is cheaper than changing the chart and leaves one spelling
rather than two, and service.namespace is worth having: it is what separates
this product from anything else that ever writes to the one shared store.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@athvin
athvin merged commit 879380a into main Nov 3, 2026
43 checks passed
@athvin
athvin deleted the bm/telemetry-p23-destination branch November 3, 2026 03:12
athvin added a commit that referenced this pull request Nov 3, 2026
… link (telemetry P6b) (#429)

* feat(obs): spans leave the process — OTLP over the reqwest we already link

The exporter er-obs was shaped for. `init` still always installs the structured
stderr layer; when an OTLP endpoint is configured it additionally installs a
`tracing-opentelemetry` bridge, so the span tree that already exists in-process
starts arriving somewhere it can be queried.

Opt-in by the presence of an endpoint rather than opt-out by a flag, because
`er-entity` and `dedupe` are build tools and every test binary in the workspace
calls `init`. `Option<Layer>` is itself a `Layer`, so with no endpoint the
exporter is absent from the subscriber rather than installed-and-disabled.

## The deferral reason was real and did not survive re-measurement

init.rs argued the exporter could not land because `opentelemetry-otlp`'s
`reqwest-rustls` feature resolves a second `reqwest` and selects `aws-lc-rs`,
pulling an `aws-lc-sys` that needs a cmake the build image lacks. That was
right about the feature it tested and wrong as a verdict on the exporter:
supplying our own HTTP client avoids the client features entirely.

Re-measured on this branch — zero `aws-lc-sys`, one `reqwest` (0.12.28),
rustls still on `ring`, 12 new lock entries and no second HTTP or TLS stack.
`tonic` is among them because `opentelemetry-proto` depends on it
unconditionally, but without `transport`, which is why no new `hyper` appears.
It is a protobuf codec here, not a gRPC stack.

## The trap, and why the test sends real bytes

The SDK's batch processor owns a plain std::thread and polls the exporter future
on it with a non-tokio executor, so an async `reqwest::Client` panics there with
`there is no reactor running`. That panic does NOT fail the process — it is on
the processor's thread, so `main` runs on and every span is silently dropped.
Observed while building this.

So `ReqwestClient` hands each request to a single-worker runtime this module
owns, which works whether or not the caller has one: the API and dispatcher are
`#[tokio::main]`, the `er` CLI and `exec-task` deliberately are not.
tests/otlp_export.rs asserts on **bytes received by a listener** in both shapes,
because a provider that merely builds proves nothing — the first version built
fine and exported nothing. Verified by reintroducing the bug: the no-runtime
test fails with that exact panic.

One guess recorded as wrong rather than quietly dropped: `block_on` instead of
`spawn` was expected to fail the in-runtime case. It passes both, because the
SDK always polls on its own thread. `spawn` is kept for having one fewer
assumption, and the tests say they do not discriminate the two.

## Flush

`Guard::force_flush` gains a body and `Drop` gains a flush-then-shutdown, so
every normally-returning path is covered. `exec-task` is not one of those:
`std::process::exit` does not run destructors, so main.rs flushes explicitly
before exiting. A pod exits immediately after its last span, and the tail of
every run — including every failure — depends on it.

Failures degrade to "no telemetry" throughout and are never propagated.
Observation must not change a run, and this code runs from the first statement
of `main`, where an error is a pod that will not boot for an unrelated reason.

`make check` passes.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* feat(obs): honour the chart's OTEL_SERVICE_NAMESPACE, which nothing read

#418 sets OTEL_SERVICE_NAMESPACE on both the deployments and the task
template. It is not an OTLP SDK variable — the spec carries service.namespace
inside OTEL_RESOURCE_ATTRIBUTES — so the value was shipped to no effect.

Reading it here is cheaper than changing the chart and leaves one spelling
rather than two, and service.namespace is worth having: it is what separates
this product from anything else that ever writes to the one shared store.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

---------

Co-authored-by: bmoore813 <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
athvin added a commit that referenced this pull request Nov 3, 2026
…y deploying it (#441)

#418 landed the span store and it had never run anywhere. The CI deploy job
that would have rendered it was being cancelled by images.yml's concurrency
before it started, and `make obs-up` failed on its first line for anyone on a
Mac. So nothing had ever executed these values. Deploying them for real found
five defects, in order of discovery:

1. **`make obs-up` was broken on macOS.** macOS ships bash 3.2, where
   expanding an EMPTY array under `set -u` is an "unbound variable" error;
   bash 4.4+ (every CI runner) treats it as nothing. `"${ctx[@]}"` is now
   `${ctx[@]+"${ctx[@]}"}` in all seven places. This is the entire human half
   of the "one script, two callers" promise the script opens with.

2. **The chart could not render.** `replicaCount: 1` — the distributed chart
   wants an OBJECT keyed by role, so it failed with `can't evaluate field
   scheduler in type interface {}`.

3. **The chart was the wrong chart.** `openobserve/openobserve` renders a
   workload per role (ingester, querier, router, scheduler, compactor, o2ai×2)
   and defaults to a NATS subchart plus a BUNDLED Postgres — about ten pods on
   a cluster with 4 total vCPU, beside er-api, er-dispatcher, the collector,
   Fluent Bit, the operator and external-secrets. The values file meanwhile
   said "Not four services" and set `ZO_NODE_ROLE: all`, which is single-node
   — a design the chart cannot express. Replaced with a plain Deployment, and
   `ZO_LOCAL_MODE` corrected from "false" (cluster mode, which REQUIRES the
   NATS coordinator) to "true" with `ZO_LOCAL_MODE_STORAGE: s3`, which is
   single node with remote storage.

4. **Fluent Bit sent empty credentials.** Its output authenticates with
   `HTTP_User ${OPENOBSERVE_USER}` from the ENVIRONMENT, and the values file
   had no `env:` at all — so every push was a 401, twice a second, visible
   only in OpenObserve's access log. Measured before: 401 on every POST;
   after: 108×200 and 0 failures.

5. **The collector sent an empty Authorization header.** Same shape, worse
   failure: it logs `Configuration references unset environment variable
   OPENOBSERVE_AUTH` ONCE and then runs happily, so every span would have been
   a silent 401. Now wired from the same secret; the warning is gone.

Plus the deprecation the first successful install printed: the collector chart
renamed `otlphttp` to `otlp_http` and still auto-rewrites the old spelling
while announcing that auto-rewrite will be removed. Renamed now rather than
discovering it on a chart bump.

## Verified end to end, not merely deployed

A synthetic OTLP span posted to the collector in-cluster, then read back out:

    hits: 1
    trace_id        ddcbb6ccc9d57dee68238f2c1f1a3ab4
    service_name    er-task
    operation_name  db.query
    er_statement    entity_membership.read.member_keys

So `OTLP -> collector -> tail_sampling -> otlp_http/openobserve -> queryable`
works, and `er.statement` survives as a searchable field. The span carried
`status.code: ERROR` deliberately, so the `errors` sampling policy kept it
rather than leaving the result to the 10% residual.

OpenObserve runs as one pod, 1/1, `/healthz` 200, no NATS and no bundled
Postgres. Logs are flowing (5,254 docs, storage_type s3, 19 objects in the
bucket).

Co-authored-by: bmoore813 <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
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