Skip to content

[Solace] Add OpenTelemetry distributed tracing support to SolaceIO (#40175) - #40482

Open
stankiewicz wants to merge 1 commit into
apache:masterfrom
stankiewicz:solaceio-opentelemetry-tracing
Open

stankiewicz wants to merge 1 commit into
apache:masterfrom
stankiewicz:solaceio-opentelemetry-tracing

Conversation

@stankiewicz

Copy link
Copy Markdown
Contributor

Fixes #40175
Supersedes #40187

Summary

Adds OpenTelemetry distributed tracing support to both SolaceIO.Read and SolaceIO.Write, aligned with KafkaIO and PubsubIO and utilizing Solace.Record user properties introduced in #40108 for W3C Trace Context propagation (traceparent, tracestate).

Changes

  • Build & Dependencies (sdks/java/io/solace/build.gradle):
    • Added opentelemetry_bom, opentelemetry_api, and opentelemetry_context to implementation.
    • Added opentelemetry_sdk and opentelemetry_sdk_testing to testImplementation.
  • Read-Side Trace Extraction (SolaceIO.Read & OpenTelemetryHeaderConsumer):
    • Added withEnableOpenTelemetryTracing() on SolaceIO.Read (default false).
    • Applied ParDo.of(new OpenTelemetryHeaderConsumer<>()) in SolaceIO.Read.expand().
    • Initialized Tracer ("SolaceIO") from options.as(SdkHarnessOptions.class).getOpenTelemetry().
    • Extracted W3C trace context (traceparent, tracestate, with case-insensitive header lookup) from Solace.Record.getUserProperties() via W3CTraceContextPropagator.getInstance().extract(...) and TextMapGetter<Record>.
    • Created a "SolaceIO.Read" span with SpanKind.CONSUMER and setParent(context) wrapping receiver.output(element) so Beam propagates the OpenTelemetry context in WindowedValue.
  • Write-Side Trace Injection (SolaceIO.Write & OpenTelemetryHeaderPropagator):
    • Added withEnableOpenTelemetryTracing() on SolaceIO.Write (default false).
    • Added toBuilder() to Solace.Record.
    • Applied ParDo.of(new OpenTelemetryHeaderPropagator()) in SolaceIO.Write.expand().
    • Created a "SolaceIO.Write" span with SpanKind.PRODUCER and setParent(Context.current()), injecting the active W3C trace context into a copy of Solace.Record's userProperties via W3CTraceContextPropagator.getInstance().inject(...) and TextMapSetter<Record>.
  • Unit Tests:
    • SolaceIOReadTest: Verified configuration toggle and SpanKind.CONSUMER span creation, parent trace/span ID linkage, case-insensitive TraceParent extraction, and tracestate preservation using InMemorySpanExporter.
    • SolaceIOWriteTest: Verified configuration toggle, SpanKind.PRODUCER span creation for both STREAMING and BATCHED writers, W3C traceparent injection into Solace.Record user properties and JCSMP SDTMap message properties, and end-to-end consumer-to-producer trace context continuity.

@stankiewicz
stankiewicz marked this pull request as draft October 9, 2026 09:46
@stankiewicz
stankiewicz marked this pull request as ready for review October 9, 2026 09:48
@codecov

codecov Bot commented Oct 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.26%. Comparing base (76f6e6d) to head (878de01).
⚠️ Report is 103 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master   #40482      +/-   ##
============================================
+ Coverage     56.16%   65.26%   +9.09%     
- Complexity     2288    13917   +11629     
============================================
  Files          1124     1720     +596     
  Lines        178336   107826   -70510     
  Branches       1489    11243    +9754     
============================================
- Hits         100170    70369   -29801     
+ Misses        75645    33270   -42375     
- Partials       2521     4187    +1666     
Flag Coverage Δ
go ?
java 65.26% <ø> (-10.53%) ⬇️
python ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Assigning reviewers:

R: @chamikaramj for label java.

Note: If you would like to opt out of this review, comment assign to next reviewer.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request]: SolaceIO: Add OpenTelemetry Distributed Tracing Support

1 participant