-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add docs for library instrumentation of RocketMQ remoting-based client (
open-telemetry#6960) Fixes open-telemetry#6954 Co-authored-by: Fabrizio Ferri-Benedetti <[email protected]> Co-authored-by: Trask Stalnaker <[email protected]>
- Loading branch information
Showing
2 changed files
with
44 additions
and
1 deletion.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
instrumentation/rocketmq/rocketmq-client/rocketmq-client-4.8/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
instrumentation/rocketmq/rocketmq-client/rocketmq-client-4.8/library/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Library Instrumentation for Apache RocketMQ Remoting-based Client 4.0.0+ | ||
|
||
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 release](https://search.maven.org/search?q=g:io.opentelemetry.instrumentation%20AND%20a:opentelemetry-rocketmq-client-4.8). | ||
|
||
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 | ||
|
||
The instrumentation library provides the implementation of `SendMessageHook` and `ConsumeMessageHook` to provide OpenTelemetry-based spans and context propagation. | ||
|
||
```java | ||
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()); | ||
} | ||
``` |