OpenTelemetry support?

I’m starting to look at implementing OpenTelemetry support for NServiceBus (rather than straight up Jaeger/Zipkin/Dynatrace SDKs). Is anyone else looking at this, before I start pushing out conflicting NuGets?

It would depend on the OpenTelemetry SDK, but hopefully would support the System.Diagnostics.Activity stuff when that’s directly supported.

Right now I’m just starting with supporting the W3C TraceContext standard using the Activity API but will expand out to OpenTelemetry.

I’m going to follow the concepts here:

Hi Jimmy,

At the moment OpenTelemetry is not our priority. We might look into that in future but there are no plans to implement such support

Regards
Michael

Yeah, I figured that from other conversations, but wasn’t sure if anyone else in the community was.

As an aside, I think you folks should definitely follow the OpenTelemetry progress at least. It’s a big focus on .NET 5, and OOTB in .NET Core 3.x, ASP.NET Core, HttpClient, and Azure Service Bus client all support the W3C header standard, and the next step is adding OpenTelemetry standards support for correlation context, all flowing through automatically, and exposed to distributed tracing platforms.

You’re correct about following the OpenTelemetry progress.

Following the officially published status of the project, it’s not yet ready for adoption. Once .NET ecosystem is closer to the v1, we’ll be able to reassess the state of affairs and see how all the things play along. It could be that .NET 5 will serve as a catalyst for this work. But that’s a different topic altogether.

So far the results are promising. I was able to get everything down to one line of config:

services.AddOpenTelemetry(builder =>
{
    builder
        .UseZipkin(o =>
        {
            o.Endpoint = new Uri("http://localhost:9411/api/v2/spans");
            o.ServiceName = Program.EndpointName;
        })
        .AddNServiceBusCollector()
        .AddRequestCollector()
        .AddDependencyCollector();
});

And with that I’ve got full end-to-end tracing of ASP.NET Core, HttpClient, and anything NServiceBus-related all built on the open standards of W3C Trace Context, W3C Correlation Context, and OpenTelemetry:

That image is incoming ASP.NET Core → Rabbit MQ → (Rabbit MQ & HttpClient). Since OpenTelemetry is a standard, it means that this supports any of the exporters that OpenTelemetry supports (AppInsights, Prometheus, Zipkin, Jaeger etc).

Just a prototype for now but hope to release some NuGets soon.

3 Likes

If anyone else is tracking, the OpenTelemetry folks have a draft PR for span names:

There’s quite a bit of overlap with these attributes and the NSB headers, so I expect a bit of redundancy.

Update: I’ve released packages to support all this.

3 Likes

Hi Jimmy,

Does the NServiceBus OpenTelemetry packages include support for all NServiceBus transports, specifically SQL Server?

Thanks,
Brian

Yes, it works with all transports. It’s implemented with the IOutgoingPhysicalMessageContext which is transport-agnostic.