Elyspio.Utils.Telemetry.MongoDB 1.1.2

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

Elyspio.Utils.Telemetry

Elyspio.Utils.Telemetry bootstraps OpenTelemetry tracing and metrics for ASP.NET Core applications.

Requirements

  • .NET 10 (net10.0)

Installation

Core package:

dotnet add package Elyspio.Utils.Telemetry

Optional instrumentation packages:

dotnet add package Elyspio.Utils.Telemetry.MongoDB
dotnet add package Elyspio.Utils.Telemetry.Sql
dotnet add package Elyspio.Utils.Telemetry.Redis
dotnet add package Elyspio.Utils.Telemetry.MassTransit

Quick start

using Coexya.Utils.Telemetry.Tracing.Builder;
using Elyspio.Utils.Telemetry.MassTransit.Extensions;
using Elyspio.Utils.Telemetry.MongoDB.Extensions;
using Elyspio.Utils.Telemetry.Redis.Extensions;
using Elyspio.Utils.Telemetry.Sql.Extensions;
using Elyspio.Utils.Telemetry.Technical.Extensions;

var builder = WebApplication.CreateBuilder(args);

builder.Host.UseSerilogWithTelemetry();

if (builder.Configuration.IsTelemetryEnabled(out var telemetryOptions))
{
	var telemetryBuilder = new AppOpenTelemetryBuilder<Program>(telemetryOptions!, builder.Configuration)
	{
		Tracing = (tracing, _) => tracing
			.AddAppMongoInstrumentation()
			.AddAppSqlClientInstrumentation()
			.AddAppRedisInstrumentation()
			.AddAppMassTransitInstrumentation(),
		Meter = meter => meter.AddAppMassTransitInstrumentation()
	};

	telemetryBuilder.Build(builder.Services);
}

MongoDB tracing

To capture MongoDB commands, subscribe MongoDbActivityEventSubscriber when creating the client:

var mongoUrl = new MongoUrl(connectionString);
var clientSettings = MongoClientSettings.FromUrl(mongoUrl);

clientSettings.ClusterConfigurator = cb => { cb.Subscribe(new MongoDbActivityEventSubscriber()); };

var client = new MongoClient(clientSettings);

MassTransit consumers

To enrich consumer traces, inherit from TracingConsumer<TMessage> and implement ConsumeAsync:

using Elyspio.Utils.Telemetry.MassTransit.Tracing;
using MassTransit;

public class ToggleTodoConsumer : TracingConsumer<ToggleTodoMessage>
{
	protected override async Task ConsumeAsync(ConsumeContext<ToggleTodoMessage> context)
	{
		// Process message
	}
}

Configuration

Add this section to appsettings.json:

{
  "OpenTelemetry": {
    "CollectorUri": "http://localhost:4318/",
    "Service": "my-service",
    "Version": "1.0.0",
    "Protocol": "HttpProtobuf",
    "Debug": false
  }
}

Required keys:

  • CollectorUri
  • Service

Notes:

  • If OTEL_EXPORTER_OTLP_ENDPOINT is set, OpenTelemetry standard environment configuration is used.
  • Protocol defaults to Grpc if omitted.
Product Compatible and additional computed target framework versions.
.NET 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.1.2 84 3/1/2026
1.1.1 75 3/1/2026
1.1.0 79 3/1/2026
1.0.1 1,027 7/20/2025
1.0.0 1,111 7/20/2025