Search in sources :

Example 1 with EndPointAccessor

use of com.navercorp.pinpoint.plugin.redis.jedis.EndPointAccessor in project pinpoint by naver.

the class JedisMethodInterceptor method doInAfterTrace.

@Override
public void doInAfterTrace(SpanEventRecorder recorder, Object target, Object[] args, Object result, Throwable throwable) {
    String endPoint = null;
    if (target instanceof EndPointAccessor) {
        endPoint = ((EndPointAccessor) target)._$PINPOINT$_getEndPoint();
    }
    final InterceptorScopeInvocation invocation = interceptorScope.getCurrentInvocation();
    final Object attachment = getAttachment(invocation);
    if (attachment instanceof CommandContext) {
        final CommandContext commandContext = (CommandContext) attachment;
        if (logger.isDebugEnabled()) {
            logger.debug("Check command context {}", commandContext);
        }
        recordIo(recorder, commandContext);
        // clear
        invocation.removeAttachment();
    }
    recorder.recordApi(getMethodDescriptor());
    recorder.recordEndPoint(endPoint != null ? endPoint : "Unknown");
    recorder.recordDestinationId(JedisConstants.REDIS.getName());
    recorder.recordServiceType(JedisConstants.REDIS);
    recorder.recordException(throwable);
}
Also used : EndPointAccessor(com.navercorp.pinpoint.plugin.redis.jedis.EndPointAccessor) InterceptorScopeInvocation(com.navercorp.pinpoint.bootstrap.interceptor.scope.InterceptorScopeInvocation) CommandContext(com.navercorp.pinpoint.plugin.redis.jedis.CommandContext)

Aggregations

InterceptorScopeInvocation (com.navercorp.pinpoint.bootstrap.interceptor.scope.InterceptorScopeInvocation)1 CommandContext (com.navercorp.pinpoint.plugin.redis.jedis.CommandContext)1 EndPointAccessor (com.navercorp.pinpoint.plugin.redis.jedis.EndPointAccessor)1