Confluent.Kafka.Extensions.OpenTelemetry 0.3.0

dotnet add package Confluent.Kafka.Extensions.OpenTelemetry --version 0.3.0
NuGet\Install-Package Confluent.Kafka.Extensions.OpenTelemetry -Version 0.3.0
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="Confluent.Kafka.Extensions.OpenTelemetry" Version="0.3.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Confluent.Kafka.Extensions.OpenTelemetry --version 0.3.0
#r "nuget: Confluent.Kafka.Extensions.OpenTelemetry, 0.3.0"
#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.
// Install Confluent.Kafka.Extensions.OpenTelemetry as a Cake Addin
#addin nuget:?package=Confluent.Kafka.Extensions.OpenTelemetry&version=0.3.0

// Install Confluent.Kafka.Extensions.OpenTelemetry as a Cake Tool
#tool nuget:?package=Confluent.Kafka.Extensions.OpenTelemetry&version=0.3.0

Confluent.Kafka.Extensions.OpenTelemetry

GitHub Actions Badge NuGet Badge

The Confluent.Kafka.Extensions.OpenTelemetry package enables collection of instrumentation data of the Confluent.Kafka library. The actual instrumentation of the Confluent.Kafka library should be configured using Confluent.Kafka.Extensions.Diagnostics.

Installation

Install-Package Confluent.Kafka.Extensions.OpenTelemetry

Usage

Confluent.Kafka configuration

As Confluent.Kafka does not expose any instrumentation data, additional, configuration is required. Full documentation is available at Confluent.Kafka.Extensions.Diagnostics docs. There is also an example on how to use the package in real world application.

Producer
using Confluent.Kafka;
using Confluent.Kafka.Extensions.Diagnostics;


using var producer =
    new ProducerBuilder<Null, string>(new ProducerConfig(new ClientConfig { BootstrapServers = "localhost:9092" }))
        .SetKeySerializer(Serializers.Null)
        .SetValueSerializer(Serializers.Utf8)
        .BuildWithInstrumentation();

await producer.ProduceAsync("topic", new Message<Null, string> { Value = "Hello World!" });
Consumer
using Confluent.Kafka;
using Confluent.Kafka.Extensions.Diagnostics;

using var consumer = new ConsumerBuilder<Ignore, string>(
        new ConsumerConfig(new ClientConfig { BootstrapServers = "localhost:9092" })
        {
            GroupId = "group", AutoOffsetReset = AutoOffsetReset.Earliest
        })
    .SetValueDeserializer(Deserializers.Utf8)
    .Build();

consumer.Subscribe("topic");

consumer.ConsumeWithInstrumentation((result) =>
{
    Console.WriteLine(result.Message.Value);
});

OpenTelemetry configuration

using Confluent.Kafka.Extensions.OpenTelemetry;
using OpenTelemetry.Resources;
using OpenTelemetry.Trace;

builder.Services.AddOpenTelemetry().WithTracing(traceBuilder =>
{
    traceBuilder
        .AddInMemoryExporter()
        .AddHttpClientInstrumentation()
        .AddAspNetCoreInstrumentation()
        .AddConfluentKafkaInstrumentation();  // <-- Add Confluent.Kafka OpenTelemetry support
});
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Confluent.Kafka.Extensions.OpenTelemetry:

Package Downloads
Reactive.Kafka.Client

Abstract and simplify integrations with confluent kafka

Coflnet.Core

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.3.0 41,209 7/27/2023
0.2.0 32,578 3/14/2023
0.1.0 74,922 8/10/2022