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
Include request method type in rest mapping annotations #5085
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5085 +/- ##
============================================
+ Coverage 52.14% 52.59% +0.44%
- Complexity 3334 3366 +32
============================================
Files 893 893
Lines 22048 22048
Branches 2110 2110
============================================
+ Hits 11498 11596 +98
+ Misses 9628 9529 -99
- Partials 922 923 +1 Continue to review full report at Codecov.
|
@wu-sheng, what do you think about using What do you think? I noticed you have an issue about parsing URLs at (#329). Maybe you have in mind another solution? Like ignoring the endpoint name whenever the span's |
Basically, adding http method in the operation name is not a big issue. But it mostly relates to rest style. In some systems, get and post are same, this naming style could be an issue by separating the same access. From my understanding, we could provide an across plugin configuration, and makes different pluings share it. Back to [] {}, it should not a big issue. Either is fine. We just need a consistent way. |
merge up
merge up
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.
Seems you missed the adjustments of UT :) Please fix.
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.
Look like the endpoint name changing affect the profiling e2e tests. Could you recheck?
Could you update this PR currently? 8.1.0 release is closing. |
@wu-sheng, I'm having trouble figuring out which e2e tests are failing and how I can run these tests locally. I can see how to write e2e tests (https://github.com/apache/skywalking/blob/master/docs/en/guides/README.md#writing-e2e-cases), but not how to run them. Is there a |
reas the file in the .github folder, there are a lot of yaml file controlling e2e. It is easy to follow. Those are GitHub action control files. |
…ns/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/interceptor/RestMappingMethodInterceptor.java
Seems Spring case is still failure. :) |
@BFergerson Could you make the tests passed? This PR has been open for a little long time. |
...pache/skywalking/apm/plugin/spring/mvc/commons/interceptor/RestMappingMethodInterceptor.java
Show resolved
Hide resolved
I think this has affected the profiling e2e case. I think it did profiling after matching the endpoint name. |
e2e profiling controlled by this, https://github.com/apache/skywalking/blob/master/.github/workflows/e2e.profiling.yaml |
@wu-sheng, I was waiting for the e2e test to fail. Are you saying it's stuck in a loop? I'll try running the e2e tests locally in the meantime. |
I'm not able to successfully run e2e tests locally. I'm running: git clone --recurse-submodules https://github.com/apache/skywalking.git
cd skywalking/
export SW_STORAGE=h2 && export SW_AGENT_JDK_VERSION=8 && export SKIP_TEST=true
make docker && ES_VERSION=es7 TAG=latest-es7 make docker.oap
cp -R dist test/e2e/
./mvnw --batch-mode -f test/e2e/pom.xml -am -DfailIfNoTests=false verify -Dit.test=org.apache.skywalking.e2e.profile.ProfileE2E And I'm getting:
When I run ProfileE2E directly I get: java.lang.NullPointerException
at org.apache.skywalking.e2e.SkyWalkingAnnotations.lambda$initDockerComposeField$2(SkyWalkingAnnotations.java:211)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1510)
at org.apache.skywalking.e2e.SkyWalkingAnnotations.initDockerComposeField(SkyWalkingAnnotations.java:206)
at org.apache.skywalking.e2e.SkyWalkingAnnotations.init(SkyWalkingAnnotations.java:115)
at org.apache.skywalking.e2e.SkyWalkingExtension.beforeAll(SkyWalkingExtension.java:53)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeBeforeAllCallbacks$7(ClassBasedTestDescriptor.java:355)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeBeforeAllCallbacks(ClassBasedTestDescriptor.java:355)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:189)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:77)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:132)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1510)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:229)
at org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$6(DefaultLauncher.java:197)
at org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:211)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:191)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:128)
at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:71)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:220)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:53)
Suppressed: java.lang.NullPointerException
at org.apache.skywalking.e2e.SkyWalkingAnnotations.lambda$destroy$0(SkyWalkingAnnotations.java:137)
at java.base/java.util.Optional.ifPresent(Optional.java:176)
at org.apache.skywalking.e2e.SkyWalkingAnnotations.destroy(SkyWalkingAnnotations.java:134)
at org.apache.skywalking.e2e.SkyWalkingExtension.afterAll(SkyWalkingExtension.java:58)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeAfterAllCallbacks$13(ClassBasedTestDescriptor.java:421)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeAfterAllCallbacks$14(ClassBasedTestDescriptor.java:421)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1510)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeAfterAllCallbacks(ClassBasedTestDescriptor.java:421)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.after(ClassBasedTestDescriptor.java:213)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.after(ClassBasedTestDescriptor.java:77)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:145)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:145)
... 27 more Which I think is the same NPE as when I run via |
@kezhenxu94 Could you take a look the error? @BFergerson I think the key error is here, https://github.com/apache/skywalking/blob/master/test/e2e/e2e-test/src/test/java/org/apache/skywalking/e2e/profile/ProfileE2E.java#L144 Note, the logs you posted are not related to this, I just say for the e2e test fail because of timeout. |
@BFergerson Any update of this PR? |
@wu-sheng, I'm willing to fix this if I can run these tests necessary to confirm it works. However, I'm not even able to get the correct e2e tests to run successfully. These are the commands I'm using: git clone --recurse-submodules https://github.com/apache/skywalking.git
cd skywalking/
export SW_STORAGE=h2 && export SW_AGENT_JDK_VERSION=8 && export SKIP_TEST=true
make docker && ES_VERSION=es7 TAG=latest-es7 make docker.oap
cp -R dist test/e2e/
./mvnw --batch-mode -f test/e2e/pom.xml -am -DfailIfNoTests=false verify -Dit.test=org.apache.skywalking.e2e.profile.ProfileE2E The issue I get is the same as the one I stated above. Are you able to run those commands successfully? What am I doing wrong? Local Info:
|
@BFergerson my local environment is unavailable now because of the upgrade of Docker version, before I can make it work again, can you just add a breakpoint in |
@BFergerson there is a bug in the E2E test when running locally, please |
@kezhenxu94, thanks. I was able to run e2e tests after adding that environment variable. This PR should be good to go now. |
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.
LGTM. Cool! @BFergerson from your experiences, seems there are some documents missing.
Could you try to fix and enhance this doc, https://github.com/apache/skywalking/blob/master/docs/en/guides/README.md#end-to-end-tests-e2e-for-short
Why submit this pull request?
Bug fix
New feature provided
Improve performance
Related issues
slightly related to: #4907 - Duplicate Spring MVC endpoint fix #5084
New feature or improvement
Using the
@RequestMapping
will result in an endpoint being saved like{GET}/users
instead of/users
. However, using the@GetMapping
will result in/users
. This PR will also result in the REST mapping annotations to work like the@RequestMapping
annotation.Also, spelling fix.