MessageWorkerPool.OpenTelemetry 0.4.0

dotnet add package MessageWorkerPool.OpenTelemetry --version 0.4.0
                    
NuGet\Install-Package MessageWorkerPool.OpenTelemetry -Version 0.4.0
                    
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="MessageWorkerPool.OpenTelemetry" Version="0.4.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MessageWorkerPool.OpenTelemetry" Version="0.4.0" />
                    
Directory.Packages.props
<PackageReference Include="MessageWorkerPool.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 MessageWorkerPool.OpenTelemetry --version 0.4.0
                    
#r "nuget: MessageWorkerPool.OpenTelemetry, 0.4.0"
                    
#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 MessageWorkerPool.OpenTelemetry@0.4.0
                    
#: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=MessageWorkerPool.OpenTelemetry&version=0.4.0
                    
Install as a Cake Addin
#tool nuget:?package=MessageWorkerPool.OpenTelemetry&version=0.4.0
                    
Install as a Cake Tool

MessageWorkerPool.OpenTelemetry

OpenTelemetry extensions for MessageWorkerPool providing comprehensive observability with metrics and distributed tracing capabilities.

Features

  • Metrics: Monitor worker pool performance, message processing rates, and resource utilization
  • Distributed Tracing: Track message flow across worker processes with context propagation
  • OpenTelemetry Integration: Seamless integration with OpenTelemetry collectors and exporters
  • Prometheus Support: Built-in Prometheus HTTP listener exporter
  • OTLP Support: Export telemetry data using OpenTelemetry Protocol

Installation

dotnet add package MessageWorkerPool.OpenTelemetry

Usage

Add OpenTelemetry to your MessageWorkerPool application:

using MessageWorkerPool.OpenTelemetry.Extensions;

builder.Services.AddMessageWorkerPoolTelemetry(options =>
{
    options.ServiceName = "MyWorkerService";
    options.ServiceVersion = "1.0.0";

    // Configure metrics with OTLP exporter
    options.ConfigureMetrics = metrics =>
    {
        metrics.AddOtlpExporter(otlpOptions =>
        {
            otlpOptions.Endpoint = new Uri("http://otel-collector:4317");
        });
    };
});

Custom Service Instance ID

By default, OpenTelemetry generates a random UUID for each service instance. You can customize this to use meaningful identifiers like Docker container names or hostnames:

builder.Services.AddMessageWorkerPoolTelemetry(options =>
{
    options.ServiceName = "MyWorkerService";
    options.ServiceVersion = "1.0.0";

    // Option 1: Set custom instance ID directly
    options.ServiceInstanceId = "worker-container-01";

    // Option 2: Use environment variable (recommended for Docker/Kubernetes)
    options.ServiceInstanceId = Environment.GetEnvironmentVariable("OTEL_SERVICE_INSTANCE_ID");

    // Option 3: Leave null to auto-detect (priority order):
    // 1. HOSTNAME environment variable (Docker container name)
    // 2. COMPUTERNAME environment variable (Windows)
    // 3. DNS hostname
    // If all fail, OpenTelemetry SDK generates a UUID
});

Docker Container Setup

To use the container hostname as the instance ID in Docker Compose:

services:
  workersample:
    build: ./src/Examples/DotNetWorker
    environment:
      - OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317
      # The container name will be used as instance ID
      # Or explicitly set it:
      - OTEL_SERVICE_INSTANCE_ID=${HOSTNAME}

When you scale your service, each container will have a unique instance ID:

docker-compose up --scale workersample=3

This will create instances like:

  • workersample-1instance="workersample-1"
  • workersample-2instance="workersample-2"
  • workersample-3instance="workersample-3"

Available Metrics

The package provides various metrics including:

  • Message processing rate
  • Worker pool utilization
  • Message queue depth
  • Processing duration
  • Error rates

Distributed Tracing

Trace context is automatically propagated across worker processes, enabling end-to-end visibility of message processing flows.

Documentation

For more information, visit the MessageWorkerPool repository.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on MessageWorkerPool.OpenTelemetry:

Package Downloads
WorkerClient

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.4.0 116 11/3/2025
0.3.0 66 11/2/2025
0.2.0-alpha.1 129 10/29/2025