Skip to content

chore(test-app): show what the SDK has stored for events - #427

Open
abelonogov-ld wants to merge 1 commit into
andrey/event-durability-tier3-persistencefrom
andrey/test-app-event-storage
Open

abelonogov-ld wants to merge 1 commit into
andrey/event-durability-tier3-persistencefrom
andrey/test-app-event-storage

Conversation

@abelonogov-ld

@abelonogov-ld abelonogov-ld commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Adds an Event storage view to the test app, as the iOS test app has: what the SDK has on disk for this app and mobile key.

Stacked on #408 (tier 3).

The view is a text block under the persistence picker. A summary line, "N log(s), N batch(es) holding N event(s)", is followed by the newest six files. Each line gives the file's kind (log, new, batch), its shortened name, the event count a batch's name holds, its size and its modification time to the second:

Event storage: 1 log(s), 2 batch(es) holding 14 event(s)
log   pending-23b88492…  1.5 MB · 11:43:41
batch ready-v1-4b1aad42… 7 ev · 1.8 MB · 11:43:41
batch ready-v1-b723abc2… 7 ev · 1.8 MB · 11:43:41
  • It never opens a file. It reads names, sizes and modification times from the directory listing, so looking cannot take a lock another process's recovery needs.
  • It refreshes once a second while the activity is in the foreground, from onResume to onPause. A file that comes and goes within a second, such as a new- log being opened, is never shown.
  • The directory comes from the SDK itself. EventDirectory.defaultDirectory is package-private, so a small com.launchdarkly.sdk.android.EventStorageLocation in the test app exposes it, the way EventPersistenceBenchmarkRunner already reaches into the package. The view cannot drift from where the SDK writes.
  • A long press copies the directory's path.
  • The README describes the section.

Tested on an emulator (API 23):

  • After launch the view showed the open log.
  • Offline, Fill 3 Batches then Flush showed one 1.5 MB log and two ready- batches of 7 events each. That matches adb shell run-as … ls -l no_backup/com.launchdarkly.events/<key> file for file.
  • After delivery it showed 0 logs and 0 batches.

:test-app:assembleDebug builds.


Note

Overview
The Android test app gains a live Event storage panel under the persistence picker, mirroring the iOS harness.

EventStorageInspector resolves the SDK's on-disk events directory (via new EventStorageLocation, which delegates to package-private EventDirectory.defaultDirectory) and refreshes a monospace summary once per second while the activity is foregrounded. It counts pending- logs and ready- batches, parses event counts from batch filenames, and lists the six newest files using metadata only (no file opens, so recovery locks stay untouched). MainActivity starts/stops polling in onResume/onPause and long-press copies the storage path. Layout adds storage_status; the README documents the behavior.

Reviewed by Cursor Bugbot for commit d73fc81. Bugbot is set up for automated code reviews on this repo. Configure here.

A text view under the persistence picker lists the event directory for
this app and mobile key: the pending- logs processes append to and the
ready- batches waiting for delivery, with the count each batch's name
holds, their sizes and modification times. It reads names and sizes
only, never opening a file, so looking cannot take a lock another
process's recovery needs. It reads again every second while the app is
in the foreground. A long press copies the directory's path.

The directory comes from the SDK's own EventDirectory.defaultDirectory,
through a class in the SDK's package as the benchmark runner does, so
the view cannot drift from where the SDK writes. The iOS test app has
the same section.

Co-authored-by: Cursor <cursoragent@cursor.com>

This branch has not been deployed

No deployments
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.

1 participant