Skip to content

fix(chart, observability): registrar, controller and edge control-plane replicas are separate series by default, and the shipped rules read only fresh samples (#1560) - #1642

Merged
bpalermo merged 2 commits into
mainfrom
fix/1560-replica-instance-fresh-rules
Oct 10, 2026

Conversation

@bpalermo

Copy link
Copy Markdown
Owner

Closes #1560

What was wrong

The registrar, the controller and the edge control plane set no resource attribute that a metrics backend maps to a per-replica label by itself. A pipeline that promoted nothing per replica stored all replicas of a component as one series, and AetherRegistrarSnapshotDiverged, which compares hashes across replica series, could never fire.

The obvious fix (service.instance.id=$(POD_NAME)) was tried in #1595 and taken out: the metrics are pushed over OTLP, there is no staleness marker, so after a roll a replaced pod's last sample stays in Prometheus's 5-minute lookback beside its replacement's, and the shipped rules, which aggregate over replicas, read a pod that is gone.

This pull request ships both halves together.

1. Chart 2.5.3 (charts/aether)

service.instance.id=$(POD_NAME) in OTEL_RESOURCE_ATTRIBUTES on the registrar, the controller and the agent container of the edge Deployment. The edge proxy container already had it.

Rendered with --set controller.webhook.spire=true,edge.enabled=true,otel.enabled=true,otel.endpoint=…, before (2.5.2) and after (2.5.3):

Workload, container Before After
registrar k8s.pod.name=$(POD_NAME),k8s.namespace.name=$(POD_NAMESPACE) service.instance.id=$(POD_NAME),k8s.pod.name=$(POD_NAME),k8s.namespace.name=$(POD_NAMESPACE)
controller the same as the registrar's the same as the registrar's
edge, agent k8s.node.name=$(NODE_NAME),k8s.namespace.name=…,k8s.pod.name=…,k8s.pod.uid=…,k8s.deployment.name=… service.instance.id=$(POD_NAME), followed by the same
edge, proxy unchanged (already service.instance.id=$(POD_NAME)) unchanged

Nothing else in the render differs except the helm.sh/chart label on object metadata. Pod templates compared per workload: the three Deployments change; the agent, mesh-dns, proxy and uds-csi DaemonSets do not.

What rolls on upgrade: the registrar, the controller and (when enabled) the edge Deployment, once each. The variable is rendered whether or not otel.endpoint is set, so this is on every install, and there is no value to turn it off. No DaemonSet rolls and no Envoy restarts on the nodes.

Not set on the per-node DaemonSets on purpose: their series are told apart by the node, which is stable across a roll.

Tests (charts/aether/BUILD.bazel), red against the unchanged templates first:

  • aether_resource_attributes_test (was …_unchanged_test): every workload's whole OTEL_RESOURCE_ATTRIBUTES, so the DaemonSets are pinned as they were.
  • aether_replica_instance_id_default_values_test: the same for the registrar and the controller with default values.

2. Shipped rules (docs/observability)

Every selector in agent-pin-alerts.yml (four rules) and registrar-alerts.yml (three metrics) is wrapped:

last_over_time(<selector>[150s])

the newest sample of each series, if it is at most 150 s old, in place of the 5-minute lookback of a bare selector.

Why 150 s. These components export every 60 s: the OTel SDK's periodic reader at its default interval (common/telemetry/setup/setup.go passes no interval, and the chart sets no OTEL_METRIC_EXPORT_INTERVAL).

  • Above 120 s, so a live pod that loses one export is still read until the next one lands (two intervals, plus 30 s for the export's 10 s timeout and pipeline delay). Shorter, and a lost export makes a firing alert resolve and restart its for:.
  • Below 180 s, the shortest for: of those rules, so one last sample of a pod that is gone is never an alert by itself.

Rules changed

Rule File
AetherMeshClusterUnpinned, AetherMeshClusterPinPending, AetherProxyHoldsUnpinnedClusters, AetherProxyPinStateUnknown agent-pin-alerts.yml
AetherRegistrarSnapshotDiverged (hash, revision and the unless on queue depth) registrar-alerts.yml

Rules left as they are, and why

  • AetherProxyRejectedListenerUpdate (agent-xds-alerts.yml): it reports an event of the last hour from a counter. increase() over a series that ended still counts what it counted, and the second arm is already limited to a series' first hour; a window would only end a true alert sooner. The window would not help the pinned surge-roll limit either: there the two node agents write ONE series, and no selector can tell their samples apart. That needs a per-pod label on the node agent, which this change does not add. New test cases say what a series per edge pod changes for this rule.
  • mesh-dns-alerts.yml, agent-cni-alerts.yml: they read the per-node DaemonSets (and the prober's counter by rate()), whose series gain no label here and keep their identity across a roll.

Proof

bazel test //:observability_rules_test. The roll case is the issue's: an old pod's series end at minute 9, its replacement's start at minute 10, one sample a minute.

Case Unchanged rules With the window
AetherMeshClusterUnpinned: old edge pod's last export reported 1, replacement reports 0 fires at 12m, 13m quiet
the same rule firing on the old pod, replacement reports 0 still firing at 12m ends at 12m
the same rule firing, replacement reports it too figure 2 at 12m, 13m stays firing, figure 1 from 12m
AetherMeshClusterPinPending firing on the old pod still firing at 12m ends at 12m
the two 15-minute rules firing on the old pod (last sample 25m) still firing at 28m end at 28m
AetherRegistrarSnapshotDiverged: a replaced registrar's last hash is not its revision's fires at 12m, 13m quiet
the same rule: live replicas diverge from 10m, a replaced registrar last reported queue depth 3 fires at 17m fires at 15m
the same rule firing, the odd replica replaced by one that agrees still firing at 12m ends at 12m
two live replicas with different hashes fires at 3m fires at 3m
a live pod or replica that misses an export read still read (alert does not flap)

registrar-alerts_test.yml is new (the rule had no test in this repository). The existing cases of the other two files pass unchanged.

Mutation check of the window (both rule files, then restored): [90s] and [120s] fail the missed-export cases; [5m] fails the roll cases; no window is the red-first run above. [180s] passes: on a one-minute grid a sample exactly 180 s old is outside a left-open range, so the tests bound the window to more than 120 s and at most 180 s, not to 150 s exactly.

Limits, pinned in the tests or stated in the files

  • A pod whose last two exports reported an unpinned cluster is read for 60 s + 150 s, and AetherMeshClusterUnpinned (for: 3m) fires for one evaluation after the pod is gone (limit - a replaced pod's last two samples fire for one evaluation). With bare selectors it fired for three.
  • A replaced registrar's last non-zero write-behind depth still delays a real divergence, by the window (two minutes in the test) instead of the lookback.
  • A rejection before an edge pod's first export ends five minutes after that pod is replaced, not an hour after (agent-xds-alerts_test.yml, a limit case).

What an operator sees on upgrade

  • Update the rule files first. The new ones are correct against chart 2.5.2. Rule files of an earlier release under chart 2.5.3 fire AetherMeshClusterUnpinned and AetherRegistrarSnapshotDiverged falsely after a roll of the edge or the registrar. The chart cannot check which rules are installed.
  • The three Deployments roll once.
  • Their series gain instance="<pod name>". The series without it receive no more samples. A panel that does not aggregate shows one line per pod, and at every later roll old lines end and new ones start.
  • An aggregation of your own over a gauge of these components counts a replaced pod for five minutes after a roll unless wrapped the same way.
  • A pipeline must not drop service.instance.id / instance from these series.

docs/runbook.md, "Chart 2.5.3", has the order of work and the queries to run after the roll. docs/observability/metric-labels.md and README.md are updated (what each component sets, what must not be dropped, the window and its reasons, installing the rules with the chart).

Measured and not

Measured: the rule behaviour above, with the pinned promtool; the render and the per-workload pod-template comparison, with helm template.

Not run on a cluster. Not measured: counters across the label change (a sum(rate()) can read low around the roll), and delivery delay between a component's export and the store, which the 30 s of margin in the window is for.

Checks run

bazel test //charts/... //:observability_rules_test //test/harnesscontract:checks, bazel build --config=lint --@aspect_rules_lint//lint:fail_on_violation //..., make format-check. The external-harness contract is unchanged (no workload, container or label name of the chart moved).

🤖 Generated with Claude Code

https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

bpalermo and others added 2 commits October 10, 2026 10:31
…ne replicas are separate series by default, and the shipped rules read only a series whose last sample is fresh (#1560)

The registrar, the controller and the edge control plane set no resource
attribute a metrics backend maps to a per-replica label by itself, so their
replicas wrote one series and AetherRegistrarSnapshotDiverged could never fire.

Chart 2.5.3 sets service.instance.id=$(POD_NAME) on the three (the edge proxy
container already had it). Prometheus stores it as `instance`.

A pod name in a label makes every roll end one set of series and start
another, and a pushed series has no staleness marker: a bare selector returns
a replaced pod's last sample for five minutes. Every selector of
agent-pin-alerts.yml and registrar-alerts.yml is therefore wrapped in
last_over_time(...[150s]): 2.5 of the components' 60 s export intervals, so a
live pod that loses one export is still read, and below the shortest `for:`
(3m), so one last sample of a pod that is gone is never an alert.

registrar-alerts_test.yml is new; the pin and xDS rule tests gain the roll
cases. Red first against the unchanged rules; the window is mutation-checked
in both directions.

Closes #1560

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
@bpalermo
bpalermo merged commit 7ffd958 into main Oct 10, 2026
30 checks passed
@bpalermo
bpalermo deleted the fix/1560-replica-instance-fresh-rules branch October 10, 2026 14:34
bpalermo added a commit that referenced this pull request Oct 10, 2026
…cdf11d438dd7ff5b83 (#1644)

* chore(proxy): pin aether chart to aether-proxy:7ae32088c8fb9bdb176e55cdf11d438dd7ff5b83

Pushed by the proxy-release run for 7ae3208. Moves both tag: and digest: (aether.image prefers digest over tag) and bumps the chart patch version.

* chore(chart): the proxy image pin takes chart version 2.5.4; main already holds 2.5.3 (#1642)

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

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

chart: registrar and controller replicas set no attribute a metrics backend maps to a label on its own, so replicas can collapse into one series

1 participant