Repository navigation
chore: retire the aether_stats stats_tags regex workaround (#695 step 4) - #707
Merged
Merged
Conversation
…tart (envoy#45674) The aether_stats filter records via counterFromStatNameWithTags, which inlines the tag VALUES into the full stat name. Envoy's StatMerger used to re-create a merged counter with counterFromStatName() and NO tags, so after the node proxy's first hot restart the programmatic tags were gone and collapsed into the metric name (talos-main epoch 53). The chart papered over that with one stats_tags regex per programmatic key; tag_extraction_test asserted those regexes re-derived the seven keys from the merged name. envoyproxy/envoy#45674 — in the pinned proxy snapshot, runtime guard envoy.reloadable_features.hot_restart_propagate_stat_tags default on — makes the parent transmit the tag metadata (hot_restart.proto TaggedMetric / counter_tags) and the child re-create the counter via counterFromMergedStatName, so the tags survive natively. Rewrite the test around that invariant, with no aether_stats stats_tags regexes configured anywhere: - FreshCounterIsTagged: the filter's own counter is clean (bare aether.requests_total + seven label tags). - TagsSurviveHotRestartWithoutRegexes: a real FilterConfig::record() in a "parent" ThreadLocalStore, merged into a "child" store through StatMerger with the parent tag metadata exactly as HotRestartingChild::mergeParentStats builds it (including the runtime gate), yields a counter indistinguishable from the fresh one — same tagExtractedName, same tags — and the child's own post-restart write lands on that same counter rather than a mangled twin. Also asserts the runtime guard is on by default, so a re-pin that flipped it fails here. - TagsLostWhenPropagationDisabled: with the guard forced off no metadata is sent, the merged counter has zero tags and the values stay welded into the name — the pre-fix symptom, kept so the invariant means something. - RetainedChartRegexesStillExtract: the two regexes the chart keeps (aether.cluster, aether.pod) still extract from Envoy's own stat names, and no regex re-derives the programmatic keys any more. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
) The proxy is built from an Envoy snapshot that contains envoyproxy/envoy#45674 "hot restart: propagate programmatic stat tags across restart", whose runtime guard envoy.reloadable_features.hot_restart_propagate_stat_tags is default on. The hot restart parent now transmits each tagged stat's metadata and the child re-creates the counter with its tags, so aether_stats' seven programmatic tags (reporter, source_service, source_pod, destination_service, destination_pod, response_code, response_flags) survive a restart natively. Drop the seven stats_tags regexes that re-derived them from the flat stat name. aether.cluster and aether.pod stay: those are genuine regex-extracted tags from Envoy's own cluster.*/listener.* stat names, not part of the workaround. //source/extensions/filters/http/aether_stats:tag_extraction_test in the proxy workspace now guards the no-regex invariant. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
bpalermo
force-pushed
the
chore/695-retire-stats-tags-regexes
branch
from
September 5, 2026 19:26
ff418fd to
7214aa2
Compare
This was referenced Sep 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why the regexes existed
aether_stats(proposal 012) records one counter per request viacounterFromStatNameWithTags, which inlines the tag values into the fullstat name (
aether.requests_total.reporter.<v>.source_service.<v>.…). On thefilter's write path those are real Stats tags — but the node proxy hot-restarts
on every config change (talos-main reached epoch 53), and Envoy's
StatMergerre-created every merged counter via
counterFromStatName()with no tags("TODO(snowp): Propagate tag values during hot restarts"). After the first
restart the programmatic tags were gone and their values collapsed into the
metric name with empty labels — the talos-main symptom: series named
…aether.requests_total.reporter.source.…instead of one metric with labels.The workaround was seven
stats_tagsregexes in the proxy bootstrap, one perprogrammatic key, re-deriving the tags from the mangled name.
Why they can go now
The proxy is built from the Envoy
mainsnapshot pinned in #697, which containsenvoyproxy/envoy#45674 "hot restart: propagate programmatic stat tags across
restart". The parent now transmits each tagged stat's metadata
(
hot_restart.protoTaggedMetric/counter_tags) and the child re-createsthe counter through
counterFromMergedStatName, so the tags survive natively.Its runtime guard
envoy.reloadable_features.hot_restart_propagate_stat_tagsisa default-true
RUNTIME_GUARDat the pinned commit (13144fb).What changed
charts/aether/templates/agent-proxy-configmap.yaml: the seven programmaticregexes (
reporter,source_service,source_pod,destination_service,destination_pod,response_code,response_flags) are gone, replaced by ashort note pointing at envoy#45674 and the guarding test.
aether.clusterand
aether.podstay — those extract from Envoy's owncluster.*/listener.*stat names and were never part of the workaround.helm template charts/aethernow renders exactly twotag_nameentries.charts/aether/Chart.yaml: 0.92.2 → 0.92.3.proxy/.../aether_stats/tag_extraction_test.cc: rewritten around the newinvariant instead of the regex list.
What the new test guards
With no
aether_statsstats_tagsregexes configured anywhere:FreshCounterIsTagged— the filter's own counter is clean: tag-extracted nameaether.requests_totalplus seven label tags; the values are only inlined inthe flat name.
TagsSurviveHotRestartWithoutRegexes— a realFilterConfig::record()into a"parent"
ThreadLocalStoreImpl, then aStatMergermerge into a "child"store built exactly as
HotRestartingChild::mergeParentStatsbuilds it(counter delta +
StatMerger::TagsMapParentTags{base_name_, tags_},gated on the runtime guard). The merged counter has the same
tagExtractedNameand the same tag set as the fresh one, and the child'sown post-restart write resolves to that same counter (value 2, no poisoned
central-cache slot / mangled twin). It also asserts the guard is on by
default, so a future re-pin that flipped it fails here rather than on talos.
TagsLostWhenPropagationDisabled— the negative case that makes the abovemeaningful: with the guard forced off, no metadata is sent, the merged counter
has zero tags and
tagExtractedNameis the full mangled name containing.reporter..RetainedChartRegexesStillExtract— the two kept chart regexes still liftaether.cluster/aether.podout of Envoy's stat names, and extractionalone no longer recovers any programmatic key (propagation, not regex, is what
recovers them).
One thing the first CI run surfaced and the test now pins: the filter interns tag
values through a
StatNameDynamicPool, so the counter'sStatNamemixessymbolic and dynamic segments. The merge therefore has to carry the parent's
dynamic spans (
SymbolTable::getDynamicSpans, whichHotRestartingParent::exportStatsToChildtransmits) alongside the tag metadata —without them the child rebuilds an all-symbolic name and ends up with two
counters. Tags alone are not sufficient for the post-restart write to land on the
merged counter, and the test now proves both halves.
Upstream templates:
ProgrammaticTagsSurviveMerge/ProgrammaticTagsLostWithoutMetadataintest/common/stats/stat_merger_test.cc.talos validation recipe (for the main session)
# deploy 0.92.3, then force a hot restart on every node with NO regexes present kubectl -n aether-system rollout restart ds/aether-proxy kubectl -n aether-system rollout status ds/aether-proxyAfter the roll, in Grafana / Prometheus:
and assert the historical collapse symptom is absent — no series whose name
contains
.reporter.(e.g.count({__name__=~".*\\.reporter\\..*"})is empty).Refs #695 — deliberately not closing it: the re-pin to a
1.40.0.envoymoduleand the root
@envoy_binary_linux_*bump remain.🤖 Generated with Claude Code
https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr