Skip to content

feat(037): L4 observability — per-service tcp_/udp_ floor stat keys and the aether_l4_access_logs stream (#1023) - #1043

Merged
bpalermo merged 3 commits into
mainfrom
feat/1023-l4-observability
Sep 28, 2026
Merged

bpalermo merged 3 commits into
mainfrom
feat/1023-l4-observability

Conversation

@bpalermo

Copy link
Copy Markdown
Owner

Closes #1023

What / why

Until now every L4 cluster (the TCP floor, its primary-port alias, every per-port TCP cluster and the UDP floor) passed the bare <ns>/<svc> service key as alt_stat_name. For a service that also serves HTTP, they all reported into the same aether_cluster series as the HTTP cluster, so an ssl_fail_verify_san tick could not be assigned to a cluster kind. The #1007 attribution had to rule HTTP out from access logs, and an L4 hop had no access-log record at all.

This PR:

  • Per-kind L4 stat keys (agent/internal/xds/cache/capture.go, helpers in agent/internal/xds/proxy/egress.go):

    cluster (config name) aether_cluster
    TCP floor tcp:<fqdn> tcp_<ns>/<svc>
    TCP per-port / primary-port alias tcp:<fqdn>:<port> tcp_<ns>/<svc>_<port>
    UDP floor udp:<fqdn> udp_<ns>/<svc>
    HTTP default + aliases, QUIC twins unchanged (<ns>/<svc>, <ns>/<svc>@<ns>/<sa>)
  • A connection-level L4 access log, on its own OTLP stream log_name=aether_l4_access_logs (proxy/accesslog.go, attachL4AccessLog in proxy/capture.go). It goes on every capture tcp_proxy chain: floor, per-port, TCPRoute-weighted, the any-port shim, TLSRoute SNI chains and the blackhole. It writes one record when a connection closes. It keeps every connection with a response flag, plus the HTTP log's success sample, and uses the same switch (MeshConfig accessLogsEnabled) and the same sink. It deliberately has no reporter attribute, so it cannot enter the collector's HTTP identity counters. It is not attached to the passthrough chain or to UDP (there is no per-datagram log).

  • Tests: test/envoy_validate/l4_observability_test.go (real Envoy validation, including the chart's own tag regex run over the keys after sanitization), cache/l4_stat_keys_test.go, proxy/l4observability_test.go.

  • charts/aether 1.0.2 → 1.0.3. Runbook sections "L4 stat keys and the L4 access log" and the L4-hop join; the two L4 soak gates in e2e/soak/README.md; a note in proposal 037.

Naming: _, not :

Envoy sanitises every stat name and tag value (Stats::Utility::sanitizeStatsName rewrites : to _). A tcp:<ns>/<svc>:<port> key would therefore be exported as tcp_<ns>/<svc>_<port> anyway, and a selector written as tcp:.* would match nothing, forever. Aether now writes the sanitised form, so the config and the label are the same string. It is unambiguous because namespaces and service names are DNS labels and cannot contain _. The keys contain no dot, so the chart's ^cluster\.(([^.]+)\.) tag captures each key whole.

⚠️ BREAKING (observability)

A dashboard or alert that selects an L4 service by its bare key (for example aether_cluster="aether-test/tcp-echo") reads no series from a #1023 proxy onward. Move it to the new shapes:

  • tcp_<ns>/<svc>: TCP floor
  • tcp_<ns>/<svc>_<port>: TCP per-port or primary-port alias
  • udp_<ns>/<svc>: UDP floor

HTTP selectors (<ns>/<svc>, <ns>/<svc>(@.*)?) are unaffected and cannot match an L4 key.

Kind evidence (e2e/l4routes.sh, SPIRE on, etcd registry, plus a stand-in OTel collector with the debug exporter)

otel.endpoint was set via helm upgrade -f <get values> and MeshConfig accessLogsEnabled: true was patched in, then agent and proxy were restarted.

Regression net: e2e/l4routes.sh verify, all green:

==> all TCPRoute assertions passed (control, 75/25 band, mirrored weight-0 drain, all-drained floor, delete)
==> all TLSRoute assertions passed (control, SNI both directions, positive fall-through, delete)
==> all UDPRoute assertions passed (control, plaintext delivery with a weight-0 backend drained, per-VIP selection between two services, delete)

Proxy admin /stats after verify. UDP was sampled while T3's UDPRoute was live, because T3.2 deletes it:

cluster.tcp_aether-test/l4-front.upstream_cx_total: 120
cluster.tcp_aether-test/l4-a_9000.upstream_cx_total: 373
cluster.tcp_aether-test/l4-b_9000.upstream_cx_total: 267
cluster.tcp_aether-test/l4tls-front.upstream_cx_total: 153
cluster.tcp_aether-test/l4tls-a_9443.upstream_cx_total: 47
cluster.tcp_aether-test/l4tls-b_9443.upstream_cx_total: 40
cluster.udp_aether-test/l4udp-a.udp.sess_tx_datagrams: 70
cluster.udp_aether-test/l4udp-c.udp.sess_tx_datagrams: 30

/stats?filter=^cluster\.aether-test/l4 returned 0 lines: no L4 cluster reports under a bare key any more.

Collector, aether_l4_access_logs: 999 records over the run (TCP floor, TCPRoute-weighted and TLSRoute SNI chains):

Resource attributes: log_name=aether_l4_access_logs cluster_name=aether-proxy node_name=l4routes-control-plane
Body: - cap_tcp_tcp:l4-front.aether-test.aether.internal_9000 10.120.192.70:9000 -> tcp_aether-test/l4-front 10.20.0.13:18008 104ms
  pod_name=client-74785458b6-jmm7q  pod_namespace=aether-test
  source_spiffe_id=spiffe://aether.internal/ns/aether-test/sa/client
  filter_chain_name=cap_tcp_tcp:l4-front.aether-test.aether.internal_9000
  downstream_local_address=10.120.192.70:9000  upstream_cluster=tcp_aether-test/l4-front
  upstream_host=10.20.0.13:18008  requested_server_name=-
  upstream_peer_uri_san=spiffe://aether.internal/ns/aether-test/sa/l4-front
  response_flags=-  duration_ms=104  bytes_received=8  bytes_sent=14

TLSRoute record: filter_chain_name=cap_tls_…_1_p9443 requested_server_name=alpha.l4tls.test upstream_cluster=tcp_aether-test/l4tls-a_9443 upstream_peer_uri_san=…/sa/l4tls-a. UDP produces no L4 access-log record, by design; its evidence is the udp_ key above.

The kind run found one error in the docs, fixed in ba4272a. %UPSTREAM_CLUSTER% renders the cluster's alt_stat_name, so the log's upstream_cluster is the stat key (tcp_<ns>/<svc>[_<port>]), not the tcp:<fqdn> config name. The runbook's per-service LogsQL query upstream_cluster:~"^tcp:tcp-echo…" could never match; it is now written against the stat key.

Testing

  • bazel test //agent/internal/xds/proxy:all //agent/internal/xds/cache:all //test/envoy_validate:all //charts/aether:all: passed
  • make format-check: clean
  • bazel build --config=lint --@aspect_rules_lint//lint:fail_on_violation //...: clean
  • kind: e2e/l4routes.sh up && verify plus the collector (above)

🤖 Generated with Claude Code

https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

bpalermo and others added 3 commits September 28, 2026 07:21
…g, and the two L4 soak gates (#1023)

Every L4 cluster now reports under its own alt_stat_name instead of the bare
<ns>/<svc> key it shared with the service's other L4 clusters and its HTTP
cluster: tcp_<ns>/<svc> (floor), tcp_<ns>/<svc>_<port> (per-port and
primary-port alias), udp_<ns>/<svc> (UDP floor). "_" rather than ":" because
Envoy's stat-name sanitizer rewrites ":" to "_": the key aether writes is the
aether_cluster label, and a gate on "tcp:.*" would have matched nothing.

Every tcp_proxy chain on the capture listener (floor, per-port, TCPRoute,
any-port shim, TLSRoute SNI, blackhole) carries a connection-level OTel access
log on the new stream log_name=aether_l4_access_logs, behind the existing
access-log switch and sink; the passthrough default chain and UDP are not
logged. No `reporter` attribute, so the collector's HTTP identity counters are
untouched.

Gates: //test/envoy_validate asserts every L4 cluster's key and uniqueness and
that every capture tcp_proxy chain carries the L4 log, runs the chart's own
aether.cluster regex over the sanitized keys, and drives both checks red by
fault injection; a cache unit test pins the keys the snapshot emits. The soak
README seeds the two L4 zero-reading gates with rev242/rev243 as negative
controls; the runbook documents the stream, the keys and the L4 SAN join.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
…the tcp: config name (#1023)

Envoy's %UPSTREAM_CLUSTER% renders the cluster's alt_stat_name, so on the
aether_l4_access_logs stream upstream_cluster reads tcp_<ns>/<svc>[_<port>]
(observed on kind: upstream_cluster=tcp_aether-test/l4-front). The runbook's
per-service query `upstream_cluster:~"^tcp:tcp-echo[.]aether-test[.]"` could
never match; spell it against the stat key and say so in the field table.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
@bpalermo
bpalermo merged commit 799acda into main Sep 28, 2026
24 checks passed
@bpalermo
bpalermo deleted the feat/1023-l4-observability branch September 28, 2026 11:41
bpalermo added a commit that referenced this pull request Sep 29, 2026
Brings #979 up to date with 36 commits of main (demand-scoped twins #1020/#1032,
fresh-stream classifier #1033/#1035, dormant-pair ledger #1036/#1038, per-twin
EDS names #1012/#1029, the twin certificate gate #1051, the ODCDS always-answer
override, --east-west-quic-idle-timeout #1063, L4 stat keys #1043, access-log
timing #1048, the identity gate #1055, hot-restart knobs #1068 and the carried
Envoy patches) while keeping #979's intent: no allow-list, every destination in
the node's dependency set is QUIC-eligible.

Resolution:
- cache: quicServices / SetEastWestQUICServices removed. armsFor gives arms to
  every default, identity-ready, non-waypointed entry whose service is in the
  dependency set (the same rule recordQUICPair admits by, so no route names a
  twin the agent would refuse); twins stay demand-scoped. The
  destination_not_quic_enabled refusal/prune reason is gone.
- quicpairs: the dependency-set prune now waits for the pod set like the
  source prune does -- the allow-list used to force its destinations into the
  set, and without it the first snapshot after an agent restart dropped every
  restored pair (TestQUICDemandPairSurvivesAgentRestart was red).
- fan-out log: allow_listed_services dropped; observed_pairs and
  awaiting_client_cert kept.
- chart 1.0.12: eastWestQuicServices removed, eastWestQuicIdleTimeout and its
  parentShutdownTime check kept.
- e2e/eastwest-quic.sh: main's demand-scoped E1/E4c/E6 + #979's QUIC_DNS_SANS
  negative control; h2only/E3 removed; E6 dials quic-a and its idgate-* pairs
  are excluded from the driven-pair count. eastwest-quic-hotrestart.sh's h2
  control is now the weighted GAMMA split (the one h2-by-design path).
- tests, runbook, soak README, configuration.md, 038 rewritten for the
  unconditional state.

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

L4 observability: per-kind stat keys, an L4 access log, and two soak gates (verify_san on L4, zero TCP-floor connections on non-TCP pods)

1 participant