Skip to main content
Version: 2.x

OpenTelemetry instrumentation

KafkaFlow includes support for Traces and Baggage signals using OpenTelemetry instrumentation.

Including OpenTelemetry instrumentation in your code

Add the package KafkaFlow.OpenTelemetry to the project and add the extension method AddOpenTelemetryInstrumentation in your Startup:

services.AddKafka(
kafka => kafka
.AddCluster(...)
.AddOpenTelemetryInstrumentation()
);

Using KafkaFlow instrumentation with .NET Automatic Instrumentation

When using .NET automatic instrumentation, the KafkaFlow activity can be captured by including the ActivitySource name KafkaFlow.OpenTelemetry as a parameter to the variable OTEL_DOTNET_AUTO_TRACES_ADDITIONAL_SOURCES.