Search before asking
Apache SkyWalking Component
Java Agent (apache/skywalking-java)
What happened
Problem Description
When using the skywalking-java agent to collect trace data for RabbitMQ message production and consumption, two key issues persist:
1. TraceId disconnection between producer and consumer services
The trace links of RabbitMQ message production (by producer service) and consumption (by consumer service) cannot be connected through a single traceId.
Example scenario:
- Java Service A (producer) sends a RabbitMQ message.
- Java Service B (consumer) consumes this message.
Expected behavior: The entire call chain (Service A → RabbitMQ → Service B) should be connected via one unified traceId.
Actual issue: The consumer thread in Service B fails to retrieve the skywalking-java traceId when consuming the RabbitMQ message, leading to disconnected trace links between Service A and Service B.
2. Incomplete consumer trace stack
The collected trace stack for the RabbitMQ consumer only shows a single layer named "rabbitmq", and does not attach the details of subsequent business operations (e.g., MySQL queries, Redis operations) associated with message consumption. (As shown in the attached screenshot below)
Related Historical Issues
I searched the issue list and found two similar unresolved issues regarding RabbitMQ trace collection:
Solution Status
I have developed a complete solution for the above issues, and it has been fully tested to effectively resolve all the mentioned problems. (As shown in the attached screenshot below)
Request for Guidance
Could you please guide me on the official process to submit the code patch for this fix? Specifically, I would like to know:
-
The target branch to submit the PR to (e.g., master, release-x.x)
-
Any coding standards or PR template requirements to follow
-
The code review process and key points to note
What you expected to happen
After troubleshooting the code of the RabbitMQ collection plugin, I found that the method intercepted by the instrumentation is executed in a thread pool dedicated to RabbitMQ message processing, which is not the same thread as the one where the consumer actually executes the business logic code. This thread inconsistency leads to the loss of trace information.
How to reproduce
Steps to Reproduce the Issue
-
In a Java service, write code to send a RabbitMQ message.
-
Then write code to consume the RabbitMQ message, and add a database query operation in the consumption logic.
This is a 100% reproducible issue (consistently reproducible) and can be easily reproduced.
Anything else
No response
Are you willing to submit a pull request to fix on your own?
Code of Conduct
Search before asking
Apache SkyWalking Component
Java Agent (apache/skywalking-java)
What happened
Problem Description
When using the skywalking-java agent to collect trace data for RabbitMQ message production and consumption, two key issues persist:
1. TraceId disconnection between producer and consumer services
The trace links of RabbitMQ message production (by producer service) and consumption (by consumer service) cannot be connected through a single traceId.
Example scenario:
2. Incomplete consumer trace stack
The collected trace stack for the RabbitMQ consumer only shows a single layer named "rabbitmq", and does not attach the details of subsequent business operations (e.g., MySQL queries, Redis operations) associated with message consumption. (As shown in the attached screenshot below)
Related Historical Issues
I searched the issue list and found two similar unresolved issues regarding RabbitMQ trace collection:
[Bug] In springboot+rabbitmq projects, rabbitmq listener did not generates traceId automatically. #11300
skywalking plugin apm-rabbitmq-5.x-plugin-8.5.0 cannot trace customer #7018
Solution Status
I have developed a complete solution for the above issues, and it has been fully tested to effectively resolve all the mentioned problems. (As shown in the attached screenshot below)
Request for Guidance
Could you please guide me on the official process to submit the code patch for this fix? Specifically, I would like to know:
The target branch to submit the PR to (e.g., master, release-x.x)
Any coding standards or PR template requirements to follow
The code review process and key points to note
What you expected to happen
After troubleshooting the code of the RabbitMQ collection plugin, I found that the method intercepted by the instrumentation is executed in a thread pool dedicated to RabbitMQ message processing, which is not the same thread as the one where the consumer actually executes the business logic code. This thread inconsistency leads to the loss of trace information.
How to reproduce
Steps to Reproduce the Issue
In a Java service, write code to send a RabbitMQ message.
Then write code to consume the RabbitMQ message, and add a database query operation in the consumption logic.
This is a 100% reproducible issue (consistently reproducible) and can be easily reproduced.
Anything else
No response
Are you willing to submit a pull request to fix on your own?
Code of Conduct