skywalking icon indicating copy to clipboard operation
skywalking copied to clipboard

rabbit in spring boot project, the one total trace will divide two trace

Open zxbu opened this issue 7 years ago • 9 comments

Please answer these questions before submitting your issue.

  • Why do you submit this issue?
  • [ ] Question or discussion
  • [x] Bug
  • [ ] Requirement
  • [ ] Feature or performance improvement

Bug

  • Which version of SkyWalking, OS and JRE? 6.1
  • Which company or project? use rabbit @RabbitListener in spring project, the code like this:
    @RabbitListener(queues = "aaaa")
    public void handlerMessage(String message) {
        //  there will invoke dubbo service
    }

It should be one trace like: rabbitmq-producer -> rabbitmq-consumer -> dubbo but in fact, I got two trace: rabbitmq-producer -> rabbitmq-consumer and dubbo

image

I have find the reason: the rabbit producer InstanceMethodsInterceptPoint was com.rabbitmq.client.impl.ChannelN#basicPublish , it will call at AMQP Connection Thread, But @RabbitListener method will call at other thread, So the trace will divide two trace

zxbu avatar May 20 '19 08:05 zxbu

If set InstanceMethodsInterceptPoint is org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer#actualInvokeListener will solve this. But it was only support rabbit in spring boot not native rabbit. So what do you think ? @wu-sheng

zxbu avatar May 20 '19 08:05 zxbu

Then we need another instrumentation to make the across threads work.

wu-sheng avatar May 20 '19 08:05 wu-sheng

what do you think about make a spring rabbit plugin as a optional plugin?

zxbu avatar May 20 '19 08:05 zxbu

Optional plugin means

  1. The plugin is only required in particular cases

Or

  1. The plugin has performance concerns.

From the thing you post, look like this is a common spring for spring-rabbitmq-plugin. SkyWalking plugin is auto active, which means, when you don't active org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer#actualInvokeListener in your codes, it should stay cold.

wu-sheng avatar May 20 '19 08:05 wu-sheng

No update in more than one month. Closing.

wu-sheng avatar Jul 02 '19 14:07 wu-sheng

is this feature still need to be contributed? I think it can be implemented by adding intercept points in spring-amqp interfaces since spring-rabbit is an implementation for that.

qsliu2017 avatar Jul 20 '21 12:07 qsliu2017

is this feature still need to be contributed? I think it can be implemented by adding intercept points in spring-amqp interfaces since spring-rabbit is an implementation for that.

Contribution is welcome, you could read the plugin dev doc, the last part is about what are required to contribute a plugin or enhance a plugin.

wu-sheng avatar Jul 20 '21 12:07 wu-sheng

I make a spring-rabbit-plugin demo and test it. Now the trace looks like 截屏2021-07-22 下午2 06 16 A calling to rabbitmq generates 2 branches, one by spring-rabbit-plugin, another by rabbitmq-plugin. Any way to disable the original rabbit plugin when enable spring-rabbit plugin?

qsliu2017 avatar Jul 22 '21 06:07 qsliu2017

Remove the plugin jar from thr folder.

wu-sheng avatar Jul 22 '21 07:07 wu-sheng