Skip to content

Commit

Permalink
Add docs for library instrumentation of RocketMQ remoting-based client
Browse files Browse the repository at this point in the history
  • Loading branch information
aaron-ai committed Oct 24, 2022
1 parent f6766c7 commit 4afa624
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
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+

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

## Quickstart

### Add these dependencies to your project:

Replace `OPENTELEMETRY_VERSION` with the latest stable
[release](https://mvnrepository.com/artifact/io.opentelemetry). `Minimum version: 1.1.0`

For Maven, add 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 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.

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

0 comments on commit 4afa624

Please sign in to comment.