From 0bf866e2b5863213a6ea883b583866930320c120 Mon Sep 17 00:00:00 2001 From: Aaron Ai Date: Tue, 25 Oct 2022 13:57:04 +0800 Subject: [PATCH] Add docs for library instrumentation of RocketMQ remoting-based client (#6960) Fixes #6954 Co-authored-by: Fabrizio Ferri-Benedetti Co-authored-by: Trask Stalnaker --- .../rocketmq-client-4.8/README.md | 2 +- .../rocketmq-client-4.8/library/README.md | 43 +++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 instrumentation/rocketmq/rocketmq-client/rocketmq-client-4.8/library/README.md diff --git a/instrumentation/rocketmq/rocketmq-client/rocketmq-client-4.8/README.md b/instrumentation/rocketmq/rocketmq-client/rocketmq-client-4.8/README.md index ecab513000d6..abd02b0eb7ac 100644 --- a/instrumentation/rocketmq/rocketmq-client/rocketmq-client-4.8/README.md +++ b/instrumentation/rocketmq/rocketmq-client/rocketmq-client-4.8/README.md @@ -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 | |---|---|---|---| diff --git a/instrumentation/rocketmq/rocketmq-client/rocketmq-client-4.8/library/README.md b/instrumentation/rocketmq/rocketmq-client/rocketmq-client-4.8/library/README.md new file mode 100644 index 000000000000..f87f6d89b3a2 --- /dev/null +++ b/instrumentation/rocketmq/rocketmq-client/rocketmq-client-4.8/library/README.md @@ -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 + + + io.opentelemetry.instrumentation + opentelemetry-rocketmq-client-4.8 + OPENTELEMETRY_VERSION + + +``` + +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()); +} +```