将HttpClient的header的Value值改成二级,为的是和Dubbo对应一致
This commit is contained in:
parent
9f88dfd09b
commit
081c3cbbf3
|
|
@ -13,7 +13,7 @@ public class HttpClientTracing {
|
|||
public static <R> R execute(String url, String traceHearName, HttpRequest httpRequest, Executor<R> executor) throws IOException {
|
||||
try {
|
||||
httpRequest.setHeader(traceHearName,
|
||||
sender.beforeSend(Identification.newBuilder()
|
||||
"ContextData=" + sender.beforeSend(Identification.newBuilder()
|
||||
.viewPoint(url)
|
||||
.spanType('W')
|
||||
.build())
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import java.io.IOException;
|
|||
|
||||
public class SkyWalkingFilter implements Filter {
|
||||
|
||||
private final String secondKey = "ContextData";
|
||||
private String tracingName;
|
||||
private static final String DEFAULT_TRACE_NAME = "SkyWalking-TRACING-NAME";
|
||||
|
||||
|
|
@ -25,7 +26,15 @@ public class SkyWalkingFilter implements Filter {
|
|||
RPCBuriedPointReceiver receiver = null;
|
||||
try {
|
||||
HttpServletRequest request = (HttpServletRequest) servletRequest;
|
||||
String contextDataStr = request.getHeader(tracingName);
|
||||
String tracingHeaderValue = request.getHeader(tracingName);
|
||||
String contextDataStr = null;
|
||||
int index = tracingHeaderValue.indexOf("=");
|
||||
if (index > 0) {
|
||||
String key = tracingHeaderValue.substring(0, index);
|
||||
if (secondKey.equals(key)) {
|
||||
contextDataStr = tracingHeaderValue.substring(index + 1);
|
||||
}
|
||||
}
|
||||
ContextData contextData = null;
|
||||
if (contextDataStr != null && contextDataStr.length() > 0) {
|
||||
contextData = new ContextData(contextDataStr);
|
||||
|
|
|
|||
Loading…
Reference in New Issue