Repository navigation
[Solace] Add OpenTelemetry distributed tracing support to SolaceIO (#40175) - #40482
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #40482 +/- ##
============================================
+ Coverage 56.16% 65.05% +8.88%
- Complexity 2288 13973 +11685
============================================
Files 1124 1729 +605
Lines 178336 108467 -69869
Branches 1489 11305 +9816
============================================
- Hits 100170 70558 -29612
+ Misses 75645 33700 -41945
- Partials 2521 4209 +1688
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Assigning reviewers: R: @chamikaramj for label java. Note: If you would like to opt out of this review, comment Available commands:
The PR bot will only process comments in the main thread (not review comments). |
| configuration.getNackOnTimeout()))); | ||
|
|
||
| if (configuration.getEnableOpenTelemetryTracing()) { | ||
| output = |
There was a problem hiding this comment.
We expect T to be of type Solace.Record.class right ?
If so should we add a check here for that to prevent unintended issues in the reader ?
Also add a test pls.
AI suggestion:
if (configuration.getEnableOpenTelemetryTracing()) {
checkArgument(
TypeDescriptor.of(Solace.Record.class).isSupertypeOf(configuration.getTypeDescriptor()),
"SolaceIO.Read: withEnableOpenTelemetryTracing() requires Solace.Record output "
+ "(SolaceIO.read()); user properties are not available after a custom parseFn.");
// ... apply OpenTelemetryHeaderConsumer as today
}
There was a problem hiding this comment.
nice find! will do
Fixes #40175
Supersedes #40187
Summary
Adds OpenTelemetry distributed tracing support to both
SolaceIO.ReadandSolaceIO.Write, aligned withKafkaIOandPubsubIOand utilizingSolace.Recorduser properties introduced in #40108 for W3C Trace Context propagation (traceparent,tracestate).Changes
sdks/java/io/solace/build.gradle):opentelemetry_bom,opentelemetry_api, andopentelemetry_contexttoimplementation.opentelemetry_sdkandopentelemetry_sdk_testingtotestImplementation.SolaceIO.Read&OpenTelemetryHeaderConsumer):withEnableOpenTelemetryTracing()onSolaceIO.Read(defaultfalse).ParDo.of(new OpenTelemetryHeaderConsumer<>())inSolaceIO.Read.expand().Tracer("SolaceIO") fromoptions.as(SdkHarnessOptions.class).getOpenTelemetry().traceparent,tracestate, with case-insensitive header lookup) fromSolace.Record.getUserProperties()viaW3CTraceContextPropagator.getInstance().extract(...)andTextMapGetter<Record>."SolaceIO.Read"span withSpanKind.CONSUMERandsetParent(context)wrappingreceiver.output(element)so Beam propagates the OpenTelemetry context inWindowedValue.SolaceIO.Write&OpenTelemetryHeaderPropagator):withEnableOpenTelemetryTracing()onSolaceIO.Write(defaultfalse).toBuilder()toSolace.Record.ParDo.of(new OpenTelemetryHeaderPropagator())inSolaceIO.Write.expand()."SolaceIO.Write"span withSpanKind.PRODUCERandsetParent(Context.current()), injecting the active W3C trace context into a copy ofSolace.Record'suserPropertiesviaW3CTraceContextPropagator.getInstance().inject(...)andTextMapSetter<Record>.SolaceIOReadTest: Verified configuration toggle andSpanKind.CONSUMERspan creation, parent trace/span ID linkage, case-insensitiveTraceParentextraction, andtracestatepreservation usingInMemorySpanExporter.SolaceIOWriteTest: Verified configuration toggle,SpanKind.PRODUCERspan creation for bothSTREAMINGandBATCHEDwriters, W3Ctraceparentinjection intoSolace.Recorduser properties and JCSMPSDTMapmessage properties, and end-to-end consumer-to-producer trace context continuity.