Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docs for library instrumentation of RocketMQ remoting-based client #6960

Merged
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Settings for the Apache RocketMQ client instrumentation
# Settings for the Apache RocketMQ Remoting-based client instrumentation

| System property | Type | Default | Description |
|---|---|---|---|
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Manual Instrumentation for Apache RocketMQ Remoting-based Client version 4.0.0+
aaron-ai marked this conversation as resolved.
Show resolved Hide resolved

Provides OpenTelemetry instrumentation for [Apache RocketMQ](https://rocketmq.apache.org/) Remoting-based Client.

## Quickstart

### Add the following dependencies to your project:

Replace `OPENTELEMETRY_VERSION` with the latest stable
[release](https://mvnrepository.com/artifact/io.opentelemetry). Minimum version is 1.1.0.
aaron-ai marked this conversation as resolved.
Show resolved Hide resolved

For Maven, add the following to your `pom.xml` dependencies:

```xml

<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:

```groovy
implementation("io.opentelemetry.instrumentation:opentelemetry-rocketmq-client-4.8:OPENTELEMETRY_VERSION")
```

### Usage

Remoting-based Client of RocketMQ provides the native interceptor to register the message hook in the instrumentation library.

aaron-ai marked this conversation as resolved.
Show resolved Hide resolved
```java
RocketMqTelemetry rocketMqTelemetry;

void configure(OpenTelemetry openTelemetry, DefaultMQProducerImpl producer, DefaultMQPushConsumerImpl pushConsumer) {
rocketMqTelemetry = RocketMqTelemetry.create(openTelemetry);
// For producer.
SendMessageHook sendMessageHook = rocketMqTelemetry.newTracingSendMessageHook();
producer.registerSendMessageHook(sendMessageHook);
// For push consumer.
ConsumeMessageHook consumeMessageHook = rocketMqTelemetry.newTracingConsumeMessageHook();
pushConsumer.registerConsumeMessageHook(consumeMessageHook);
aaron-ai marked this conversation as resolved.
Show resolved Hide resolved
}
```