-
Notifications
You must be signed in to change notification settings - Fork 1k
spring-cloud-gateway support for spring boot 4 #15540
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| @Override | ||
| public ElementMatcher<ClassLoader> classLoaderOptimization() { | ||
| return hasClassesNamed( | ||
| "org.springframework.cloud.gateway.server.mvc.handler.GatewayDelegatingRouterFunction"); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not needed when matching classes based on just name
| } | ||
|
|
||
| try { | ||
| Field routeIdField = gatewayRouterFunction.getClass().getDeclaredField("routeId"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
usually when we use reflection we try to do the reflective lookup only once and reuse the Field/Method. Isn't the gatewayRouterFunction here always GatewayDelegatingRouterFunction? If it is you could look up the field in the static initializer of the class. An other option would be to instrument that class and copy route value into a virtual field that you could read here.
|
|
||
| Optional<Object> requestUrlOpt = request.attribute(MvcUtils.GATEWAY_REQUEST_URL_ATTR); | ||
| requestUrlOpt.ifPresent( | ||
| uri -> serverSpan.setAttribute(ROUTE_URI_ATTRIBUTE, ((URI) uri).toASCIIString())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason you didn't wish to just use the toString() of the uri?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no good reason, updated thanks
|
|
||
| @Test | ||
| void gatewayRouteMappingTest() { | ||
| testGatewayRouteMapping(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason you didn't add @Test to the super class method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
at one point i was overriding the method but thats no longer needed, thanks
| compileOnly("io.opentelemetry:opentelemetry-api") | ||
| compileOnly("io.opentelemetry:opentelemetry-api-incubator") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aren't these already available through otel.javaagent-instrumentation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes thank you
Related to #14906
The spring-cloud-starter-gateway artifact split into two:
When I tried to update the muzzle config to include both new artifacts, I hit some muzzle errors, so I split out webmvc into its own module. I also noticed that we didn't have test coverage for webmvc, so I added some, and realized that it wasn't working so I added some new instrumentation. If we would prefer that I undo all of that and handle it in a separate PR, just let me know.