stankiewicz opened a new pull request, #40483:
URL: https://github.com/apache/beam/pull/40483
Follow-up to #39150 (`PubsubIO`) and #39151 (`KafkaIO`) to properly set
OpenTelemetry messaging span kinds and create producer spans in the write-side
header propagation `DoFn`s:
1. **Read-Side Span Kind (`SpanKind.CONSUMER`)**:
- In `PubsubIO.Read.OpenTelemetryHeaderConsumer`, set
`.setSpanKind(SpanKind.CONSUMER)` on the `"PubSubIO.Read"` span.
- In `KafkaIO.OpenTelemetryHeaderConsumer`, set
`.setSpanKind(SpanKind.CONSUMER)` on the `"KafkaIO.Read"` span.
2. **Write-Side Producer Span Creation (`SpanKind.PRODUCER`)**:
- Previously, `OpenTelemetryHeaderPropagator` in both `PubsubIO` and
`KafkaIO` injected `Context.current()` directly without creating a producer
span. If no upstream span was active on the worker thread, no `traceparent` was
injected and no write span was recorded.
- In `PubsubIO.Write.OpenTelemetryHeaderPropagator`, initialize the
`"PubSubIO"` `Tracer` via `PipelineOptions` (`SdkHarnessOptions`) in `@Setup`,
start a `"PubSubIO.Write"` span with `SpanKind.PRODUCER` and parent
`Context.current()`, and make it current before injecting W3C trace context
(`googclient_traceparent` / `googclient_tracestate`) and outputting the
`PubsubMessage`.
- In `KafkaIO.OpenTelemetryHeaderPropagator`, initialize the `"KafkaIO"`
`Tracer` via `PipelineOptions` (`SdkHarnessOptions`) in `@Setup`, start a
`"KafkaIO.Write"` span with `SpanKind.PRODUCER` and parent `Context.current()`,
and make it current before injecting W3C trace context into the
`ProducerRecord` headers and outputting the record.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]