Add http.route support for Spring Cloud Gateway Path predicates
Maintainer thường phản hồi trong vòng 2 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 62/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- java, spring, spring-boot
- Lĩnh vực
- backend, observability
Hướng nghiên cứu
Start in spring-webflux-5.0/src/main/java/datadog/trace/instrumentation/springwebflux/server/HandlerAdapterAdvice.java, then read Spring Cloud Gateway's PathRoutePredicateFactory and RoutePredicateHandlerMapping sources. Trace the GATEWAY_ROUTE_ATTR, GATEWAY_PREDICATE_MATCHED_PATH_ATTR, and route ID attributes, ensuring the matched path belongs to the selected route. Done means inbound Gateway spans use the stable matched path for http.route and route-based resource naming without query or StripPrefix effects.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Library Name
Spring Cloud Gateway
Library Version(s)
Spring Cloud Gateway 3.1.5
Spring Cloud 2021.0.5
Spring Boot 2.7.8
Describe the feature you would like
Inbound Reactor Netty server spans created for Spring Cloud Gateway requests should use the matched Gateway Path predicate as the http.route tag.
For example, given this route:
spring:
cloud:
gateway:
routes:
- id: api-service
uri: http://localhost:8081
predicates:
- Path=/api/**
filters:
- StripPrefix=1
A request such as:
GET /api/users/123?page=1
should produce:
operation.name: netty.request
http.route: /api/**
When route-based server resource naming is enabled, the resource name should also become:
GET /api/**
The matched predicate is preferable to the concrete request path because it is stable and low-cardinality.
Is your feature request related to a problem?
Yes. Spring Cloud Gateway does not publish its matched route through the WebFlux standard HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE.
Instead, it stores routing information in Gateway-specific exchange attributes:
GATEWAY_ROUTE_ATTR
GATEWAY_PREDICATE_MATCHED_PATH_ATTR
GATEWAY_PREDICATE_MATCHED_PATH_ROUTE_ID_ATTR
The current Spring WebFlux instrumentation only reads:
exchange.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE)
As a result, the inbound Reactor Netty span can contain:
operation.name: netty.request
resource.name: GET /api/users/123
http.url: http://localhost:8080/api/users/123?page=1
http.route: absent
Spring Cloud Gateway already contains the low-cardinality matched pattern /api/**, but the tracer does not consume it.
Relevant sources:
- dd-trace-java HandlerAdapterAdvice
- Spring Cloud Gateway PathRoutePredicateFactory
- Spring Cloud Gateway RoutePredicateHandlerMapping
- Spring Cloud Gateway GatewayPathTagsProvider
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.routefrom 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
RoutePredicateHandlerMappingin the application to copy the matched Gateway path intoBEST_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.
- Ngôn ngữ chính
- Java
- Star
- 737
- Fork
- 361
- Merge trung bình
- 3 ngày 13 giờ
- Pull request đã merge (30 ngày)
- 171
Chuẩn bị môi trường
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của DataDog/dd-trace-java
-
type: feature request
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 70/100
DataDog/dd-trace-java#10245 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
gRPC server instrumentations (grpc-1.5, armeria-grpc) don't make extracted W3C baggage current in the handlerCó thể đã có người làm @mcculls đã nhận hôm nay. Đang mởcomp: context propagation inst: grpc type: feature request
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 78/100
DataDog/dd-trace-java#12654 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
type: bug report
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
DataDog/dd-trace-java#12597 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Queueing-time profiler aborts the whole instrumentation install under a JDK 24+ AOT cache (zero spans); disabling that one feature is enoughCó thể đã có người làm @mcculls đã nhận 7 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
DataDog/dd-trace-java#12540 · 5 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 25/100
DataDog/dd-trace-java#12480 ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của DataDog/dd-trace-java
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
feature triaged
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
Graylog2/graylog2-server#27549 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
component/zeebe kind/bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
UniversalMediaServer/UniversalMediaServer#6356 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
googleapis/google-cloud-java#14533 ·
Maintainer thường phản hồi trong vòng 1 ngày