You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(metrics): bound fairness_id label cardinality and prune GC'd flow series (#2119)
* fix(metrics): bound fairness_id label cardinality and prune GC'd flow series
The fairness_id label on request and flow-control metrics is populated
from a client request header (or agent-identity attribute), so its
cardinality is not operator-bounded. Prometheus vectors never evict
label combinations: every distinct fairness ID ever observed permanently
allocated histogram series across both the deprecated and llm_d_epp
metric families, growing pod RSS and scrape payloads without bound.
Under flow-ID churn this was ~60% of remaining allocations in the
full-path flow-control benchmark.
Three changes, following the existing model-label precedent:
- Bound fairness_id through a boundedLabel limiter (cap 1000, overflow
to "other") in every record function that takes it, exactly as model
names are already bounded via boundModels.
- Bound model labels in RecordFlowControlRequestQueueDuration, which
was missing the boundModels call its siblings have.
- Prune a flow's flow-control series (both families) when the registry
garbage-collects the flow, so the vectors track live flows. Pruning
runs after cleanupFlowResources and outside the registry lock;
DeletePartialMatch scans whole vectors and must not run under it.
FullPath benchmark (registry/flow churn, M4 Pro, -benchtime=3s):
118k -> 213k d/s, 14.5KB -> 4.0KB per op, 264 -> 94 allocs per op.
Signed-off-by: Luke Van Drie <lukevandrie@google.com>
* test(metrics): cover fairness_id bounding paths; document label cardinality
- Verify the request-metric family bounds fairness_id like the flow
control family, and that RecordFlowControlRequestQueueDuration bounds
its model labels.
- Verify flow GC prunes the collected flow's metric series end to end.
- Document the client-derived label caps and GC pruning in
docs/metrics.md.
Signed-off-by: Luke Van Drie <lukevandrie@google.com>
* fix(metrics): guard overflow series from flow GC pruning
A flow whose client-chosen fairness ID equals the overflow value must not
delete the shared series that aggregates every capped-out tenant, so
DeleteFlowControlFlowSeries now no-ops on the overflow value.
Also document the revive-during-GC gauge race as an accepted limitation and
clarify in docs/metrics.md that the model labels share one cap pool and that
caps apply over the process lifetime.
Signed-off-by: Luke Van Drie <lukevandrie@google.com>
---------
Signed-off-by: Luke Van Drie <lukevandrie@google.com>
0 commit comments