feat: expose detailedMetric on global rate limit rules #9762
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 304 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.342
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #9762"
general
weight: 0.35
vishals-3
Fixes #9083
What this does
The envoyproxy/ratelimit service supports a
detailed_metricflag on rate-limit descriptors that includes the resolved descriptor value in the emitted metrics — soratelimit_service_rate_limit_counters become per-value instead of aggregated. Envoy Gateway never surfaced it, so it was alwaysfalse.This adds a
detailedMetricboolean to global rate-limit rules, mirroring the existingshadowModefield.With it enabled, instead of one aggregated series you get one per descriptor value:
Design
Mirrors
shadowModeexactly through the pipeline:api/v1alpha1/ratelimit_types.go:DetailedMetric boolonRateLimitRuleinternal/ir/xds.go: same fieldinternal/gatewayapi/backendtrafficpolicy.go(buildRateLimitRule)internal/xds/translator/ratelimit.go: newisRuleDetailedMetrichelper setspbDesc.DetailedMetricon each generated descriptor (same sites asShadowMode)When unset, existing behavior (aggregated metrics) is preserved. As the issue notes, enabling it can produce high metric cardinality for descriptors with many distinct values — documented in the field godoc.
Testing
Generated code (deepcopy, CRDs, API reference docs) was regenerated with the repo's own tooling (
controller-gen,crd-ref-docs).global-detailed-metricassertingdetailed_metricin the generated rate-limit service configbackendtrafficpolicy-with-ratelimitfixture to exercise the API→IR conversion---
This PR was authored with the assistance of Claude, an AI assistant.
🤖 Generated with Claude Code