Search in sources :

Example 1 with SendStatus

use of com.alibaba.rocketmq.client.producer.SendStatus in project incubator-skywalking by apache.

the class OnSuccessInterceptor method beforeMethod.

@Override
public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, MethodInterceptResult result) throws Throwable {
    SendCallBackEnhanceInfo enhanceInfo = (SendCallBackEnhanceInfo) objInst.getSkyWalkingDynamicField();
    AbstractSpan activeSpan = ContextManager.createLocalSpan(CALLBACK_OPERATION_NAME_PREFIX + enhanceInfo.getTopicId() + "/Producer/Callback");
    activeSpan.setComponent(ComponentsDefine.ROCKET_MQ);
    SendStatus sendStatus = ((SendResult) allArguments[0]).getSendStatus();
    if (sendStatus != SendStatus.SEND_OK) {
        activeSpan.errorOccurred();
        Tags.STATUS_CODE.set(activeSpan, sendStatus.name());
    }
    ContextManager.continued(enhanceInfo.getContextSnapshot());
}
Also used : SendResult(com.alibaba.rocketmq.client.producer.SendResult) SendStatus(com.alibaba.rocketmq.client.producer.SendStatus) SendCallBackEnhanceInfo(org.apache.skywalking.apm.plugin.rocketMQ.v3.define.SendCallBackEnhanceInfo) AbstractSpan(org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan)

Aggregations

SendResult (com.alibaba.rocketmq.client.producer.SendResult)1 SendStatus (com.alibaba.rocketmq.client.producer.SendStatus)1 AbstractSpan (org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan)1 SendCallBackEnhanceInfo (org.apache.skywalking.apm.plugin.rocketMQ.v3.define.SendCallBackEnhanceInfo)1