Confluent.Kafka.Extensions.OpenTelemetry 0.3.1-alpha.1

This is a prerelease version of Confluent.Kafka.Extensions.OpenTelemetry.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Confluent.Kafka.Extensions.OpenTelemetry --version 0.3.1-alpha.1                
NuGet\Install-Package Confluent.Kafka.Extensions.OpenTelemetry -Version 0.3.1-alpha.1                
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.1-alpha.1" />                
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.1-alpha.1                
#r "nuget: Confluent.Kafka.Extensions.OpenTelemetry, 0.3.1-alpha.1"                
#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.1-alpha.1&prerelease

// Install Confluent.Kafka.Extensions.OpenTelemetry as a Cake Tool
#tool nuget:?package=Confluent.Kafka.Extensions.OpenTelemetry&version=0.3.1-alpha.1&prerelease                

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 is compatible.  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 (4)

Showing the top 4 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

CodeDesignPlus.Net.Observability

CodeDesignPlus.Net.Observability provides a comprehensive framework for monitoring and observability in .NET Core applications. This library simplifies the process of collecting, analyzing, and visualizing application metrics and logs, enabling developers to build robust and maintainable observability solutions.

CodeDesignPlus.Net.Kafka

CodeDesignPlus.Net.Kafka provides a robust framework for integrating Apache Kafka with .NET Core applications. This library simplifies the process of producing and consuming Kafka messages, enabling developers to build scalable and reliable event-driven systems.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.4.0 41,086 8/7/2024
0.3.1-alpha.1 40 8/7/2024
0.3.0 239,188 7/27/2023
0.2.0 41,783 3/14/2023
0.1.0 87,868 8/10/2022