Summary
Add distributed tracing support via OpenTelemetry to SolaceIO.java for both read and write patterns using .withEnableOpenTelemetryTracing(). This follows the pattern established in KafkaIO and PubsubIO, leveraging the user properties mapping interface recently merged in PR #40108.
Functional Requirements
Read Pattern (Context Extraction)
• Opt-In Execution (otherwise don't add doFn): Enabled via .withEnableOpenTelemetryTracing() defaults to false.
• Context Extraction DoFn:
• Reads incoming W3C trace context from Solace.Record.getUserProperties() using W3CTraceContextPropagator.
• If valid trace headers exist, extracts the parent span context; otherwise, defaults safely to current context.
• Span Management:
• Starts a new span named "SolaceIO.Read" using the runner's OpenTelemetry tracer obtained from SdkHarnessOptions.
• Emits downstream records within the active span scope (span.makeCurrent()), enabling runners (such as Google Cloud Dataflow with element_metadata_supported) to propagate trace context across pipeline stages.
• Ensures the span is closed upon completion.
• Scope: Applies to the standard read pattern consuming Solace.Record.
Write Pattern (Context Injection)
• Opt-In Execution: Enabled via .withEnableOpenTelemetryTracing(); defaults to false.
• Context Injection:
• Captures the active trace context from Context.current().
• Injects W3C trace headers into the record's userProperties map before publication.
• Works uniformly across both streaming (WriterType.STREAMING) and batched (WriterType.BATCHED) publishing modes.
• Serializes user properties to the Solace broker via the underlying JCSMP message property map (SDTMap).
──────
Protocol Changes (Solace Message Attributes)
Trace propagation relies on the W3C Trace Context specification https://www.w3.org/TR/trace-context/ mapped to Solace message user properties (SDTMap in JCSMP, exposed as Map<String, String> on Solace.Record via PR #40108
- traceparent, (string, case-insesitive).
- tracestate (string, optional, case-insesitive).
Issue Priority
Priority: 2 (default / most feature requests should be filed as P2)
Issue Components
Summary
Add distributed tracing support via OpenTelemetry to SolaceIO.java for both read and write patterns using
.withEnableOpenTelemetryTracing(). This follows the pattern established in KafkaIO and PubsubIO, leveraging the user properties mapping interface recently merged in PR #40108.Functional Requirements
Read Pattern (Context Extraction)
• Opt-In Execution (otherwise don't add doFn): Enabled via
.withEnableOpenTelemetryTracing()defaults to false.• Context Extraction DoFn:
• Reads incoming W3C trace context from Solace.Record.getUserProperties() using W3CTraceContextPropagator.
• If valid trace headers exist, extracts the parent span context; otherwise, defaults safely to current context.
• Span Management:
• Starts a new span named "SolaceIO.Read" using the runner's OpenTelemetry tracer obtained from SdkHarnessOptions.
• Emits downstream records within the active span scope (span.makeCurrent()), enabling runners (such as Google Cloud Dataflow with element_metadata_supported) to propagate trace context across pipeline stages.
• Ensures the span is closed upon completion.
• Scope: Applies to the standard read pattern consuming Solace.Record.
Write Pattern (Context Injection)
• Opt-In Execution: Enabled via .withEnableOpenTelemetryTracing(); defaults to false.
• Context Injection:
• Captures the active trace context from Context.current().
• Injects W3C trace headers into the record's userProperties map before publication.
• Works uniformly across both streaming (WriterType.STREAMING) and batched (WriterType.BATCHED) publishing modes.
• Serializes user properties to the Solace broker via the underlying JCSMP message property map (SDTMap).
──────
Protocol Changes (Solace Message Attributes)
Trace propagation relies on the W3C Trace Context specification https://www.w3.org/TR/trace-context/ mapped to Solace message user properties (SDTMap in JCSMP, exposed as Map<String, String> on Solace.Record via PR #40108
Issue Priority
Priority: 2 (default / most feature requests should be filed as P2)
Issue Components