-
Notifications
You must be signed in to change notification settings - Fork 665
Fix Gateway 2.0.x plugin not activated for spring-cloud-starter-gateway 2.0.0.RELEASE #779
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
Conversation
…witness class GatewayAutoConfiguration$1 with a stable class GatewayAutoConfiguration. This resolves startup errors and ensures plugin compatibility with Spring Cloud Gateway 2.0.x.
|
Please update changes and if some versions were not supported, please update the plugin test versions to verify it is supported with new changes. |
Environment Spring Cloud Gateway version: 2.0.0.RELEASE Dependency: spring-cloud-starter-gateway SkyWalking Java agent version: 9.5.0 Plugin used: apm-spring-cloud-gateway-2.0.x-plugin-9.5.0.jar Problem Description When running a Spring Cloud Gateway 2.0.0 application with the SkyWalking Java agent (9.5.0) and enabling the apm-spring-cloud-gateway-2.0.x-plugin, the tracing context becomes inconsistent. The trace ID generated at the gateway does not match the trace ID observed in the downstream application after the request is forwarded. During application startup, the following error appears in skywalking-api.log: enhance class org.springframework.web.reactive.DispatcherHandler by plugin The same error repeats across several plugin enhancement attempts, indicating that multiple instrumentation definitions are being skipped. Root Cause The SkyWalking plugin for Spring Cloud Gateway 2.0.x uses the following witness class: org.springframework.cloud.gateway.config.GatewayAutoConfiguration$1 However, in Spring Cloud Gateway 2.0.0, the anonymous inner class $1 does not exist in the bytecode. This explains why instrumentation for key classes—such as DispatcherHandler—is not applied, ultimately leading to trace ID inconsistency. |
|
If this is the case, you should face error run this test scenario, We can see it poassed on 2.0.4. |
The test case uses spring-cloud-starter-gateway 2.0.2.RELEASE, and it works correctly with this version. |
|
Please update the changes.md about what you changed. |
|
By that, I mean, all versions in |
|
The version decleared here will be will be replaced by the list mentioned above. So, 2.0.4 is just one tested version. |
|
I think you should run this(2.0.0) locally, and confirm it would fail. And post local logs here. |
|
You can see the updated case failed. https://github.com/apache/skywalking-java/actions/runs/19283932635/job/55141865683?pr=779 |
…er-gateway 2.0.0.RELEASE" This reverts commit 2502128.
Hello, when running local tests for gateway-projectA-scenario, an error occurs: Adding a manual dependency on reactor-core:3.1.7.RELEASE in the pom.xml file resolves the issue. I’d like to confirm whether this solution aligns with your expectations or project standards. |
When running locally with Spring Cloud Gateway 2.0.0, the skywalking-api.log shows the following warnings: WARN 2025-11-12 15:01:27.054 main AbstractClassEnhancePluginDefine : enhance class reactor.ipc.netty.http.client.HttpClient by plugin org.apache.skywalking.apm.plugin.spring.cloud.gateway.v20x.define.HttpClientInstrumentation is not activated. Witness class org.springframework.cloud.gateway.config.GatewayAutoConfiguration$1 does not exist. |
You could try to add that to projectA(2.0.x), if it doesn't affect 2.0.4, then we are good. |
I’ve submitted the modification, and the test case gateway-2.0.x-scenario is now running normally. |
Fix Gateway 2.0.x plugin not activated for spring-cloud-starter-gateway 2.0.0.RELEASE
The current implementation of
AbstractGateway200EnhancePluginDefineV2usesorg.springframework.cloud.gateway.config.GatewayAutoConfiguration$1as a witness class: