Skip to content

feat: warn on dots in HTTPRoute names to avoid duplicate Prometheus series - #9630

Open
guanchzhou wants to merge 1 commit into
envoyproxy:mainfrom
guanchzhou:eg-httproute-dot-name-warning
Open

feat: warn on dots in HTTPRoute names to avoid duplicate Prometheus series#9630
guanchzhou wants to merge 1 commit into
envoyproxy:mainfrom
guanchzhou:eg-httproute-dot-name-warning

Conversation

@guanchzhou

Copy link
Copy Markdown
Contributor

What this PR does

Sets a Warning status condition (reason DottedName) 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 the stats_tags regexes in the bootstrap). A cluster named httproute/<ns>/echo.a.example.com/rule/0 is therefore truncated at the first dot, so two HTTPRoutes sharing a before-first-dot prefix collapse to the same envoy_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), firing PrometheusDuplicateTimestamps.

Per the discussion, this implements the maintainer-preferred warning condition and intentionally does not rename/sanitize clusters or stat names (the dot→underscore AltStatName approach was declined).

Change

In processHTTPRouteParentRefs, after the Accepted condition is set, if the route name or any rule name contains a dot, add:

type: Warning
status: "True"
reason: DottedName
message: A dot in the HTTPRoute name or rule name(s) [...] causes Envoy to truncate
  Prometheus metric labels at the first dot, which can produce duplicate metric series;
  avoid dots in HTTPRoute and rule names.
  • New custom RouteConditionWarning type + RouteReasonDottedName reason in internal/gatewayapi/status/error.go (mirrors the existing custom route-condition pattern and the PolicyConditionWarning precedent). There is no standard Gateway API route Warning type.
  • The condition is set after the Accepted=True block so it doesn't suppress acceptance (that block only fires when no other condition is present).
  • Scoped to HTTPRoute; GRPCRoute/TCP/TLS/UDP have the same dotted-name behavior and can be a follow-up.

Testing

  • New golden pair internal/gatewayapi/testdata/httproute-with-dot-in-name.{in,out}.yaml — route named echo.a.example.com now carries the Warning/DottedName condition alongside Accepted/ResolvedRefs.
  • No other goldens change (no existing fixture uses a dotted route name).
go build ./...                       # ok
go test ./internal/gatewayapi/...    # ok
make generate                        # clean (status string, no CRD/helm change)
gofmt -l / go vet                    # clean

Open question

Should this also cover GRPCRoute (and the L4 routes)? Happy to extend in this PR or a follow-up — whichever maintainers prefer.

…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>
@guanchzhou
guanchzhou requested a review from a team as a code owner July 31, 2026 12:18
@netlify

netlify Bot commented Jul 31, 2026

Copy link
Copy Markdown

Deploy Preview for cerulean-figolla-1f9435 ready!

Name Link
🔨 Latest commit ab39092
🔍 Latest deploy log https://app.netlify.com/projects/cerulean-figolla-1f9435/deploys/6a6c927db0413b000876383f
😎 Deploy Preview https://deploy-preview-9630--cerulean-figolla-1f9435.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov

codecov Bot commented Jul 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.23529% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.08%. Comparing base (b710dd4) to head (ab39092).

Files with missing lines Patch % Lines
internal/gatewayapi/route.go 88.23% 1 Missing and 1 partial ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@arkodg arkodg added this to the Backlog milestone Aug 3, 2026
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.

Dot in HTTPRoute name produces duplicate envoy_cluster_total_match_count Prometheus series

2 participants