Skip to content

feat(agent): count and log a udp: cluster with no routable endpoint - #937

Merged
bpalermo merged 1 commit into
mainfrom
feat/udp-no-healthy-backend-metric
Sep 26, 2026
Merged

bpalermo merged 1 commit into
mainfrom
feat/udp-no-healthy-backend-metric

Conversation

@bpalermo

Copy link
Copy Markdown
Owner

Fifth of the #931 series. The fix landed in #936; this makes the failure it fixed detectable if it ever returns in another form.

Why there was nothing to see

A published udp: cluster in which no endpoint is routable is a silent blackhole. udp_proxy takes the datagram, finds an empty healthy set (NewUDPServiceCluster sets HealthyPanicThreshold: 0, so it will not spray to unhealthy hosts), and discards it.

Nothing reports that:

signal why it stays quiet
xDS NACK the config is valid
UDPRoute input discarded (#874) nothing was dropped at projection time
downstream_sess_rx_datagrams counts per session, and a session needs a host

That last one measured 1 after four datagrams had reached the socket on a live cluster.

captureUDPClusters is the only place holding both the cluster and its endpoints' health, so it is the only place the condition can be named.

Reported rather than skipped. Skipping would remove the listener and trade one blackhole for another; leaving the cluster published means the service recovers by itself the moment an endpoint goes healthy.

Routable is Envoy's definition, not ours

HEALTHY and UNKNOWN are both load balanced — UNKNOWN is the default for an endpoint nobody has said anything about — while UNHEALTHY, DRAINING and TIMEOUT are not.

Reading UNKNOWN as unhealthy would fire on every healthy service whose endpoints carry no explicit status, which is most of them. An empty load assignment reports nothing: that is a cold start, not a blackhole, and firing there would make the counter ring for every service between its cluster appearing and its endpoints arriving.

The counter is seeded, and the gate has a red state

Seeded at zero — an unseeded counter has no Prometheus series at all, and "no series" is indistinguishable from "zero" to a grading query.

That has been forgotten twice in this file (rev200, then rev231/#882). TestEveryRegisteredCounterDeclaresItsSeedPolicy caught it a third time here, before it shipped — which is the first time that guard has paid for itself.

TestUnroutableUDPEndpoints drives the detector red, including the exact shape #931 shipped in, per #853.

Incidental refactor, called out because it is in the diff

New() was one flat run of if … err != nil registrations sitting one registration below the gocognit limit, so adding this counter failed the lint. Split into registerActivityInstruments / registerAnomalyCounters / seedAnomalyCounters — groups that match the seeding distinction rather than an arbitrary cut.

The seed-policy test parses this file's AST, so it reads the registrations from the helpers unchanged. Worth noting the flat version meant whoever added the next counter would hit the lint rather than the author who used up the budget.

Verification

bazel test //... — 109/109. --config=lint --@aspect_rules_lint//lint:fail_on_violation //... clean (it was not, before the refactor). Refs #931.

Last one after this: PR6 (e2e — l4udp-* re-annotated protocol: udp, T3.1 green; it has been seen red three times, so #853 is satisfied).

🤖 Generated with Claude Code

https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

Fifth of the #931 series. The fix landed in #936; this makes the failure it
fixed detectable if it ever returns in another form.

WHY THERE WAS NOTHING TO SEE

A published udp: cluster in which no endpoint is routable is a silent blackhole.
udp_proxy takes the datagram, finds an empty healthy set (NewUDPServiceCluster
sets HealthyPanicThreshold: 0, so it will not spray to unhealthy hosts), and
discards it. Nothing reports that:

  - no NACK: the config is valid
  - no "UDPRoute input discarded": nothing was dropped at projection time, so
    the #874 path stays quiet
  - no udp_proxy counter either. downstream_sess_rx_datagrams counts per
    SESSION and a session needs a host, so it does not move. Measured on a live
    cluster: it read 1 after FOUR datagrams had reached the socket.

captureUDPClusters is the only place that holds both the cluster and its
endpoints' health, so it is the only place the condition can be named.

Reported rather than skipped. Skipping would remove the listener and trade one
blackhole for another; leaving the cluster published means the service recovers
by itself the moment an endpoint goes healthy.

WHAT COUNTS AS ROUTABLE IS ENVOY'S DEFINITION, NOT OURS

HEALTHY and UNKNOWN are both load balanced -- UNKNOWN is the default for an
endpoint nobody has said anything about -- while UNHEALTHY, DRAINING and TIMEOUT
are not. Reading UNKNOWN as unhealthy would fire on every healthy service whose
endpoints carry no explicit status, which is most of them.

An empty load assignment reports nothing: that is a cold start, not a blackhole,
and firing there would make the counter ring for every service between its
cluster appearing and its endpoints arriving.

THE COUNTER IS SEEDED, AND THE GATE HAS A RED STATE

Seeded at zero, because an unseeded counter has no Prometheus series at all and
"no series" is indistinguishable from "zero" to a grading query. That has been
forgotten twice here (rev200, then rev231/#882) --
TestEveryRegisteredCounterDeclaresItsSeedPolicy now caught it a third time,
before it shipped.

TestUnroutableUDPEndpoints drives the detector red, including the exact shape
#931 shipped in (#853: a gate never shown to fire is not a gate).

INCIDENTAL REFACTOR

New() was one flat run of `if ... err != nil` registrations sitting one
registration below the gocognit limit, so adding this counter failed the lint.
Split into registerActivityInstruments / registerAnomalyCounters /
seedAnomalyCounters -- groups that match the seeding distinction rather than an
arbitrary cut. The seed-policy test parses this file's AST, so it reads the
registrations from the helpers unchanged.

Refs #931

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
@bpalermo
bpalermo merged commit f66a438 into main Sep 26, 2026
23 checks passed
@bpalermo
bpalermo deleted the feat/udp-no-healthy-backend-metric branch September 26, 2026 00:30
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.

1 participant