Elyspio.Utils.Telemetry.MassTransit
1.1.2
dotnet add package Elyspio.Utils.Telemetry.MassTransit --version 1.1.2
NuGet\Install-Package Elyspio.Utils.Telemetry.MassTransit -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.MassTransit" 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.MassTransit" Version="1.1.2" />
<PackageReference Include="Elyspio.Utils.Telemetry.MassTransit" />
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.MassTransit --version 1.1.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Elyspio.Utils.Telemetry.MassTransit, 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.MassTransit@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.MassTransit&version=1.1.2
#tool nuget:?package=Elyspio.Utils.Telemetry.MassTransit&version=1.1.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
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:
CollectorUriService
Notes:
- If
OTEL_EXPORTER_OTLP_ENDPOINTis set, OpenTelemetry standard environment configuration is used. Protocoldefaults toGrpcif omitted.
| Product | Versions 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.
-
net10.0
- Elyspio.Utils.Telemetry (>= 1.1.2)
- MassTransit (>= 9.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.