feat: warn on dots in HTTPRoute names to avoid duplicate Prometheus series - #9630
Open
guanchzhou wants to merge 1 commit into
Open
feat: warn on dots in HTTPRoute names to avoid duplicate Prometheus series#9630guanchzhou wants to merge 1 commit into
guanchzhou wants to merge 1 commit into
Conversation
…eries Envoy derives Prometheus stat labels by splitting cluster names on ".", so an HTTPRoute whose name (or a rule name) contains a dot is truncated at the first dot and can collide with another route into duplicate metric series, which Prometheus rejects with "duplicate sample for timestamp". Set a Warning status condition (reason DottedName) on the HTTPRoute in that case, signaling users to avoid dots in names. The condition is set after the Accepted condition so it doesn't suppress it. Scoped to HTTPRoute; other route kinds can follow up. Fixes envoyproxy#9576 Signed-off-by: Andrey Maltsev <maltsev.andrey@gmail.com>
✅ Deploy Preview for cerulean-figolla-1f9435 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9630 +/- ##
==========================================
+ Coverage 76.04% 76.08% +0.04%
==========================================
Files 259 259
Lines 43275 43292 +17
==========================================
+ Hits 32907 32939 +32
+ Misses 8178 8165 -13
+ Partials 2190 2188 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does
Sets a
Warningstatus condition (reasonDottedName) on an HTTPRoute when its name — or one of its rule names — contains a dot, signaling users to avoid dots in names.Fixes #9576.
Why
Envoy derives Prometheus stat-tag labels by splitting cluster names on
.(see thestats_tagsregexes in the bootstrap). A cluster namedhttproute/<ns>/echo.a.example.com/rule/0is therefore truncated at the first dot, so two HTTPRoutes sharing a before-first-dot prefix collapse to the sameenvoy_cluster_total_match_count{envoy_cluster_name="httproute/default/echo"}series. Being distinct counters, their values diverge and Prometheus rejects the samples (duplicate sample for timestamp), firingPrometheusDuplicateTimestamps.Per the discussion, this implements the maintainer-preferred warning condition and intentionally does not rename/sanitize clusters or stat names (the dot→underscore
AltStatNameapproach was declined).Change
In
processHTTPRouteParentRefs, after the Accepted condition is set, if the route name or any rule name contains a dot, add:RouteConditionWarningtype +RouteReasonDottedNamereason ininternal/gatewayapi/status/error.go(mirrors the existing custom route-condition pattern and thePolicyConditionWarningprecedent). There is no standard Gateway API route Warning type.Accepted=Trueblock so it doesn't suppress acceptance (that block only fires when no other condition is present).Testing
internal/gatewayapi/testdata/httproute-with-dot-in-name.{in,out}.yaml— route namedecho.a.example.comnow carries theWarning/DottedNamecondition alongsideAccepted/ResolvedRefs.Open question
Should this also cover GRPCRoute (and the L4 routes)? Happy to extend in this PR or a follow-up — whichever maintainers prefer.