Skip to content

Conversation

patpatpat123
Copy link
Contributor

( I accidentaly closed #14707, my bad)

Hello team,

This PR is to address issue #14372

Problem it is trying to solve:

As of today, Spark Structured Streaming Kafka Consumer, upon consuming a message with a valid W3C header with trace, is not continuing, nor propagating the trace on the Spark side.

Root cause analysis:

It seems Spark Structured Streaming Kafka Consumer is relying on listIterator C.f. https://github.com/apache/spark/blob/master/connector/kafka-0-10-sql/src/main/scala/org/apache/spark/sql/kafka010/consumer/KafkaDataConsumer.scala#L593

As of now, Kafka instrumentation does not support listIterator.

Proposed solution

This solution will add TracingListIterator<K, V> implements ListIterator<ConsumerRecord<K, V>> (TracingListIterator.java) which will allow the handling of listIterator (instrumentation/kafka/kafka-clients/kafka-clients-common-0.11/library/src/main/java/io/opentelemetry/instrumentation/kafkaclients/common/v0_11/internal/TracingList.java )

Thanks

Many thanks Lauri, Trask, and Jay for the help provided

@patpatpat123 patpatpat123 requested a review from a team as a code owner September 23, 2025 06:48
@otelbot-java-instrumentation
Copy link
Contributor

🔧 The result from spotlessApply was committed to the PR branch.

@laurit laurit added this to the v2.21.0 milestone Sep 25, 2025
@patpatpat123
Copy link
Contributor Author

Thank you @laurit for the journey 🙂

@patpatpat123
Copy link
Contributor Author

Screenshot from 2025-09-22 15-43-36

Test result using Spark

@trask trask merged commit 9422142 into open-telemetry:main Sep 26, 2025
89 checks passed
Copy link
Contributor

otelbot bot commented Sep 26, 2025

Thank you for your contribution @patpatpat123! 🎉 We would like to hear from you about your experience contributing to OpenTelemetry by taking a few minutes to fill out this survey.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants