Skip to content

docs: keep log backend examples under the 64 KiB keepalive and beacon limit - #33

Open
fateeand wants to merge 1 commit into
mainfrom
32-docs-updates
Open

fateeand wants to merge 1 commit into
mainfrom
32-docs-updates

Conversation

@fateeand

Copy link
Copy Markdown
Collaborator

Overview

The log backend examples in README and DESIGN.md, which apps copy, could silently lose records. Browsers refuse a keepalive request or a beacon once everything in flight exceeds 64 KiB, and the examples used keepalive: true on every request and sendBeacon for every batch.

Key Changes

  • keepalive only while the page is hidden (document.visibilityState === 'hidden'), when it may be closing, in all three single-record examples (README, and DESIGN.md's basic and per-destination providers). A short comment says why.
  • Batching example (DESIGN.md):
    • a plain fetch while the page is visible, which has no 64 KiB cap;
    • sendBeacon only in flush(), when the page may be closing;
    • a fetch fallback when the beacon is refused, noted as best effort on unload.

Impact on consumers

  • Docs only. No library change.
  • Apps that copied the old examples can lose log records in a burst, or when a batch is large. Apply the same change to their provider.

Closes #32

@github-actions

Copy link
Copy Markdown
Contributor

Coverage report

St.❔
Category Percentage Covered / Total
🟢 Statements 97.12% 1280/1318
🟢 Branches 95.27% 705/740
🟢 Functions 96.95% 318/328
🟢 Lines 97.48% 1237/1269

Test suite run success

741 tests passing in 24 suites.

Report generated by 🧪jest coverage report action from 5d8f027

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.

Docs updates

1 participant