@Override
    public void after(Object target, Object[] args, Object result, Throwable throwable) {
        if (isDebug) {
            logger.afterInterceptor(target, args);
        }

        if (!validate(target, args)) {
            return;
        }

        final Trace trace = traceContext.currentTraceObject();
        if (trace == null) {
            return;
        }

        try {
            String exchange = (String) args[0];
            String routingKey = (String) args[1];

            if (exchange == null || exchange.equals("")) {
                exchange = RabbitMQClientConstants.UNKNOWN;
            }

            SpanEventRecorder recorder = trace.currentSpanEventRecorder();
            recorder.recordApi(descriptor);

            String endPoint = RabbitMQClientConstants.UNKNOWN;
            // Producer's endPoint should be the socket address of where the producer is actually connected to.
            final Connection connection = ((Channel) target).getConnection();
            if (connection instanceof AMQConnection) {
                AMQConnection amqConnection = (AMQConnection) connection;
                FrameHandler frameHandler = amqConnection.getFrameHandler();
                if (frameHandler instanceof RemoteAddressAccessor) {
                    endPoint = ((RemoteAddressAccessor) frameHandler)._$PINPOINT$_getRemoteAddress();
                }
            }
            recorder.recordEndPoint(endPoint);
            // DestinationId is used to render the virtual queue node.
            // We choose the exchange name as the logical name of the queue node.
            recorder.recordDestinationId("exchange-" + exchange);

            recorder.recordAttribute(RabbitMQClientConstants.RABBITMQ_EXCHANGE_ANNOTATION_KEY, exchange);
            recorder.recordAttribute(RabbitMQClientConstants.RABBITMQ_ROUTINGKEY_ANNOTATION_KEY, routingKey);

            recorder.recordException(throwable);

        } finally {
            trace.traceBlockEnd();
        }
    }
@author Jinkai.Ma
@author Jiaqi Feng
@author HyunGil Jeong
agent-module/plugins/rabbitmq/src/main/java/com/navercorp/pinpoint/plugin/rabbitmq/client/interceptor/ChannelBasicPublishInterceptor.java