io.opentracing.contrib:opentracing-spring-rabbitmq

OpenTracing instrumentation for RabbitMQ

License

License

GroupId

GroupId

io.opentracing.contrib
ArtifactId

ArtifactId

opentracing-spring-rabbitmq
Last Version

Last Version

3.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

OpenTracing instrumentation for RabbitMQ

Download opentracing-spring-rabbitmq

How to add to project

<!-- https://jarcasting.com/artifacts/io.opentracing.contrib/opentracing-spring-rabbitmq/ -->
<dependency>
    <groupId>io.opentracing.contrib</groupId>
    <artifactId>opentracing-spring-rabbitmq</artifactId>
    <version>3.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/io.opentracing.contrib/opentracing-spring-rabbitmq/
implementation 'io.opentracing.contrib:opentracing-spring-rabbitmq:3.0.1'
// https://jarcasting.com/artifacts/io.opentracing.contrib/opentracing-spring-rabbitmq/
implementation ("io.opentracing.contrib:opentracing-spring-rabbitmq:3.0.1")
'io.opentracing.contrib:opentracing-spring-rabbitmq:jar:3.0.1'
<dependency org="io.opentracing.contrib" name="opentracing-spring-rabbitmq" rev="3.0.1">
  <artifact name="opentracing-spring-rabbitmq" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.opentracing.contrib', module='opentracing-spring-rabbitmq', version='3.0.1')
)
libraryDependencies += "io.opentracing.contrib" % "opentracing-spring-rabbitmq" % "3.0.1"
[io.opentracing.contrib/opentracing-spring-rabbitmq "3.0.1"]

Dependencies

compile (4)

Group / Artifact Type Version
io.opentracing : opentracing-api Optional jar 0.33.0
org.springframework.boot : spring-boot-starter-amqp Optional jar
org.springframework.boot : spring-boot-starter-web Optional jar
org.springframework.boot : spring-boot-starter-aop jar

provided (1)

Group / Artifact Type Version
org.projectlombok : lombok jar 1.16.18

test (6)

Group / Artifact Type Version
junit : junit jar
org.springframework.boot : spring-boot-starter-test jar
org.mockito : mockito-core jar
org.assertj : assertj-core jar
io.opentracing : opentracing-mock jar 0.33.0
io.opentracing : opentracing-util test-jar 0.33.0

Project Modules

There are no modules declared in this project.

Build Status Released Version

OpenTracing Spring RabbitMQ

Provides message tracing for RabbitMQ through Spring AMQP. It can be used with any OpenTracing compatible implementation.

Compatibility table

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

Sent messages

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)

Received messages

At startup a RabbitMqReceiveTracingInterceptor, will be added toSimpleMessageListenerContainer or DirectMessageListenerContaineradvice chain, depending on your configuration.

@RabbitListener will also benefit from it.

Span decorator

By default, a RabbitMqSpanDecorator is provided, with the following attributes:

On send span

  • component: rabbitmq
  • exchange: [exchange_name]
  • messageid: [message_id]
  • routingkey: [routing_key]

On receive span

  • component: rabbitmq
  • exchange: [exchange_name]
  • messageid: [message_id]
  • routingkey: [routing_key]
  • consumerqueue: [consumer_queue]

On send reply

Nothing by default.

On error

  • event: error key
  • error.object: exception

Note: you can customize your spans by declaring an overridden RabbitMqSpanDecorator bean.

Usage

This library is embedded in java-spring-cloud

Usage with Jaeger tracer

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>

Usage with Zipkin tracer

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>

Standalone usage

Note: make sure that an io.opentracing.Tracer bean is available. It is not provided by this library.

With Spring Boot

Add the following starter dependency to your pom.xml:

<dependency>
  <groupId>io.opentracing.contrib</groupId>
  <artifactId>opentracing-spring-rabbitmq-starter</artifactId>
</dependency>

With Spring

Add the following dependency to your pom.xml:

<dependency>
  <groupId>io.opentracing.contrib</groupId>
  <artifactId>opentracing-spring-rabbitmq</artifactId>
</dependency>

Jaeger UI example

Alt text

Development

Maven checkstyle plugin is used to maintain consistent code style based on Google Style Guides

./mvnw clean install

Release

Follow instructions in RELEASE

io.opentracing.contrib

3rd-Party OpenTracing API Contributions

3rd-party contributions that use OpenTracing. **The repositories in this org are *not* affiliated with the CNCF.**

Versions

Version
3.0.1
3.0.0
2.0.5
2.0.4
2.0.3
2.0.2
2.0.1
2.0.0
1.0.2
1.0.1
1.0.0
0.1.2
0.1.1
0.1.0