Provides OpenTelemetry instrumentation for Apache RocketMQ remoting-based client.
Replace OPENTELEMETRY_VERSION
with the latest release.
For Maven, add the following to your pom.xml
dependencies:
<dependencies>
<dependency>
<groupId>io.opentelemetry.instrumentation</groupId>
<artifactId>opentelemetry-rocketmq-client-4.8</artifactId>
<version>OPENTELEMETRY_VERSION</version>
</dependency>
</dependencies>
For Gradle, add the following to your dependencies:
implementation("io.opentelemetry.instrumentation:opentelemetry-rocketmq-client-4.8:OPENTELEMETRY_VERSION")
The instrumentation library provides the implementation of SendMessageHook
and ConsumeMessageHook
to provide OpenTelemetry-based spans and context propagation.
RocketMqTelemetry rocketMqTelemetry;
void configure(OpenTelemetry openTelemetry, DefaultMQProducerImpl producer, DefaultMQPushConsumerImpl pushConsumer) {
rocketMqTelemetry = RocketMqTelemetry.create(openTelemetry);
// For producer.
producer.registerSendMessageHook(rocketMqTelemetry.newTracingSendMessageHook());
// For push consumer.
pushConsumer.registerConsumeMessageHook(rocketMqTelemetry.newTracingConsumeMessageHook());
}