Skip to content

Check for None result in gRPC (#3380) #3381

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Apr 21, 2025
Merged

Conversation

kevmodo
Copy link
Contributor

@kevmodo kevmodo commented Mar 21, 2025

Description

This is a fix for #3380 that checks explicitly for a None result rather than evaluating truthiness. PubSub results with zero messages evaluate to False, causing span.end() to be called twice.

Fixes #3380

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • Ran Tox
  • Ran locally against an empty PubSub queue and no longer received warning messages, but spans correctly started and ended.
  • Ran against queue with messages and behavior was as expected (spans correctly started and ended, as before)

Does This PR Require a Core Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

Copy link

linux-foundation-easycla bot commented Mar 21, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@kevmodo kevmodo requested a review from a team as a code owner March 21, 2025 07:39
@xrmx
Copy link
Contributor

xrmx commented Mar 21, 2025

Thanks for the PR, could you please write a test for this to avoid regressions in the future?

@kevmodo
Copy link
Contributor Author

kevmodo commented Mar 25, 2025

Thanks for the PR, could you please write a test for this to avoid regressions in the future?

That was an adventure! Added a test that counts span.end() invocations.

@xrmx xrmx self-requested a review April 18, 2025 08:09
Copy link
Contributor

@xrmx xrmx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the small nit fixed, LGTM

@lzchen lzchen merged commit c54292f into open-telemetry:main Apr 21, 2025
720 checks passed
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.

GRPC traces called twice when result evaluates to false
3 participants