use of org.apache.skywalking.apm.toolkit.opentracing.SkywalkingContext in project incubator-skywalking by apache.
the class SkywalkingTracerExtractInterceptor method afterMethod.
@Override
public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, Object ret) throws Throwable {
Format format = (Format) allArguments[0];
if (Format.Builtin.TEXT_MAP.equals(format) || Format.Builtin.HTTP_HEADERS.equals(format)) {
TextMap textMapCarrier = (TextMap) allArguments[1];
ContextCarrier contextCarrier = new ContextCarrier();
CarrierItem next = contextCarrier.items();
while (next.hasNext()) {
next = next.next();
Iterator<Map.Entry<String, String>> iterator = textMapCarrier.iterator();
while (iterator.hasNext()) {
Map.Entry<String, String> entry = iterator.next();
if (next.getHeadKey().equals(entry.getKey())) {
next.setHeadValue(entry.getValue());
break;
}
}
}
ContextManager.extract(contextCarrier);
}
return new SkywalkingContext();
}
Aggregations