use of org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan in project incubator-skywalking by apache.
the class SetResponseInterceptor method beforeMethod.
@Override
public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, MethodInterceptResult result) throws Throwable {
if (null == allArguments[0]) {
return;
}
AbstractSpan span = ContextManager.activeSpan();
int statusCode = ((HttpResponse) allArguments[0]).getStatusLine().getStatusCode();
if (statusCode >= 400) {
span.errorOccurred();
Tags.STATUS_CODE.set(span, Integer.toString(statusCode));
}
}
use of org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan in project incubator-skywalking by apache.
the class SuccessInterceptor method handleMethodException.
@Override
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, Throwable t) {
AbstractSpan activeSpan = ContextManager.activeSpan();
activeSpan.errorOccurred();
activeSpan.log(t);
}
use of org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan in project incubator-skywalking by apache.
the class SuccessInterceptor method beforeMethod.
@Override
public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, MethodInterceptResult result) throws Throwable {
SessionRequest request = (SessionRequest) allArguments[0];
AbstractSpan localSpan = ContextManager.createLocalSpan("AsyncThread/execute");
localSpan.setComponent(ComponentsDefine.HTTP_ASYNC_CLIENT).setLayer(SpanLayer.HTTP);
Object cacheValue = ((EnhancedInstance) request).getSkyWalkingDynamicField();
ContextManager.continued((ContextSnapshot) cacheValue);
}
use of org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan in project incubator-skywalking by apache.
the class HystrixCommandRunInterceptor method beforeMethod.
@Override
public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, MethodInterceptResult result) throws Throwable {
// create a local span, and continued, The `execution method` running in other thread if the
// hystrix strategy is `THREAD`.
EnhanceRequireObjectCache enhanceRequireObjectCache = (EnhanceRequireObjectCache) objInst.getSkyWalkingDynamicField();
ContextSnapshot snapshot = enhanceRequireObjectCache.getContextSnapshot();
AbstractSpan activeSpan = ContextManager.createLocalSpan(enhanceRequireObjectCache.getOperationNamePrefix() + "/Execution");
activeSpan.setComponent(ComponentsDefine.HYSTRIX);
ContextManager.continued(snapshot);
// Because of `fall back` method running in other thread. so we need capture concurrent span for tracing.
enhanceRequireObjectCache.setContextSnapshot(ContextManager.capture());
}
use of org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan in project incubator-skywalking by apache.
the class HttpAsyncResponseConsumerInterceptor method beforeMethod.
@Override
public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, MethodInterceptResult result) throws Throwable {
HttpAsyncRequestProducer producer = (HttpAsyncRequestProducer) allArguments[0];
String uri = producer.generateRequest().getRequestLine().getUri();
String requestMethod = producer.generateRequest().getRequestLine().getMethod();
AbstractSpan span = ContextManager.createLocalSpan("httpasyncclient/" + method.getName());
Tags.HTTP.METHOD.set(span, requestMethod);
span.setComponent(ComponentsDefine.HTTP_ASYNC_CLIENT).setLayer(SpanLayer.HTTP);
Tags.URL.set(span, uri);
}
Aggregations