Java Code Examples for org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan#log()

The following examples show how to use org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan#log() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MongoDBCollectionMethodInterceptor.java    From skywalking with Apache License 2.0 6 votes vote down vote up
@Override
public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
    Object ret) throws Throwable {
    AbstractSpan activeSpan = ContextManager.activeSpan();
    CommandResult cresult = null;
    if (ret instanceof WriteResult) {
        WriteResult wresult = (WriteResult) ret;
        cresult = wresult.getCachedLastError();
    } else if (ret instanceof AggregationOutput) {
        AggregationOutput aresult = (AggregationOutput) ret;
        cresult = aresult.getCommandResult();
    }
    if (null != cresult && !cresult.ok()) {
        activeSpan.log(cresult.getException());
    }
    ContextManager.stopSpan();
    return ret;
}
 
Example 2
Source File: TracingClientCall.java    From skywalking with Apache License 2.0 6 votes vote down vote up
@Override
public void cancel(@Nullable String message, @Nullable Throwable cause) {
    final AbstractSpan span = ContextManager.createLocalSpan(operationPrefix + REQUEST_ON_CANCEL_OPERATION_NAME);
    span.setComponent(ComponentsDefine.GRPC);
    span.setLayer(SpanLayer.RPC_FRAMEWORK);
    ContextManager.continued(snapshot);

    if (cause != null) {
        span.log(cause);
    }

    try {
        super.cancel(message, cause);
    } catch (Throwable t) {
        ContextManager.activeSpan().errorOccurred().log(t);
        throw t;
    } finally {
        ContextManager.stopSpan();
    }
}
 
Example 3
Source File: MongoDBInterceptor.java    From skywalking with Apache License 2.0 5 votes vote down vote up
@Override
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
    Class<?>[] argumentsTypes, Throwable t) {
    AbstractSpan activeSpan = ContextManager.activeSpan();
    activeSpan.errorOccurred();
    activeSpan.log(t);
}
 
Example 4
Source File: TransportClientHandlerInterceptor.java    From skywalking with Apache License 2.0 5 votes vote down vote up
@Override
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
    Class<?>[] argumentsTypes, Throwable t) {
    Invocation invocation = (Invocation) allArguments[0];
    if (!checkRegisterStatus(invocation)) {
        return;
    }
    AbstractSpan span = ContextManager.activeSpan();
    span.errorOccurred();
    span.log(t);
}
 
Example 5
Source File: ServerInterceptor.java    From skywalking with Apache License 2.0 5 votes vote down vote up
@Override
public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
                          Object ret) throws Throwable {
    Response response = (Response) allArguments[1];
    if (response != null && response.getException() != null) {
        AbstractSpan span = ContextManager.activeSpan();
        span.log(response.getException());
        span.errorOccurred();
    }

    ContextManager.stopSpan();
    return ret;
}
 
Example 6
Source File: SessionManagerExecuteAndExecuteAsyncWithStatementArgInterceptor.java    From skywalking with Apache License 2.0 5 votes vote down vote up
@Override
public final void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
    Class<?>[] argumentsTypes, Throwable t) {
    if (ContextManager.isActive()) {
        AbstractSpan span = ContextManager.activeSpan();
        span.errorOccurred();
        span.log(t);
    }
}
 
Example 7
Source File: ProducerOperationHandlerInterceptor.java    From skywalking with Apache License 2.0 5 votes vote down vote up
@Override
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
    Class<?>[] argumentsTypes, Throwable t) {
    AbstractSpan span = ContextManager.activeSpan();
    span.errorOccurred();
    span.log(t);
}
 
Example 8
Source File: MongoDBCollectionMethodInterceptor.java    From skywalking with Apache License 2.0 5 votes vote down vote up
@Override
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
    Class<?>[] argumentsTypes, Throwable t) {
    AbstractSpan activeSpan = ContextManager.activeSpan();
    activeSpan.errorOccurred();
    activeSpan.log(t);
}
 
Example 9
Source File: TomcatInvokeInterceptor.java    From skywalking with Apache License 2.0 5 votes vote down vote up
@Override
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
    Class<?>[] argumentsTypes, Throwable t) {
    AbstractSpan span = ContextManager.activeSpan();
    span.log(t);
    span.errorOccurred();
}
 
Example 10
Source File: MongoDBOperationExecutorInterceptor.java    From skywalking with Apache License 2.0 5 votes vote down vote up
@Override
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
    Class<?>[] argumentsTypes, Throwable t) {
    AbstractSpan activeSpan = ContextManager.activeSpan();
    activeSpan.errorOccurred();
    activeSpan.log(t);
}
 
Example 11
Source File: XMemcachedMethodInterceptor.java    From skywalking with Apache License 2.0 5 votes vote down vote up
@Override
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
    Class<?>[] argumentsTypes, Throwable t) {
    AbstractSpan span = ContextManager.activeSpan();
    span.errorOccurred();
    span.log(t);
}
 
Example 12
Source File: ForwardInterceptor.java    From skywalking with Apache License 2.0 5 votes vote down vote up
@Override
public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
    MethodInterceptResult result) throws Throwable {
    if (ContextManager.isActive()) {
        AbstractSpan abstractTracingSpan = ContextManager.activeSpan();
        Map<String, String> eventMap = new HashMap<String, String>();
        eventMap.put("forward-url", (String) objInst.getSkyWalkingDynamicField());
        abstractTracingSpan.log(System.currentTimeMillis(), eventMap);
        ContextManager.getRuntimeContext().put(Constants.FORWARD_REQUEST_FLAG, true);
    }
}
 
Example 13
Source File: ActiveSpanErrorThrowableInteceptor.java    From skywalking with Apache License 2.0 5 votes vote down vote up
@Override
public void beforeMethod(Class clazz, Method method, Object[] allArguments, Class<?>[] parameterTypes,
    MethodInterceptResult result) {
    AbstractSpan activeSpan = null;
    try {
        activeSpan = ContextManager.activeSpan();
        activeSpan.errorOccurred();
        activeSpan.log((Throwable) allArguments[0]);
    } catch (NullPointerException e) {
    }
}
 
Example 14
Source File: RealCallInterceptor.java    From skywalking with Apache License 2.0 5 votes vote down vote up
@Override
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
    Class<?>[] argumentsTypes, Throwable t) {
    AbstractSpan abstractSpan = ContextManager.activeSpan();
    abstractSpan.errorOccurred();
    abstractSpan.log(t);
}
 
Example 15
Source File: ActiveSpanErrorMsgInterceptor.java    From skywalking with Apache License 2.0 5 votes vote down vote up
@Override
public void beforeMethod(Class clazz, Method method, Object[] allArguments, Class<?>[] parameterTypes,
    MethodInterceptResult result) {
    AbstractSpan activeSpan = null;
    try {
        activeSpan = ContextManager.activeSpan();
        activeSpan.errorOccurred();
        Map<String, String> event = new HashMap<String, String>();
        event.put("event", "error");
        event.put("message", String.valueOf(allArguments[0]));
        activeSpan.log(System.currentTimeMillis(), event);

    } catch (NullPointerException e) {
    }
}
 
Example 16
Source File: ProducerOperationHandlerInterceptor.java    From skywalking with Apache License 2.0 5 votes vote down vote up
@Override
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
    Class<?>[] argumentsTypes, Throwable t) {
    AbstractSpan span = ContextManager.activeSpan();
    span.errorOccurred();
    span.log(t);
}
 
Example 17
Source File: FiberInterceptor.java    From skywalking with Apache License 2.0 5 votes vote down vote up
@Override
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
                                  Class<?>[] argumentsTypes, Throwable t) {
    AbstractSpan span = ContextManager.activeSpan();
    span.errorOccurred();
    span.log(t);
}
 
Example 18
Source File: DefaultResultSetFutureGetUninterruptiblyInterceptor.java    From skywalking with Apache License 2.0 5 votes vote down vote up
@Override
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
    Class<?>[] argumentsTypes, Throwable t) {
    if (ContextManager.isActive()) {
        AbstractSpan span = ContextManager.activeSpan();
        span.errorOccurred();
        span.log(t);
    }
}
 
Example 19
Source File: SofaRpcProviderInterceptor.java    From skywalking with Apache License 2.0 4 votes vote down vote up
/**
 * Log the throwable, which occurs in Dubbo RPC service.
 */
private void dealException(Throwable throwable) {
    AbstractSpan span = ContextManager.activeSpan();
    span.errorOccurred();
    span.log(throwable);
}
 
Example 20
Source File: ClientInterceptor.java    From skywalking with Apache License 2.0 4 votes vote down vote up
private void dealException(Throwable throwable) {
    AbstractSpan span = ContextManager.activeSpan();
    span.errorOccurred();
    span.log(throwable);
}