Provides message tracing for RabbitMQ through Spring AMQP. It can be used with any OpenTracing compatible implementation.
| Version | OpenTracing API | Spring Boot version |
|---|---|---|
| 0.x.x | 0.31.0 | 1.5.x |
| 1.x.x | 0.31.0 | 2.1.x |
| 1.0.2 | 0.32.0 | 2.1.x |
| 2.0.x | 0.32.0 | 2.1.x |
| 3.0.x | 0.33.0 | 2.1.x |
The following methods are instrumented:
| Class | Method | Instrumented |
|---|---|---|
| AmqpTemplate | void send(Message message) |
✔ |
| AmqpTemplate | void send(String routingKey, Message message) |
✔ |
| AmqpTemplate | void send(String exchange, String routingKey, Message message) |
✔ |
| AmqpTemplate | void convertAndSend(Object message) |
✔ |
| AmqpTemplate | void convertAndSend(String routingKey, Object message) |
✔ |
| AmqpTemplate | void convertAndSend(String exchange, String routingKey, Object message) |
✔ |
| AmqpTemplate | void convertAndSend(Object message, MessagePostProcessor messagePostProcessor) |
✔ |
| AmqpTemplate | void convertAndSend(String routingKey, Object message, MessagePostProcessor messagePostProcessor) |
✔ |
| AmqpTemplate | void convertAndSend(String exchange, String routingKey, Object message, MessagePostProcessor messagePostProcessor) |
✔ |
| AmqpTemplate | void convertAndSend(String exchange, String routingKey, Object message, @Nullable CorrelationData correlationData) |
✔ |
| AmqpTemplate | Message sendAndReceive(Message message) |
✔ |
| AmqpTemplate | Message sendAndReceive(String routingKey, Message message) |
✔ |
| AmqpTemplate | Message sendAndReceive(String exchange, String routingKey, Message message) |
✔ |
| AmqpTemplate | Object convertSendAndReceive(Object message) |
✔ |
| AmqpTemplate | Object convertSendAndReceive(String routingKey, Object message) |
✔ |
| AmqpTemplate | Object convertSendAndReceive(String exchange, String routingKey, Object message) |
✔ |
| AmqpTemplate | Object convertSendAndReceive(Object message, MessagePostProcessor messagePostProcessor) |
✔ |
| AmqpTemplate | Object convertSendAndReceive(String routingKey, Object message, MessagePostProcessor messagePostProcessor) |
✔ |
| AmqpTemplate | Object convertSendAndReceive(String exchange, String routingKey, Object message, MessagePostProcessor messagePostProcessor) |
✔ |
| AmqpTemplate | <T> T convertSendAndReceiveAsType(Object message, ParameterizedTypeReference<T> responseType) |
❌ |
| AmqpTemplate | <T> T convertSendAndReceiveAsType(String routingKey, Object message,ParameterizedTypeReference<T> responseType) |
❌ |
| AmqpTemplate | <T> T convertSendAndReceiveAsType(String routingKey, Object message, MessagePostProcessor messagePostProcessor, ParameterizedTypeReference<T> responseType) |
❌ |
| AmqpTemplate | <T> T convertSendAndReceiveAsType(String exchange, String routingKey, Object message,MessagePostProcessor messagePostProcessor, ParameterizedTypeReference<T> responseType) |
❌ |
| RabbitTemplate | Message sendAndReceive(final String exchange, final String routingKey, final Message message, @Nullable CorrelationData correlationData) |
✔ |
| RabbitTemplate | Object convertSendAndReceive(final String exchange, final String routingKey, final Object message, @Nullable CorrelationData correlationData) |
✔ |
At startup a RabbitMqReceiveTracingInterceptor, will be added toSimpleMessageListenerContainer or
DirectMessageListenerContaineradvice chain, depending on your configuration.
@RabbitListener will also benefit from it.
By default, a RabbitMqSpanDecorator is provided, with the following attributes:
- component: rabbitmq
- exchange: [exchange_name]
- messageid: [message_id]
- routingkey: [routing_key]
- component: rabbitmq
- exchange: [exchange_name]
- messageid: [message_id]
- routingkey: [routing_key]
- consumerqueue: [consumer_queue]
Nothing by default.
- event: error key
- error.object: exception
Note: you can customize your spans by declaring an overridden
RabbitMqSpanDecoratorbean.
This library is embedded in java-spring-cloud
If you want to use Jaeger as tracer, you can benefit directly from it by importing java-spring-jaeger.
<dependency>
<groupId>io.opentracing.contrib</groupId>
<artifactId>opentracing-spring-jaeger-cloud-starter</artifactId>
</dependency>If you want to use Zipkin as tracer, you can benefit directly from it by importing java-spring-zipkin.
<dependency>
<groupId>io.opentracing.contrib</groupId>
<artifactId>opentracing-spring-zipkin-cloud-starter</artifactId>
</dependency>Note: make sure that an
io.opentracing.Tracerbean is available. It is not provided by this library.
Add the following starter dependency to your pom.xml:
<dependency>
<groupId>io.opentracing.contrib</groupId>
<artifactId>opentracing-spring-rabbitmq-starter</artifactId>
</dependency>Add the following dependency to your pom.xml:
<dependency>
<groupId>io.opentracing.contrib</groupId>
<artifactId>opentracing-spring-rabbitmq</artifactId>
</dependency>Maven checkstyle plugin is used to maintain consistent code style based on Google Style Guides
./mvnw clean installFollow instructions in RELEASE
