PepoRobert opened a new issue #8695:
URL: https://github.com/apache/skywalking/issues/8695


   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/skywalking/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### Apache SkyWalking Component
   
   Java Agent (apache/skywalking-java)
   
   ### What happened
   
   OkHttp allow user to rewrite the request using Interceptors.When we use 
Interceptor to implement dynamic routing.
   We found creating the wrong span.
   
   
![image](https://user-images.githubusercontent.com/27007840/158752329-a8681227-7029-40dc-94ac-f26c96156b40.png)
   
   
   ### What you expected to happen
   
   Create span based on the actual requested address
   
   ### How to reproduce
   
     private static OkHttpClient client = new 
OkHttpClient.Builder().addInterceptor(new Interceptor() {
           @Override
           public Response intercept(Chain chain) throws IOException {
               final Request request = chain.request();
               return 
chain.proceed(request.newBuilder().url("http://localhost:8080/trace";).build());
           }
       }).build();
   
       public static String run(String url) throws IOException {
           Request request = new Request.Builder()
                   .url(url)
                   .build();
           try (Response response = client.newCall(request).execute()) {
               return response.body().string();
           }
       }
   
       public static void main(String[] args) throws IOException {
           run("http://localhost:8080/hi";);
       }
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to