fix(confluent-kafka): skip recv spans when poll/consume returns no messages#4349
Merged
xrmx merged 2 commits intoopen-telemetry:mainfrom Mar 25, 2026
Merged
Conversation
emdneto
reviewed
Mar 23, 2026
Member
emdneto
left a comment
There was a problem hiding this comment.
one more fix for precommit:
tox -e precommit and add the changelog.
d169f4b to
973aaf0
Compare
…ssages Matches Java instrumentation behavior: only create a recv span when a message is actually received, avoiding empty spans on idle polls. Fixes open-telemetry#3590
973aaf0 to
d6bdd1d
Compare
Contributor
Author
Thank you @emdneto for your assistance 🙇🏼♂️ ; should be good now 👍🏼 |
emdneto
approved these changes
Mar 24, 2026
xrmx
approved these changes
Mar 25, 2026
Contributor
|
Checked that the kafka-clients 2.6 java instrumentations checks for records before tracing. |
wrisa
pushed a commit
to wrisa/opentelemetry-python-contrib
that referenced
this pull request
Mar 26, 2026
…ssages (open-telemetry#4349) Matches Java instrumentation behavior: only create a recv span when a message is actually received, avoiding empty spans on idle polls. Fixes open-telemetry#3590 Co-authored-by: Emídio Neto <[email protected]>
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.
Description
Matches Java instrumentation behavior: only create a recv span when a message is actually received, avoiding empty spans on idle polls.
Fixes #3590
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Added two new unit tests to cover the empty cases:
test_poll_empty_does_not_create_span: calls poll() on an empty queue twice and asserts no spans are produced
test_consume_empty_does_not_create_span: calls consume() on an empty queue twice and asserts no spans are produced
Existing tests (test_poll, test_consume) were updated to reflect that idle polls/consumes no longer produce recv spans.
Does This PR Require a Core Repo Change?
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.