Skip to content

fix: retry page-view storage writes on quota failure and log eviction - #126

Merged
alexs-mparticle merged 6 commits into
developmentfrom
fix/page-view-quota-observability
Aug 20, 2026
Merged

fix: retry page-view storage writes on quota failure and log eviction#126
alexs-mparticle merged 6 commits into
developmentfrom
fix/page-view-quota-observability

Conversation

@alexs-mparticle

@alexs-mparticle alexs-mparticle commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • When writePageViews hits a localStorage quota error, evict the oldest record and retry — continuing until the write succeeds or no records remain. Returns the number of records stored (0 on total failure) so the caller can distinguish eviction from failure.
  • Logs PAGE_VIEW_QUOTA_EVICTION in capturePageView when a write succeeds after eviction, making quota-pressure visible in Datadog without requiring a full storage failure.

Why

~385 PAGE_VIEW_CAPTURE_FAILED [reason: quota] errors/day. The browser's total origin localStorage is full, so writes fail even with the 25-record cap. Evicting to fewer records recovers writes when there is some space, just not enough for all 25. Without the eviction log, a successful recovery is invisible — only total failures surface in Datadog.

Datadog query after this ships:

"PAGE_VIEW_QUOTA_EVICTION"

Test plan

  • writePageViews returns stored count: 1 record, 25-record cap, single eviction, multi-eviction, pre-seeded storage with eviction, total failure
  • Lint and build pass

🤖 Generated with Claude Code

When localStorage is full, evict the oldest page-view records one by one
and retry until the write succeeds or no records remain. Preserves the
most-recent data under quota pressure instead of discarding the entire write.
…under quota pressure

Emits a Datadog-visible log when writePageViews succeeds after evicting
records, making quota-pressure eviction visible without requiring a full
storage failure. Allows measuring the effectiveness of the eviction retry.
@alexs-mparticle
alexs-mparticle force-pushed the fix/page-view-quota-eviction branch from 0032ff2 to 3ca27d7 Compare August 19, 2026 19:41
@alexs-mparticle
alexs-mparticle force-pushed the fix/page-view-quota-observability branch from ebc1a3d to 3d1149f Compare August 19, 2026 19:41
@alexs-mparticle
alexs-mparticle changed the base branch from fix/page-view-quota-eviction to development August 19, 2026 20:11
@alexs-mparticle alexs-mparticle changed the title feat: log PAGE_VIEW_QUOTA_EVICTION when page-view storage is reduced under quota pressure fix: retry page-view storage writes on quota failure and log eviction Aug 19, 2026
@alexs-mparticle
alexs-mparticle merged commit 2e88327 into development Aug 20, 2026
github-actions Bot pushed a commit that referenced this pull request Aug 20, 2026
## [1.34.1](v1.34.0...v1.34.1) (2026-08-20)

### Bug Fixes

* retry page-view storage writes on quota failure and log eviction ([#126](#126)) ([2e88327](2e88327))
@mparticle-automation

Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 1.34.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants