Skip to content

fix(sdk): improve force flush logic#5179

Open
grvmishra788 wants to merge 3 commits intoopen-telemetry:mainfrom
grvmishra788:worktree-issue-4631
Open

fix(sdk): improve force flush logic#5179
grvmishra788 wants to merge 3 commits intoopen-telemetry:mainfrom
grvmishra788:worktree-issue-4631

Conversation

@grvmishra788
Copy link
Copy Markdown

Description

Fixes #4631

Before: SynchronousMultiSpanProcessor.force_flush and SynchronousMultiLogRecordProcessor.force_flush used if not sp.force_flush(...): return False, which stopped iterating through processors as soon as any one returned a falsy value. This meant that a processor returning None would cause all subsequent processors to be silently skipped. The concurrent variants had the same truthiness check on results, incorrectly treating None as failure.

After: All multi-processor force_flush implementations now:

  • Continue calling every registered processor regardless of individual return values (timeout-based early exit is preserved).
  • Use is False instead of not result to distinguish between an explicit False (timeout exceeded) and None (not implemented / nothing to flush).
  • SpanProcessor.force_flush returns True by default instead of implicitly returning None.

Type of change

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

How Has This Been Tested?

  • Unit tests (SDK)
  • Typecheck
  • Lint
  • Pre-commit
  • Spellcheck

Does This PR Require a Contrib Repo Change?

  • No.

Checklist:

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

@grvmishra788 grvmishra788 marked this pull request as ready for review May 5, 2026 19:57
@grvmishra788 grvmishra788 requested a review from a team as a code owner May 5, 2026 19:57
@grvmishra788
Copy link
Copy Markdown
Author

Hi @alexmojaki! Could you please review this one? TIA.

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.

SynchronousMultiSpanProcessor.force_flush stops when a processor doesn't return True

1 participant