Skip to content

Files

Latest commit

b57c1a0 · Jan 30, 2024

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Jan 30, 2024
Nov 17, 2022
Jan 4, 2024

Library Instrumentation for Apache RocketMQ remoting-based client 4.0.0+

Provides OpenTelemetry instrumentation for Apache RocketMQ remoting-based client.

Quickstart

Add the following dependencies to your project

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")

Usage

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());
}