Confluent.Kafka.Extensions.Diagnostics
0.5.1-alpha.4
dotnet add package Confluent.Kafka.Extensions.Diagnostics --version 0.5.1-alpha.4
NuGet\Install-Package Confluent.Kafka.Extensions.Diagnostics -Version 0.5.1-alpha.4
<PackageReference Include="Confluent.Kafka.Extensions.Diagnostics" Version="0.5.1-alpha.4" />
paket add Confluent.Kafka.Extensions.Diagnostics --version 0.5.1-alpha.4
#r "nuget: Confluent.Kafka.Extensions.Diagnostics, 0.5.1-alpha.4"
// Install Confluent.Kafka.Extensions.Diagnostics as a Cake Addin #addin nuget:?package=Confluent.Kafka.Extensions.Diagnostics&version=0.5.1-alpha.4&prerelease // Install Confluent.Kafka.Extensions.Diagnostics as a Cake Tool #tool nuget:?package=Confluent.Kafka.Extensions.Diagnostics&version=0.5.1-alpha.4&prerelease
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 | 46 | 11/5/2024 |
0.5.1-alpha.3 | 38 | 11/5/2024 |
0.5.1-alpha.2 | 203 | 8/18/2024 |
0.5.1-alpha.1 | 81 | 8/18/2024 |
0.5.0 | 58,197 | 8/7/2024 |
0.4.0 | 262,288 | 7/27/2023 |
0.3.1-alpha.5 | 106 | 7/27/2023 |
0.3.1-alpha.4 | 189 | 5/29/2023 |
0.3.1-alpha.3 | 92 | 5/29/2023 |
0.3.1-alpha.2 | 87 | 5/29/2023 |
0.3.1-alpha.1 | 89 | 5/29/2023 |
0.3.0 | 45,194 | 3/14/2023 |
0.2.3-alpha.5 | 98 | 3/14/2023 |
0.2.3-alpha.1 | 118 | 11/8/2022 |
0.2.2 | 120,365 | 8/8/2022 |
0.2.2-alpha.1 | 111 | 8/8/2022 |
0.2.1 | 396 | 8/8/2022 |
0.2.0 | 398 | 8/7/2022 |
0.1.0 | 422 | 8/5/2022 |