Search in sources :

Example 1 with AMQChannel

use of com.rabbitmq.client.impl.AMQChannel in project pinpoint by naver.

the class RabbitMQConsumerHandleCompleteInboundCommandInterceptor method before.

@Override
public void before(Object target, Object[] args) {
    if (!validate(target, args)) {
        return;
    }
    AMQCommand command = (AMQCommand) args[0];
    Method method = command.getMethod();
    if (!(method instanceof AMQP.Basic.GetOk)) {
        return;
    }
    if (isDebug) {
        logger.beforeInterceptor(target, args);
    }
    try {
        AMQChannel channel = (AMQChannel) target;
        final Trace trace = createTrace(channel, command);
        if (trace == null) {
            return;
        }
        if (!trace.canSampled()) {
            return;
        }
        SpanEventRecorder recorder = trace.traceBlockBegin();
        recorder.recordServiceType(RabbitMQClientConstants.RABBITMQ_CLIENT_INTERNAL);
    } catch (Throwable th) {
        if (logger.isWarnEnabled()) {
            logger.warn("BEFORE. Caused:{}", th.getMessage(), th);
        }
    }
}
Also used : AMQChannel(com.rabbitmq.client.impl.AMQChannel) Trace(com.navercorp.pinpoint.bootstrap.context.Trace) AMQP(com.rabbitmq.client.AMQP) SpanEventRecorder(com.navercorp.pinpoint.bootstrap.context.SpanEventRecorder) Method(com.rabbitmq.client.impl.Method) AMQCommand(com.rabbitmq.client.impl.AMQCommand)

Example 2 with AMQChannel

use of com.rabbitmq.client.impl.AMQChannel in project pinpoint by pinpoint-apm.

the class RabbitMQConsumerHandleCompleteInboundCommandInterceptor method before.

@Override
public void before(Object target, Object[] args) {
    if (!validate(target, args)) {
        return;
    }
    AMQCommand command = (AMQCommand) args[0];
    Method method = command.getMethod();
    if (!(method instanceof AMQP.Basic.GetOk)) {
        return;
    }
    if (isDebug) {
        logger.beforeInterceptor(target, args);
    }
    try {
        AMQChannel channel = (AMQChannel) target;
        final Trace trace = createTrace(channel, command);
        if (trace == null) {
            return;
        }
        if (!trace.canSampled()) {
            return;
        }
        SpanEventRecorder recorder = trace.traceBlockBegin();
        recorder.recordServiceType(RabbitMQClientConstants.RABBITMQ_CLIENT_INTERNAL);
    } catch (Throwable th) {
        if (logger.isWarnEnabled()) {
            logger.warn("BEFORE. Caused:{}", th.getMessage(), th);
        }
    }
}
Also used : AMQChannel(com.rabbitmq.client.impl.AMQChannel) Trace(com.navercorp.pinpoint.bootstrap.context.Trace) AMQP(com.rabbitmq.client.AMQP) SpanEventRecorder(com.navercorp.pinpoint.bootstrap.context.SpanEventRecorder) Method(com.rabbitmq.client.impl.Method) AMQCommand(com.rabbitmq.client.impl.AMQCommand)

Aggregations

SpanEventRecorder (com.navercorp.pinpoint.bootstrap.context.SpanEventRecorder)2 Trace (com.navercorp.pinpoint.bootstrap.context.Trace)2 AMQP (com.rabbitmq.client.AMQP)2 AMQChannel (com.rabbitmq.client.impl.AMQChannel)2 AMQCommand (com.rabbitmq.client.impl.AMQCommand)2 Method (com.rabbitmq.client.impl.Method)2