Confluent.Kafka.Extensions.Diagnostics
0.5.0
See the version list below for details.
dotnet add package Confluent.Kafka.Extensions.Diagnostics --version 0.5.0
NuGet\Install-Package Confluent.Kafka.Extensions.Diagnostics -Version 0.5.0
<PackageReference Include="Confluent.Kafka.Extensions.Diagnostics" Version="0.5.0" />
paket add Confluent.Kafka.Extensions.Diagnostics --version 0.5.0
#r "nuget: Confluent.Kafka.Extensions.Diagnostics, 0.5.0"
// Install Confluent.Kafka.Extensions.Diagnostics as a Cake Addin #addin nuget:?package=Confluent.Kafka.Extensions.Diagnostics&version=0.5.0 // Install Confluent.Kafka.Extensions.Diagnostics as a Cake Tool #tool nuget:?package=Confluent.Kafka.Extensions.Diagnostics&version=0.5.0
Confluent.Kafka.Extensions.Diagnostics
The Confluent.Kafka.Extensions.Diagnostics
package enables instrumentation of the Confluent.Kafka
library
via Activity API.
Installation
Install-Package Confluent.Kafka.Extensions.Diagnostics
Usage
Producer
Producer instrumentation is done via wrapper class and, for this reason, the producer usage is not needed to be rewritten. However,
to enable producer instrumentation, BuildWithInstrumentation
method should be called on the producer builder instead of Build
.
After that, all produce calls (sync and async) will be instrumented.
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
Unfortunately, consumer interface of Confluent.Kafka
library is not very flexible. Therefore, the instrumentation is implemented
via an extension method on the consumer itself. For this reason, the consumer usage should be rewritten as follows:
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");
try
{
while (true)
{
try
{
consumer.ConsumeWithInstrumentation((result) =>
{
Console.WriteLine(result.Message.Value);
}, 2000);
}
catch (ConsumeException e)
{
Console.WriteLine($"Error occured: {e.Error.Reason}");
}
}
}
catch (OperationCanceledException)
{
consumer.Close();
}
Product | Versions 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. |
-
net6.0
- Confluent.Kafka (>= 2.3.0 && < 3.0.0)
-
net8.0
- Confluent.Kafka (>= 2.3.0 && < 3.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Confluent.Kafka.Extensions.Diagnostics:
Package | Downloads |
---|---|
Confluent.Kafka.Extensions.OpenTelemetry
OpenTelemetry instrumentation for Confluent.Kafka |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.5.1-alpha.4 | 32 | 11/5/2024 |
0.5.1-alpha.3 | 30 | 11/5/2024 |
0.5.1-alpha.2 | 178 | 8/18/2024 |
0.5.1-alpha.1 | 78 | 8/18/2024 |
0.5.0 | 46,726 | 8/7/2024 |
0.4.0 | 250,925 | 7/27/2023 |
0.3.1-alpha.5 | 103 | 7/27/2023 |
0.3.1-alpha.4 | 186 | 5/29/2023 |
0.3.1-alpha.3 | 89 | 5/29/2023 |
0.3.1-alpha.2 | 82 | 5/29/2023 |
0.3.1-alpha.1 | 86 | 5/29/2023 |
0.3.0 | 44,660 | 3/14/2023 |
0.2.3-alpha.5 | 95 | 3/14/2023 |
0.2.3-alpha.1 | 113 | 11/8/2022 |
0.2.2 | 119,533 | 8/8/2022 |
0.2.2-alpha.1 | 108 | 8/8/2022 |
0.2.1 | 393 | 8/8/2022 |
0.2.0 | 395 | 8/7/2022 |
0.1.0 | 415 | 8/5/2022 |