This repo is no longer maintained. All of its functionality is now present in NServiceBus OTel support.
The NServiceBus.Extensions.Diagnostics.OpenTelemetry
package provides an extension to OpenTelemetry.
It is a small wrapper to subscribe to the ActivitySource
exposed as part of NServiceBus.Extensions.Diagnostics
, and is not required to use as part of OpenTelemetry.
You can configure OpenTelemetry (typically through the OpenTelemetry.Extensions.Hosting package).
services.AddOpenTelemetryTracing(builder => {
builder
// Configure exporters
.AddZipkinExporter()
// Configure adapters
.AddAspNetCoreInstrumentation()
.AddHttpClientInstrumentation()
.AddNServiceBusInstrumentation(); // Adds NServiceBus OTel support
});
This extension method only adds a source with the appropriate name:
public static TracerProviderBuilder AddNServiceBusInstrumentation(this TracerProviderBuilder builder)
{
return builder.AddSource("NServiceBus.Extensions.Diagnostics");
}
Since OTel is supported at the NServiceBus level, any transport that NServiceBus supports also supports OTel.
This package supports OpenTelemetry version 1.2.0-rc1
and above.
This package also includes a small extension method to add the NServiceBus.Extensions.Diagnostics
Meter, for OTel metrics:
services.AddOpenTelemetryMetrics(builder => {
builder
// Configure adapters
.AddAspNetCoreInstrumentation()
.AddHttpClientInstrumentation()
.AddNServiceBusInstrumentation() // Adds NServiceBus instrumentation support
// Configure exporters
;
});