Search in sources :

Example 1 with SendStatus

use of org.apache.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(org.apache.rocketmq.client.producer.SendResult) SendStatus(org.apache.rocketmq.client.producer.SendStatus) SendCallBackEnhanceInfo(org.apache.skywalking.apm.plugin.rocketMQ.v4.define.SendCallBackEnhanceInfo) AbstractSpan(org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan)

Aggregations

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