YMJake.RocketMQ.Client.OpenTelemetry 1.0.1

dotnet add package YMJake.RocketMQ.Client.OpenTelemetry --version 1.0.1
                    
NuGet\Install-Package YMJake.RocketMQ.Client.OpenTelemetry -Version 1.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="YMJake.RocketMQ.Client.OpenTelemetry" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="YMJake.RocketMQ.Client.OpenTelemetry" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="YMJake.RocketMQ.Client.OpenTelemetry" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add YMJake.RocketMQ.Client.OpenTelemetry --version 1.0.1
                    
#r "nuget: YMJake.RocketMQ.Client.OpenTelemetry, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package YMJake.RocketMQ.Client.OpenTelemetry@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=YMJake.RocketMQ.Client.OpenTelemetry&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=YMJake.RocketMQ.Client.OpenTelemetry&version=1.0.1
                    
Install as a Cake Tool

YMJake.RocketMQ.Client.OpenTelemetry

License NuGet

OpenTelemetry instrumentation for YMJake.RocketMQ.Client - Automatic distributed tracing for Apache RocketMQ 5.x messaging operations.

Features

  • ✅ Automatic tracing for message send and receive operations
  • ✅ W3C Trace Context propagation (traceparent/tracestate)
  • ✅ OpenTelemetry semantic conventions for messaging
  • ✅ RocketMQ-specific attributes (namespace, message type, tags, etc.)
  • ✅ Batch message support
  • ✅ Customizable filtering and enrichment
  • ✅ Zero code changes required in your application

Supports .NET 8.0 (LTS) and .NET 10.0

Installation

dotnet add package YMJake.RocketMQ.Client.OpenTelemetry

Quick Start

using OpenTelemetry;
using OpenTelemetry.Resources;
using OpenTelemetry.Trace;
using RocketMQ.Client.OpenTelemetry;

var tracerProvider = Sdk.CreateTracerProviderBuilder()
    .SetResourceBuilder(ResourceBuilder.CreateDefault()
        .AddService("my-service"))
    .AddRocketMqInstrumentation()
    .AddOtlpExporter()  // or AddConsoleExporter(), AddJaegerExporter(), etc.
    .Build();

That's it! The instrumentation automatically listens to DiagnosticListener events emitted by the RocketMQ client and produces spans for all send and receive operations.

Advanced Configuration

Filtering Messages

.AddRocketMqInstrumentation(options =>
{
    // Only trace messages from specific topics
    options.Filter = data => 
        data.Messages.Any(m => m.Topic.StartsWith("important-"));
})

Custom Tag Conversion

.AddRocketMqInstrumentation(options =>
{
    // Truncate message IDs for readability
    options.TagValueConverter = (name, value) =>
        name == "messaging.message.id" ? value?.Substring(0, 8) : value;
})

Additional Attributes

.AddRocketMqInstrumentation(options =>
{
    options.AdditionalAttributes["environment"] = () => "production";
    options.AdditionalAttributes["version"] = () => "1.0.0";
})

Span Attributes

The instrumentation follows OpenTelemetry semantic conventions and adds the following attributes:

Standard Messaging Attributes

  • messaging.system = "rocketmq"
  • messaging.operation = "publish" | "receive"
  • messaging.destination.name = topic name
  • messaging.message.id = message ID
  • messaging.message.body.size = message body size in bytes
  • messaging.batch.message_count = number of messages in batch
  • messaging.client_id = RocketMQ client ID

RocketMQ-Specific Attributes

  • messaging.rocketmq.namespace = RocketMQ namespace
  • messaging.rocketmq.message.type = "normal" | "fifo" | "delay"
  • messaging.rocketmq.message.tag = message tag
  • messaging.rocketmq.message.group = message group (for FIFO)
  • messaging.rocketmq.client_group = consumer group
  • messaging.rocketmq.message.delivery_timestamp = scheduled delivery time

How It Works

The instrumentation uses .NET's DiagnosticListener to subscribe to events emitted by the RocketMQ client. It automatically:

  1. Creates spans for send and receive operations
  2. Propagates trace context via message properties (traceparent/tracestate)
  3. Links consumer spans to producer spans for distributed tracing
  4. Sets appropriate span status based on operation results

No changes are required in your application code beyond adding the instrumentation to your TracerProvider.

License

Apache License 2.0. Based on Apache RocketMQ Clients.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 403 11/19/2025

v1.0.1: Verified production-ready with complete trace context propagation, enterprise-grade semantic conventions, and zero-overhead instrumentation. Tested with Jaeger/Zipkin/Tempo backends.