-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for KafkaDependentProducer instrumentation (#34)
- Loading branch information
Showing
4 changed files
with
195 additions
and
1 deletion.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
src/Confluent.Kafka.Extensions.Diagnostics/DependentProducerBuilderExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
namespace Confluent.Kafka.Extensions.Diagnostics; | ||
|
||
/// <summary> | ||
/// Extension methods for <see cref="DependentProducerBuilder{TKey,TValue}" />. | ||
/// </summary> | ||
public static class DependentProducerBuilderExtensions | ||
{ | ||
/// <summary> | ||
/// Builds a new instrumented instance of producer. | ||
/// </summary> | ||
public static IProducer<TKey, TValue> BuildWithInstrumentation<TKey, TValue>( | ||
this DependentProducerBuilder<TKey, TValue> producerBuilder | ||
) | ||
{ | ||
if (producerBuilder == null) throw new ArgumentNullException(nameof(producerBuilder)); | ||
Check warning on line 15 in src/Confluent.Kafka.Extensions.Diagnostics/DependentProducerBuilderExtensions.cs GitHub Actions / publish
|
||
|
||
return new InstrumentedProducer<TKey, TValue>(producerBuilder.Build()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
...ka.Extensions.Diagnostics.Tests/__snapshots__/KafkaDiagnosticsTests.DependentProduce.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
{ | ||
"Status": "Ok", | ||
"StatusDescription": null, | ||
"HasRemoteParent": false, | ||
"Kind": "Producer", | ||
"OperationName": "produce_topic publish", | ||
"DisplayName": "produce_topic publish", | ||
"Source": { | ||
"Name": "Confluent.Kafka.Extensions.Diagnostics", | ||
"Version": "" | ||
}, | ||
"Parent": null, | ||
"ParentId": null, | ||
"Tags": [ | ||
{ | ||
"Key": "messaging.system", | ||
"Value": "kafka" | ||
}, | ||
{ | ||
"Key": "messaging.operation", | ||
"Value": "publish" | ||
}, | ||
{ | ||
"Key": "messaging.destination.kind", | ||
"Value": "topic" | ||
}, | ||
{ | ||
"Key": "messaging.destination.name", | ||
"Value": "produce_topic" | ||
}, | ||
{ | ||
"Key": "messaging.kafka.destination.partition", | ||
"Value": "0" | ||
}, | ||
{ | ||
"Key": "messaging.kafka.message.offset", | ||
"Value": "0" | ||
} | ||
], | ||
"Events": [], | ||
"Links": [], | ||
"Baggage": [], | ||
"Context": { | ||
"TraceId": {}, | ||
"SpanId": {}, | ||
"TraceFlags": "None", | ||
"TraceState": null, | ||
"IsRemote": false | ||
}, | ||
"TraceStateString": null, | ||
"SpanId": {}, | ||
"TraceId": {}, | ||
"Recorded": false, | ||
"IsAllDataRequested": false, | ||
"ActivityTraceFlags": "None", | ||
"ParentSpanId": {}, | ||
"IsStopped": true, | ||
"IdFormat": "W3C" | ||
} |
59 changes: 59 additions & 0 deletions
59
...tensions.Diagnostics.Tests/__snapshots__/KafkaDiagnosticsTests.DependentProduceAsync.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
{ | ||
"Status": "Ok", | ||
"StatusDescription": null, | ||
"HasRemoteParent": false, | ||
"Kind": "Producer", | ||
"OperationName": "produce_async_topic publish", | ||
"DisplayName": "produce_async_topic publish", | ||
"Source": { | ||
"Name": "Confluent.Kafka.Extensions.Diagnostics", | ||
"Version": "" | ||
}, | ||
"Parent": null, | ||
"ParentId": null, | ||
"Tags": [ | ||
{ | ||
"Key": "messaging.system", | ||
"Value": "kafka" | ||
}, | ||
{ | ||
"Key": "messaging.operation", | ||
"Value": "publish" | ||
}, | ||
{ | ||
"Key": "messaging.destination.kind", | ||
"Value": "topic" | ||
}, | ||
{ | ||
"Key": "messaging.destination.name", | ||
"Value": "produce_async_topic" | ||
}, | ||
{ | ||
"Key": "messaging.kafka.destination.partition", | ||
"Value": "0" | ||
}, | ||
{ | ||
"Key": "messaging.kafka.message.offset", | ||
"Value": "1" | ||
} | ||
], | ||
"Events": [], | ||
"Links": [], | ||
"Baggage": [], | ||
"Context": { | ||
"TraceId": {}, | ||
"SpanId": {}, | ||
"TraceFlags": "None", | ||
"TraceState": null, | ||
"IsRemote": false | ||
}, | ||
"TraceStateString": null, | ||
"SpanId": {}, | ||
"TraceId": {}, | ||
"Recorded": false, | ||
"IsAllDataRequested": false, | ||
"ActivityTraceFlags": "None", | ||
"ParentSpanId": {}, | ||
"IsStopped": true, | ||
"IdFormat": "W3C" | ||
} |