Skip to content

fix(replays): Keep replay recordings in /data/replays and prune them - #4607

Draft
sentry-junior[bot] wants to merge 2 commits into
masterfrom
dominikbuszowiecki/replay-969-replay-recording-retention
Draft

sentry-junior[bot] wants to merge 2 commits into
masterfrom
dominikbuszowiecki/replay-969-replay-recording-retention

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Draft description. The author should rewrite it in their own words before marking this ready.

Replay recording segments are written to the default filestore (/data/files on sentry-data) because replay.storage.backend is not set. Sentry writes these blobs straight to storage, with no File rows, so sentry cleanup never deletes them and they pile up forever on both fresh installs and upgrades. See getsentry/sentry#121278.

This keeps the filesystem backend but points replay.storage.* at a dedicated /data/replays directory. A second daily cron entry in sentry-cleanup deletes anything there older than SENTRY_EVENT_RETENTION_DAYS. The new install/migrate-replay-storage.sh creates the directory. On upgrades, if APPLY_AUTOMATIC_CONFIG_UPDATES allows it, it appends the config and moves existing recordings out of /data/files. It only moves <retention>/<project_id>/<32-hex replay_id> directories, so regular file blobs (<2hex>/<4hex>/<26hex> files) are never touched. Moved recordings keep their mtimes, so ones already past retention are removed on the next cleanup run.

Open question:

  • Non-interactive upgrades with APPLY_AUTOMATIC_CONFIG_UPDATES=1 switch the path and move recordings without a prompt.

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

via @DominikB2014.

--

View Session [Sentry]

…olicy

Replay recording segments were written to the default filestore on the
sentry-data volume. Sentry writes them without File rows and relies on a
bucket lifecycle policy to expire them, so nothing ever deleted them.

Store them in a 'replays' SeaweedFS bucket that expires objects after
SENTRY_EVENT_RETENTION_DAYS, mirroring the profiles bucket setup.

Refs getsentry/sentry#121278

Co-Authored-By: Dominik Buszowiecki <44422760+DominikB2014@users.noreply.github.com>
@linear-code

linear-code Bot commented Nov 2, 2026

Copy link
Copy Markdown

REPLAY-969

@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Coverage Results 📊

✅ 22 passed | Total: 22 | Pass Rate: 100% | Execution Time: 9m 40s

📊 Comparison with Base Branch

Metric Change
Total Tests —
Passed Tests —
Failed Tests —
Skipped Tests —

✨ Test counts unchanged from base.

All tests are passing successfully.

✅ Patch coverage is 100.00% (no changed executable lines found; target 50%).
Project statement coverage is 95.58% (unchanged from base (0ba08be) to head (1b14bef)).

Coverage diff
@@            Coverage Diff             @@
##        master     #4607       +/-##
==========================================
  Coverage    95.58%    95.58%        —%
==========================================
  Files            5         5         —
  Tracked lines       339       339         —
  Branches         0         0         —
==========================================
  Hits           324       324         —
  Misses          15        15         —
  Partials         0         0         —

Generated by Coverage Action

@aldy505

aldy505 commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator

@DominikB2014 I would avoid using SeaweedFS here. Can we just use filesystem with a separate path? Or is there any plan of moving replay recordings to objectstore?

Drop the SeaweedFS bucket in favor of the filesystem backend with a
dedicated /data/replays directory. A daily sentry-cleanup cron job
deletes recordings older than SENTRY_EVENT_RETENTION_DAYS.

On upgrade, install points replay.storage.* at /data/replays and moves
existing recordings out of /data/files so they keep playing back and
expire like new ones.

Co-Authored-By: Dominik Buszowiecki <44422760+DominikB2014@users.noreply.github.com>
@sentry-junior sentry-junior Bot changed the title fix(replays): Store replay recordings in SeaweedFS with a lifecycle policy fix(replays): Keep replay recordings in /data/replays and prune them Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants