Skip to content

fix(sdk-logs): route browser document-hide flush errors to the global error handler - #7187

Merged
overbalance merged 2 commits into
open-telemetry:mainfrom
embrace-io:overbalance/sdk-logs-browser-flush-error-handler
Oct 13, 2026
Merged

overbalance merged 2 commits into
open-telemetry:mainfrom
embrace-io:overbalance/sdk-logs-browser-flush-error-handler

Conversation

@overbalance

Copy link
Copy Markdown
Contributor

Which problem is this PR solving?

The browser BatchLogRecordProcessor flushes on document hide with void this.forceFlush(), so a rejected flush becomes an unhandled promise rejection. The browser BatchSpanProcessor already routes it to globalErrorHandler.

Short description of the changes

  • Route the rejection to globalErrorHandler, matching the span processor.
  • Browser test: a rejected forceFlush on hide reaches the global error handler.

Type of change

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

How Has This Been Tested?

  • npm run test:browser and npm test in @opentelemetry/sdk-logs; the new test fails without the fix.

Checklist:

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

@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Pull request dashboard status

Merged · refreshed 2026-10-13 19:46 UTC

Status above doesn't look right?
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

@codecov

codecov Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.08%. Comparing base (ac8e31c) to head (9720f2d).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7187   +/-   ##
=======================================
  Coverage   95.08%   95.08%           
=======================================
  Files         384      384           
  Lines       13555    13557    +2     
  Branches     3127     3127           
=======================================
+ Hits        12889    12891    +2     
  Misses        666      666           
Files with missing lines Coverage Δ
...platform/browser/export/BatchLogRecordProcessor.ts 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@overbalance
overbalance marked this pull request as ready for review October 12, 2026 20:25
@overbalance
overbalance requested a review from a team as a code owner October 12, 2026 20:25
@trentm trentm added this to the Logs API/SDK GA milestone Oct 13, 2026
@overbalance
overbalance force-pushed the overbalance/sdk-logs-browser-flush-error-handler branch from dc83a97 to 9720f2d Compare October 13, 2026 19:34
@overbalance
overbalance added this pull request to the merge queue Oct 13, 2026
Merged via the queue into open-telemetry:main with commit d774993 Oct 13, 2026
25 checks passed
@overbalance
overbalance deleted the overbalance/sdk-logs-browser-flush-error-handler branch October 13, 2026 19:45
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.

2 participants