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
Intercept feign URL without parameters #3854
Conversation
Let's wait for #3838 merged, then, you need to add this case into the test. |
FYI @Aderm |
CI test failed, please check. |
You still get the code style issue. You should check locally first. |
/run agent-plugin-test-3 |
...c/main/java/org/apache/skywalking/apm/plugin/feign/http/v9/DefaultHttpClientInterceptor.java
Outdated
Show resolved
Hide resolved
...gin/src/test/java/org/apache/skywalking/apm/plugin/feign/http/v9/PathVarInterceptorTest.java
Outdated
Show resolved
Hide resolved
...-plugin/src/main/java/org/apache/skywalking/apm/plugin/feign/http/v9/PathVarInterceptor.java
Show resolved
Hide resolved
Feign test #3838 has been merged. Please add this into the test. |
You could find how to run and test through this doc https://github.com/apache/skywalking/blob/master/docs/en/guides/Plugin-test.md |
@dominicqi Please make sure the feign-scenario passed, and include your new feature in. |
i found the problem, RequestTemplate#url miss the url part in the |
…scenario" fix feign-scenario test use pathVariable
/run agent-plugin-test-3 |
...-plugin/src/main/java/org/apache/skywalking/apm/plugin/feign/http/v9/PathVarInterceptor.java
Outdated
Show resolved
Hide resolved
...-plugin/src/main/java/org/apache/skywalking/apm/plugin/feign/http/v9/PathVarInterceptor.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/apache/skywalking/apm/plugin/feign/http/v9/DefaultHttpClientInterceptor.java
Outdated
Show resolved
Hide resolved
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
...c/main/java/org/apache/skywalking/apm/plugin/feign/http/v9/DefaultHttpClientInterceptor.java
Show resolved
Hide resolved
if (feignResolvedURL != null) { | ||
PathVarInterceptor.URL_CONTEXT.remove(); | ||
} | ||
} | ||
if (operationName == null || operationName.length() == 0) { | ||
operationName = "/"; |
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.
If operationName could be null, operationName.replace
would already be NPE
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.
the operationName never be null, because URL.getPath() will return empty str。 I will remove this null condition.
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.
It seems better this way. right?
FeignResolvedURL feignResolvedURL = PathVarInterceptor.URL_CONTEXT.get();
if (feignResolvedURL != null) {
try {
if (operationName.length() > 0) {
operationName = operationName.replace(feignResolvedURL.getUrl(), feignResolvedURL.getOriginUrl());
}
} finally {
PathVarInterceptor.URL_CONTEXT.remove();
}
}
if (operationName.length() == 0) {
operationName = "/";
}
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 matter different. Change or not seems OK to me.
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 matter different.
ha ha, it seems so.
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.
@dominicqi Please follow the review suggestions, they make sense to me.
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
/run agent-plugin-test-2 |
…out parameters
Please answer these questions before submitting pull request
Why submit this pull request?
Bug fix
[+] New feature provided
Improve performance
Related issues
Feign Client Operation Name with PathVariable #3850
Bug fix
Bug description.
How to fix?
New feature or improvement
intercept
feign.ReflectiveFeign.BuildTemplateByResolvingArgs#resolve(Object[], RequestTemplate, Map)
get url without params before resolve ,put it into ThreadLocal ,get the url in Feign DefaultHttpClientInterceptor