Repository navigation
[OpenTelemetry] Fix OpenTelemetry span kinds and add write spans in PubsubIO and KafkaIO - #40483
Merged
Merged
Conversation
Contributor
|
Assigning reviewers: R: @Abacn 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). |
Abacn
reviewed
Oct 9, 2026
Contributor
There was a problem hiding this comment.
Newly added tracer are transient. Should we make it transient here as well?
stankiewicz
force-pushed
the
pubsub_kafka_otel_fixes
branch
from
October 13, 2026 11:27
f2737d5 to
91362da
Compare
stankiewicz
force-pushed
the
pubsub_kafka_otel_fixes
branch
from
October 13, 2026 11:42
91362da to
a90d3ce
Compare
Abacn
approved these changes
Oct 13, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #39150 (
PubsubIO) and #39151 (KafkaIO) to properly set OpenTelemetry messaging span kinds and create producer spans in the write-side header propagationDoFns:SpanKind.CONSUMER):PubsubIO.Read.OpenTelemetryHeaderConsumer, set.setSpanKind(SpanKind.CONSUMER)on the"PubSubIO.Read"span.KafkaIO.OpenTelemetryHeaderConsumer, set.setSpanKind(SpanKind.CONSUMER)on the"KafkaIO.Read"span.SpanKind.PRODUCER):OpenTelemetryHeaderPropagatorin bothPubsubIOandKafkaIOinjectedContext.current()directly without creating a producer span. If no upstream span was active on the worker thread, notraceparentwas injected and no write span was recorded.PubsubIO.Write.OpenTelemetryHeaderPropagator, initialize the"PubSubIO"TracerviaPipelineOptions(SdkHarnessOptions) in@Setup, start a"PubSubIO.Write"span withSpanKind.PRODUCERand parentContext.current(), and make it current before injecting W3C trace context (googclient_traceparent/googclient_tracestate) and outputting thePubsubMessage.KafkaIO.OpenTelemetryHeaderPropagator, initialize the"KafkaIO"TracerviaPipelineOptions(SdkHarnessOptions) in@Setup, start a"KafkaIO.Write"span withSpanKind.PRODUCERand parentContext.current(), and make it current before injecting W3C trace context into theProducerRecordheaders and outputting the record.