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
{{ message }}
Repository navigation
Add http.route support for Spring Cloud Gateway Path predicates #12608
When reading the Gateway-specific matched path, the implementation should verify that GATEWAY_PREDICATE_MATCHED_PATH_ROUTE_ID_ATTR belongs to the route in GATEWAY_ROUTE_ATTR. This avoids using a path left by an earlier candidate route whose remaining predicates did not match.
Describe alternatives you have considered
Setting http.route from the concrete request URL. This is not suitable because IDs and other dynamic path segments would create high-cardinality route values.
Manually tagging the active span in a Gateway filter. This couples application code to the tracing API and duplicates information already available from Spring Cloud Gateway.
Replacing RoutePredicateHandlerMapping in the application to copy the matched Gateway path into BEST_MATCHING_PATTERN_ATTRIBUTE. This is intrusive and requires every Spring Cloud Gateway application to implement the same workaround.
Tracer-level support for Spring Cloud Gateway route attributes would provide consistent behavior without application-specific tracing code.
Additional context
Observed with dd-java-agent 1.63.4.
The issue applies to inbound Spring Cloud Gateway requests handled by Spring WebFlux and Reactor Netty. Query parameters and StripPrefix filters should not affect the ingress route value.
Hi, I'd like to take this one if nobody else is already working on it.
My plan: in the Spring WebFlux instrumentation, when BEST_MATCHING_PATTERN_ATTRIBUTE is absent, read the Gateway matched path and use it as http.route only if the route id stored with it matches the id of the route that won (reading the id without a hard dependency on Gateway classes). Existing WebFlux behavior stays unchanged.
Two questions before I start:
Is anyone already working on this, or do maintainers see a problem with this approach?
For tests, would unit tests of the new route-reading logic be acceptable, or do you
expect an instrumentation test with Spring Cloud Gateway as a test dependency?
Activity
Vinu2111 commentedon Oct 19, 2026
Hi, I'd like to take this one if nobody else is already working on it.
My plan: in the Spring WebFlux instrumentation, when BEST_MATCHING_PATTERN_ATTRIBUTE is absent, read the Gateway matched path and use it as http.route only if the route id stored with it matches the id of the route that won (reading the id without a hard dependency on Gateway classes). Existing WebFlux behavior stays unchanged.
Two questions before I start:
expect an instrumentation test with Spring Cloud Gateway as a test dependency?