Skip to content

docs(proxy): counters transfer as deltas across hot restart, not absolutes (#708) - #711

Merged
bpalermo merged 2 commits into
mainfrom
fix/708-counter-delta-semantics
Sep 5, 2026
Merged

bpalermo merged 2 commits into
mainfrom
fix/708-counter-delta-semantics

Conversation

@bpalermo

@bpalermo bpalermo commented Sep 5, 2026

Copy link
Copy Markdown
Owner

Closes #708 — not a bug.

HotRestartingParent::exportStatsToChild sends counter.latch() (the increment pending since the parent's last stats flush) and StatMerger::mergeCounters .add()s it: gauges transfer absolute, counters transfer as deltas.
The parent has been latching that pending increment away every stats_flush_interval (5s default; charts/aether sets none) for its whole life, so the child inherits only the last ≤5s of the parent's traffic.
The OTLP sink then exports counter.value() as CUMULATIVE with start_time_unix_nano = this process's start — an honest new cumulative series per Envoy generation, which is why sum(aether_requests_total) looks like it resets. Measured on talos-main 2026-09-05: every first post-restart sample was < 1 minute of that node's traffic, and plain envoy_cluster_upstream_cx_total resets in exactly the same buckets.

Changes

  • charts/aether/templates/agent-proxy-configmap.yaml — a "counter values are per-generation" note beside the existing tag-propagation note (it lives inside the rendered envoy.yaml), stating the mechanism, the consumer rule (never read a raw counter; rate()/increase() only) and why making the values continuous was rejected (report_counters_as_deltas is sink-wide, and the collector runs 2 replicas behind one Service). Chart 0.92.3 → 0.92.4.
  • docs/proposals/001_proxy-hot-restart.md — corrects the three over-stated claims ("stats carried over", "counters carry over", the "stat continuity" exit criterion): listen FDs and gauges carry over, counters as deltas only; the exit criterion becomes dip-free rate continuity. Cites the 2026-09-05 measurement.
  • docs/proposals/012_aether_stats_cpp_extension.md, 013_mesh-availability-prober.md — the per-generation caveat made explicit where aether_requests_total is described (013 also notes the prober's own counter has no such discontinuity, reinforcing why it is the SLI).
  • docs/runbook.md — the Transient cross-service mTLS identity mis-binding during concurrent proxy-restart + service roll (failed closed) #638 mismatch-counter query converted to increase(...[1h]).
  • proxy/.../aether_stats/tag_extraction_test.cc — mergeIntoChild now ships counter.latch() (what the parent actually sends), and a new CountersTransferAsDeltasNotAbsoluteValues case latches the parent counter (simulating the periodic flush), merges, and asserts the child holds only the post-latch residual — pinning delta transfer as an intentional invariant rather than a defect someone "fixes" later.

Query sites audited: the only raw-counter reads in scope were docs/runbook.md:344 and the validation snippet in 013. Repo has no Grafana dashboard JSON — the panels live in the GitOps repo (bpalermo/k8s-talos-main), out of scope here; docs/proposals/013 references the "Mesh Availability (synthetic)" row and the "Mesh Request Success Rate" panel, which are the ones to convert there. e2e/soak/README.md and e2e/pressure/run.sh already use rate()/increase() or before/after baselines on non-hot-restarting processes and were left alone.

helm lint charts/aether passes and helm template charts/aether still renders a parseable envoy.yaml; make format-check clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

bpalermo and others added 2 commits September 5, 2026 17:33
…lutes (#708)

`aether_requests_total` restarting near zero on every proxy roll is not a
bug. `HotRestartingParent::exportStatsToChild` sends `counter.latch()` — the
increment pending since the parent's last stats flush — and
`StatMerger::mergeCounters` `.add()`s it, so gauges transfer absolute but
counters transfer as DELTAS. The parent has been latching that pending
increment away every `stats_flush_interval` (5s default; the chart sets none)
for its whole life, so the child inherits only the last <=5s of traffic, and
the OTLP sink then exports `counter.value()` as CUMULATIVE from this process's
start — an honest new series per Envoy generation. Measured on talos-main
2026-09-05: every first post-restart sample was < 1 minute of that node's
traffic, and plain `envoy_cluster_upstream_cx_total` resets in the same
buckets.

- charts/aether: a "counter values are per-generation" note beside the
  tag-propagation note inside the rendered envoy.yaml, with the consumer rule
  (never read a raw counter; rate()/increase() only) and why making the values
  continuous was rejected. Chart 0.92.3 -> 0.92.4.
- docs/proposals/001: correct "stats carried over" / "counters carry over" /
  the "stat continuity" exit criterion — listen FDs and gauges carry over,
  counters as deltas only; cite the 2026-09-05 measurement.
- docs/proposals/012, 013: make the per-generation caveat explicit where
  `aether_requests_total` is described.
- docs/runbook.md: the #638 mismatch counter query -> increase() over a window.
- proxy tag_extraction_test: mergeIntoChild now ships `counter.latch()` (what
  the parent actually sends) and a new CountersTransferAsDeltasNotAbsoluteValues
  case latches the parent, merges, and asserts the child holds only the
  post-latch residual — pinning delta transfer as an intentional invariant.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
@bpalermo
bpalermo merged commit e62f0e6 into main Sep 5, 2026
17 checks passed
@bpalermo
bpalermo deleted the fix/708-counter-delta-semantics branch September 5, 2026 20:46
bpalermo added a commit that referenced this pull request Sep 5, 2026
…d tag (#692) (#713)

* fix(ci): serialise publishes and give the aether chart a commit-pinned tag (#692)

Two `publish` runs for consecutive merges to `main` raced on the same chart
version tag and the older build won: 0.92.1 was pushed by the newer commit
(95b158e) at 13:15:59Z and overwritten by the older one (77a7d45) four seconds
later, so the 13:16:27Z deploy silently shipped without #689.

Two independent causes, both fixed:

* `publish.yaml` had no `concurrency` group, so runs for `main` overlapped.
  Added `group: publish-main, cancel-in-progress: false` — a publish is not a
  redundant check to supersede; cancelling one mid-push would leave images
  pushed and the chart not.

  `proxy-release.yml` gets the same treatment for the same class of bug: its
  `bump-chart` job rewrites `charts/aether/values.yaml` on top of whatever
  `main` is at checkout and force-pushes the single rolling
  `chore/proxy-image-bump` branch, so overlapping runs drop one run's image pin.

  `main.yaml` (main-post-merge) deliberately gets none, and now says so: it
  writes no shared state, and serialising it would delay — or, via queued-run
  eviction, skip — the detection it exists to provide.

* The `aether` chart was published only under its bare `Chart.yaml` version, a
  tag that does not change per commit. It is now also published as
  `charts/aether:<X.Y.Z>-<full git sha>`, the scheme crds/prober/udsecho
  already use, via a second packaging of the same chart whose `Chart.yaml` is
  *derived* from the first (a genrule appends `-{GIT_COMMIT}`), so the two tags
  can never disagree about X.Y.Z. Only the chart is pushed for the commit tag —
  the images went up by digest with the bare push. The bare tag stays, for Flux
  and the documented deploy procedure, and is now safe because of the
  serialisation.

The documented deploy procedure (docs/runbook.md, docs/getting-started.md) now
pins the commit tag and, after `helm upgrade`, asserts that
`helm get metadata -n aether-system aether -o json | jq -r .appVersion`
contains the intended commit, failing otherwise — the only check that catches a
chart tag serving a different build than the one asked for. Substring, not
equality: appVersion is `git describe --tags --always --long --dirty
--abbrev=40`, so the sha can carry a `v1.2.3-N-g` prefix or a `-dirty` suffix.

Validated: `bazel build --stamp //charts/aether:aether //charts/aether:aether_commit`
produces `version: 0.92.4` and `version: 0.92.4-<40-char sha>` with the same
appVersion; `bazel test //charts/...` (9/9, including the new
`aether_commit_lint_test`) and `--config=lint //charts/...` pass;
`scripts/check-chart-version-bump.sh` passes on the 0.92.3 -> 0.92.4 bump; all
three edited workflows parse as YAML (actionlint not installed locally).

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

* chore(chart): bump aether chart to 0.92.5 after #711 took 0.92.4 (#692)

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

---------

Co-authored-by: Claude Fable 5.1 <[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.

aether_requests_total resets to ~0 on every proxy hot restart — counter values are not carried parent→child (labels are, since #707)

1 participant