Skip to content

feat(proxy): access-log rows carry the proxy generation and connection timing (#1333) - #1370

Merged
bpalermo merged 2 commits into
mainfrom
feat/accesslog-generation-timing
Oct 7, 2026
Merged

bpalermo merged 2 commits into
mainfrom
feat/accesslog-generation-timing

Conversation

@bpalermo

@bpalermo bpalermo commented Oct 7, 2026

Copy link
Copy Markdown
Owner

Closes #1333

What changes

Every HTTP access-log row (log_name:aether_access_logs), on both reporters, gains five attributes. The L4 record (aether_l4_access_logs) gains proxy_epoch only.

attribute format string
proxy_epoch %ENVIRONMENT(AETHER_RESTART_EPOCH)%
connection_id %CONNECTION_ID%
ds_cx_age_ms %COMMON_DURATION(DS_CX_BEG:DS_RX_BEG:ms)%
ds_hs_ms %COMMON_DURATION(DS_CX_BEG:DS_HS_END:ms)%
us_tx_beg_ms %COMMON_DURATION(DS_RX_BEG:US_TX_BEG:ms)%

Why: a hot-restart parent stops flushing stats to sinks when its child starts, so no metric label can separate the two generations of an overlap. An access-log row is written by one process, so the generation goes there, together with what the connection had cost before the request.

proxy_epoch reads the variable the supervisor exports in #1366. The two pull requests merge in either order: until a proxy's supervisor exports it, the field reads - and nothing else changes.

Checked against the pinned Envoy (726d7ac)

Read in the source:

  • The operator and time-point names exist as spelled (stream_info_formatter.{h,cc}).
  • An unknown time-point name is not rejected. It becomes a dynamic time point that nothing sets, and renders -.
  • %ENVIRONMENT% reads the variable once, when the formatter is built, and renders - when it is unset.
  • DS_CX_BEG falls back to the request's own start when the connection start is unknown, so ds_cx_age_ms would read 0, not -.

Measured, by a new live test (//agent/test/mtlspool, TestAccessLogConnectionTiming). It takes production's access logger, unmodified, out of the listeners NewInboundListener and NewInboundQUICListener build, puts it on an mTLS listener and an HTTP/3 listener of a destination Envoy, sends requests through a source Envoy (the production h2 cluster, then a production quic: twin), and reads the rows from an OTLP logs receiver inside the test. Two requests ride one connection, 400 ms apart:

path proxy_epoch connection_id ds_cx_age_ms ds_hs_ms us_tx_beg_ms protocol
TLS, epoch 7 7 / 7 2 / 2 11 / 414 6 / 6 0 / 0 HTTP/2
QUIC, epoch 3 3 / 3 8708995993204622487 (both) 8 / 411 5 / 5 0 / 0 HTTP/3
TLS, variable unset - / - 2 / 2 9 / 412 5 / 5 0 / 0 HTTP/2

So the HTTP/3 connection manager does see the QUIC session's start and handshake end. The scoping pass had inferred that; this is the evidence. Every attribute arrives as an OTLP string.

Red, then green: with DS_HS_END misspelled as DS_HS_EMD, envoy --mode validate still accepted all eleven generated bootstraps, and the live test failed on all three paths with ds_hs_ms rendered "-", not a number. Restored, it passes: 30 of 30 serial runs, and under --config=race.

One thing to know when reading connection_id: for a TCP connection it is a small per-process counter, for a QUIC connection a 64-bit number. It is unique within one Envoy process only, so pair it with the node and proxy_epoch.

Other tests

  • agent/internal/xds/proxy: the exact strings on both reporters, and proxy_epoch alone on the L4 record.
  • agent/test/envoy_validate: the generated bootstraps still validate; TestGeneratedAccessLogsCarryGenerationAndTiming reads the same bytes and pins the keys on every access logger in them (mTLS inbound, HTTP/3 inbound, outbound, capture, and the capture tcp_proxy chains).

Pipeline and graders

Read, not changed:

  • Collector (k8s-talos-main, clusters/talos-main/otel-collector/values.yaml). The logs pipeline is memory_limiter, batch, then VictoriaLogs and the count/aether_identity connector. The connector reads reporter, cluster_name, node_name, source_spiffe_id, upstream_cluster, upstream_peer_uri_san, upstream_host and downstream_peer_uri_san. No processor keeps or drops attributes by name. The new names collide with none of these, and the L4 record still has no reporter.
  • VictoriaLogs. Stream fields are k8s.namespace.name,k8s.pod.name,service.name, so the new attributes are ordinary fields and add no streams.
  • In this repository. e2e/eastwest-quic-hotrestart.sh parses the collector's debug output by attribute name with the pattern [a-z_]+; the new names fit it and it selects fields by name. The soak graders in e2e/soak/README.md are LogsQL queries on named fields. docs/observability/ has no access-log field reference.

Not verified: the rows in the live VictoriaLogs (nothing was deployed), and a source-reporter row rendered live. The live test reads destination rows only; the source side uses the same strings, and that its ds_hs_ms reads - is inferred from the source (no TLS handshake on a cleartext downstream), not run.

Cost

About 105 bytes per row, which is about +8 % raw access-log volume on talos-main (about 12 M rows on an idle day, 23 M on a soak day). These are the scoping estimates, not a new measurement. It applies to both reporters. A QUIC destination row costs roughly 15 bytes more than that, because of the longer connection_id.

Option for the reviewer: ds_hs_ms should always be - on a source row (the application speaks cleartext to its proxy), and limiting the timing fields to the destination reporter would about halve the cost. This pull request keeps them on both, as designed, because connection_id, ds_cx_age_ms and us_tx_beg_ms do carry information on the source side.

Docs

docs/runbook.md, new section "Reading a hot-restart overlap": what the stats do during an overlap, what each new field means, example queries, and what the fields cannot show (time a SYN or a datagram waited in the kernel before Envoy read it). The L4 field list and the investigator agent's field list name the new fields. Proposal 014 is left as history.

No chart change, no proxy release, no GitOps change.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

…n timing (#1333)

Every HTTP access-log row (both reporters) gains five attributes:

  proxy_epoch    %ENVIRONMENT(AETHER_RESTART_EPOCH)%
  connection_id  %CONNECTION_ID%
  ds_cx_age_ms   %COMMON_DURATION(DS_CX_BEG:DS_RX_BEG:ms)%
  ds_hs_ms       %COMMON_DURATION(DS_CX_BEG:DS_HS_END:ms)%
  us_tx_beg_ms   %COMMON_DURATION(DS_RX_BEG:US_TX_BEG:ms)%

and the L4 (tcp_proxy) record gains proxy_epoch.

A hot-restart parent stops flushing stats to sinks when its child starts,
so no metric label can separate the two generations of an overlap. An
access-log row is written by one process, so the generation belongs there.
proxy_epoch renders "-" until the supervisor exports the variable.

Envoy accepts a %COMMON_DURATION% time point it does not know and renders
"-", so `envoy --mode validate` cannot catch a typo. A live test in
//agent/test/mtlspool runs production's inbound access logger on an mTLS
and on an HTTP/3 listener of the pinned Envoy and asserts the fields are
numbers, that two requests on one connection share connection_id and
ds_hs_ms, and that ds_cx_age_ms grows by the gap between them.

Runbook: "Reading a hot-restart overlap".

Closes #1333

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
Copilot AI balanced review requested due to automatic review settings October 7, 2026 22:46

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.

🟢 Approval recommended

The implementation matches the stated logging contract and includes comprehensive unit, generated-config, and live protocol coverage.

0 open findings

What changed in this PR

Adds proxy-generation and connection-timing context to Envoy access logs for diagnosing hot-restart overlaps.

Changes:

  • Adds five HTTP access-log attributes and proxy_epoch to L4 logs.
  • Adds unit, bootstrap-validation, and live TLS/QUIC coverage.
  • Documents field semantics and investigation queries.
File Description
.claude/​agents/​aether-investigator.md Updates investigator log-field guidance.
docs/​runbook.md Documents overlap analysis and new fields.
agent/​internal/​xds/​proxy/​BUILD.bazel Adds test dependency.
agent/​internal/​xds/​proxy/​accesslog.go Emits generation and connection timing fields.
agent/​internal/​xds/​proxy/​accesslog_test.go Verifies exact HTTP and L4 formats.
agent/​test/​envoy_validate/​BUILD.bazel Registers bootstrap field validation.
agent/​test/​envoy_validate/​accesslog_fields.go Extracts access-log formats from bootstraps.
agent/​test/​envoy_validate/​accesslog_fields_test.go Checks all generated logger fields.
agent/​test/​mtlspool/​BUILD.bazel Registers live test and dependencies.
agent/​test/​mtlspool/​accesslog_timing_test.go Validates live TLS and QUIC rendering.

🧠 Review effort: Balanced


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

Copilot AI balanced review requested due to automatic review settings October 7, 2026 23:20

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.

🟢 Approval recommended

The logging changes are consistent and backed by comprehensive unit, generated-config, and live protocol tests.

0 open findings

🧠 Review effort: Balanced

@bpalermo
bpalermo merged commit 43adee7 into main Oct 7, 2026
31 checks passed
@bpalermo
bpalermo deleted the feat/accesslog-generation-timing branch October 7, 2026 23:39
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.

observability: node-level CPU is not attributable on talos-main (no CPU by mode, no /podruntime or /system cgroups, cAdvisor for aether-* only)

2 participants