use of org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance in project incubator-skywalking by apache.
the class EnqueueInterceptor method beforeMethod.
@Override
public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, MethodInterceptResult result) throws Throwable {
EnhancedInstance callbackInstance = (EnhancedInstance) allArguments[0];
Request request = (Request) objInst.getSkyWalkingDynamicField();
ContextManager.createLocalSpan("Async" + request.url().uri().getPath());
/**
* Here is the process about how to trace the async function.
*
* 1. Storage `Request` object into `RealCall` instance when the constructor of `RealCall` called.
* 2. Put the `RealCall` instance to `CallBack` instance
* 3. Get the `RealCall` instance from `CallBack` and then Put the `RealCall` into `AsyncCall` instance
* since the constructor of `RealCall` called.
* 5. Create the exit span by using the `RealCall` instance when `AsyncCall` method called.
*/
callbackInstance.setSkyWalkingDynamicField(new EnhanceRequiredInfo(objInst, ContextManager.capture()));
}
use of org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance in project incubator-skywalking by apache.
the class SWExecutionHookWrapper method onStart.
@Override
public <T> void onStart(HystrixInvokable<T> commandInstance) {
EnhancedInstance enhancedInstance = (EnhancedInstance) commandInstance;
EnhanceRequireObjectCache enhanceRequireObjectCache = (EnhanceRequireObjectCache) enhancedInstance.getSkyWalkingDynamicField();
enhanceRequireObjectCache.setContextSnapshot(ContextManager.capture());
actual.onStart(commandInstance);
}
Aggregations