Skip to content

docs(observability): a staleness-safe registrar divergence rule; say which ext_authz counters exist - #1328

Merged
bpalermo merged 2 commits into
mainfrom
fix/1322-1325-observability
Oct 7, 2026
Merged

bpalermo merged 2 commits into
mainfrom
fix/1322-1325-observability

Conversation

@bpalermo

@bpalermo bpalermo commented Oct 7, 2026

Copy link
Copy Markdown
Owner

Docs and one rule file. No behaviour change in any binary (the only Go edit is a comment in registrar/internal/server/metrics.go).

#1322: the divergence expression

The runbook's expression counted hashes over the bare aether_registrar_snapshot_content selector. content_hash is a label, so a content change ends one series and starts another. The registrar stops exporting the old one, but OTLP has no staleness marker, so Prometheus returns it for the 5-minute lookback and every replica shows two hashes after every change.

It had a second fault: aether_registrar_writebehind_queue_depth is recorded only when an intent is queued or flushed. Until the first one the series is missing (it is missing on talos-main now), and on() (max(...) == 0) is empty, and the expression cannot be true at all.

New expression, in the runbook and as AetherRegistrarSnapshotDiverged in the new docs/observability/registrar-alerts.yml:

count by (job, revision) (
  count_values by (job, content_hash) (
    "revision",
    aether_registrar_snapshot_revision
    * ignoring (content_hash) group_right ()
    (
      aether_registrar_snapshot_content
      and
      (
        timestamp(aether_registrar_snapshot_content)
        == ignoring (content_hash) group_left ()
        max without (content_hash) (timestamp(aether_registrar_snapshot_content))
      )
    )
  )
) > 1
unless on (job) (max by (job) (aether_registrar_writebehind_queue_depth) > 0)
  • The timestamp() filter keeps, per replica, the content series with the newest sample. A superseded hash is in the lookback but older.
  • The multiplication and count_values label that series with the replica's revision, so hashes are counted per revision and a lagging replica is not compared.
  • unless ... > 0 is quiet only when a pending intent is actually reported.

On live Prometheus over the soak window (8 h to 2026-10-06T23:02:13Z, 15 s steps, 1,920 samples) the old expression's first two clauses return a sample at 386 steps and the new one at 0.

Where the test is

This repo has no promtool in its build, and docs/observability/*.yml are validated where they are deployed. The unit tests are in bpalermo/k8s-talos-main#152 (clusters/talos-main/prometheus/rules_test.yaml, promtool 3.6.0):

Case Expect
two replicas, same revision, same hash quiet
same revision, different hash, no queue-depth series fires after for: 3m
both replicas change hash; old series stale but inside the lookback quiet at every step, and the old expression is pinned to return a sample there
one replica a revision behind quiet
same revision, different hash, write-behind intent pending quiet

Not done: one series per replica at the source

The registrar already exports one series per replica; the second one is Prometheus's lookback, and the OTel Go SDK has no way to send a staleness marker for an attribute set an observable gauge stopped reporting. The source fix that would work is a gauge whose value is the hash (the top 52 bits fit a float64 exactly), which has no label to go stale. That is a new metric and a rule migration, so it is left as a follow-up.

#1325: which ext_authz counters exist

New runbook paragraph under "The ext_authz sidecar across a proxy roll":

  • …_ext_authz_timeout_total does not exist because Envoy's HTTP ext_authz filter has no timeout counter (ALL_EXT_AUTHZ_FILTER_STATS at the pinned 726d7ac). A timed-out check is counted in error.
  • …_ext_authz_failure_mode_allowed_total is a real counter that is incremented only when the filter runs fail-open. With the default failureMode: DENY it never is, and Envoy's OTLP sink exports a counter only once it was used.
  • Neither the proxy's stats_matcher (an exclusion list with no ext_authz pattern) nor the collector drops these names.

The alert change (remove the timeout arm) and the kube-state-metrics additions are in bpalermo/k8s-talos-main#152, so this PR only references #1325.

Proof

  • bazel test //registrar/internal/server:all: 1/1 pass
  • bazel build --config=lint --@aspect_rules_lint//lint:fail_on_violation //...: clean
  • make format-check: clean
  • promtool check rules docs/observability/registrar-alerts.yml: 1 rule

Closes #1322
Refs #1325

🤖 Generated with Claude Code

https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

…which ext_authz counters exist

#1322: the runbook's "same revision, two content hashes" expression counted
hashes over the bare aether_registrar_snapshot_content selector. content_hash
is a label, so a content change ends one series and starts another, and with
no OTLP staleness marker Prometheus returns the superseded series for its
5-minute lookback. Every content change read as a divergence for 5 minutes.
Its queue-depth clause was also empty (so the expression could never be true)
on a registrar that had never queued a write-behind intent.

The new expression keeps, per replica, the content series with the newest
timestamp(), labels it with the replica's revision and counts hashes per
revision. It ships as AetherRegistrarSnapshotDiverged in
docs/observability/registrar-alerts.yml. This repo has no promtool in its
build, so the unit tests are in the GitOps repo's rules_test.yaml.

#1325: document in the runbook that a missing ext_authz series means "never
happened" (the OTLP sink exports a counter only once used), that
failure_mode_allowed needs fail-open, and that Envoy's HTTP ext_authz filter
has no timeout counter at all.

Closes #1322
Refs #1325

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Prometheus absence semantics are misstated and existing canary documentation contradicts the new counter guidance.

Review effort: Balanced
Findings: 1 Low severity

Open (1)
What changed in this PR

Adds staleness-safe registrar divergence alerting guidance and documents available Envoy ext_authz counters.

Changes:

  • Adds AetherRegistrarSnapshotDiverged.
  • Documents Prometheus lookback handling and rule behavior.
  • Clarifies ext_authz counter availability.
File Description
registrar/​internal/​server/​metrics.go Documents stale hash-series behavior.
docs/​runbook.md Adds divergence queries and counter guidance.
docs/​observability/​registrar-alerts.yml Defines the divergence alert.
docs/​observability/​README.md Documents alert purpose and installation.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread docs/runbook.md
Comment on lines +2686 to +2690
- There is **no `timeout` counter**. Envoy's HTTP `ext_authz` filter does not define one
(checked at the pinned Envoy, `ALL_EXT_AUTHZ_FILTER_STATS` in
`source/extensions/filters/http/ext_authz/ext_authz.h`). A check that exceeds
`proxy.authzSidecar.timeout` is counted in `error`. Do not gate on
`…_ext_authz_timeout_total`: it reads as a clean zero forever.
Copilot AI balanced review requested due to automatic review settings October 7, 2026 01:17

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

The ext_authz guidance contains inaccurate absent-series wording and leaves contradictory chart documentation.

Review effort: Balanced
Findings: 1 Low severity

Open (1)

@bpalermo
bpalermo merged commit 11f1497 into main Oct 7, 2026
31 checks passed
@bpalermo
bpalermo deleted the fix/1322-1325-observability branch October 7, 2026 01:30
bpalermo added a commit that referenced this pull request Oct 7, 2026
…1329) (#1346)

aether.registrar.snapshot.content carries the hash as a label. A content
change ends one series and starts another, OTLP has no staleness marker for
a series an observable gauge stopped reporting, and Prometheus keeps
returning the superseded hash for its 5-minute lookback. #1328 worked
around that in the divergence rule with a timestamp() filter.

Add aether.registrar.snapshot.content_hash, whose VALUE is the hash: the
first 13 hex digits (52 bits) of the content hash, an integer a float64
holds exactly. One series per replica, no label that changes. The
conversion lives in common/snapshotversion (ContentHashValue) next to the
version parser. The gauge is observed in the same callback, from the same
Snapshot.State(), as the revision gauges, on every backend and in every
version form.

The labelled metric is deprecated and kept for one release so a rule on it
keeps working while replicas of both images run.

docs: AetherRegistrarSnapshotDiverged is now a plain count of distinct
values per (job, revision); the runbook has the by-hand query, the bit
budget, how the two metrics arrive, and the two-arm rule for the upgrade.

Closes #1329


Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

Co-authored-by: Claude Opus 5.5 <[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.

runbook/alerting: a plain PromQL 'same revision, two content hashes' check false-positives on aether_registrar_snapshot_content

2 participants