Merge pull request #710 from ascrutae/fix/okhttp-issue

[Agent] fix the context is incorrect issue
This commit is contained in:
吴晟 Wu Sheng 2017-12-28 17:09:39 +08:00 committed by GitHub
commit 96e0420ea8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 3 deletions

View File

@ -64,9 +64,12 @@ public class AsyncCallInterceptor implements InstanceConstructorInterceptor, Ins
EnhanceRequiredInfo enhanceRequiredInfo = (EnhanceRequiredInfo)objInst.getSkyWalkingDynamicField();
Request request = (Request)enhanceRequiredInfo.getRealCallEnhance().getSkyWalkingDynamicField();
ContextCarrier contextCarrier = new ContextCarrier();
HttpUrl requestUrl = request.url();
AbstractSpan span = ContextManager.createExitSpan(requestUrl.uri().getPath(), contextCarrier, requestUrl.host() + ":" + requestUrl.port());
AbstractSpan span = ContextManager.createExitSpan(requestUrl.uri().getPath(), requestUrl.host() + ":" + requestUrl.port());
ContextManager.continued(enhanceRequiredInfo.getContextSnapshot());
ContextCarrier contextCarrier = new ContextCarrier();
ContextManager.inject(contextCarrier);
span.setComponent(ComponentsDefine.OKHTTP);
Tags.HTTP.METHOD.set(span, request.method());
Tags.URL.set(span, requestUrl.uri().toString());
@ -86,7 +89,7 @@ public class AsyncCallInterceptor implements InstanceConstructorInterceptor, Ins
}
headersField.set(request, headerBuilder.build());
ContextManager.continued(enhanceRequiredInfo.getContextSnapshot());
}
@Override