Skip to content

Snapshots: once a day, keep 14 - #163

Merged
Fl0p merged 1 commit into
mainfrom
snapshots-daily-14
Nov 15, 2026
Merged

Fl0p merged 1 commit into
mainfrom
snapshots-daily-14

Conversation

@Fl0p

@Fl0p Fl0p commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Why

The owner wants daily snapshots instead of every six hours. The 6h × 56 cadence was chosen in ADR-0023. This PR records the change as an amendment to that ADR.

What

  • COTEL_SNAPSHOT_INTERVAL 6h → 24h, COTEL_SNAPSHOT_KEEP 56 → 14, in internal/storage/snapshot.go defaults and in docker-compose.yml. Reach stays 14 days. A restore now loses up to a day of telemetry (was 6h). Disk drops from ~235 MB to ~60 MB.
  • scripts/probe-healthz.sh: the SNAPSHOT_STALE_AFTER_SECONDS default goes 43200 → 172800 (two intervals). Without it, a healthy daily worker would page every day. The rpi5 wrapper materializes the script from main and the loopback job uses the script's default, so neither needs an edit.
  • Docs: README and docs index env tables, the snapshots runbook, the health-probe doc, an ADR-0023 amendment and CHANGELOG.

Rollout note

Pruning keeps the N newest snapshots. On the first daily export, the 6-hourly backlog on prod would shrink to its 14 newest, about 3 days of reach. Thinning the backlog to one snapshot per UTC day before then keeps the full 14 days.

Verification

  • scripts/probe-healthz_test.sh: 31/31 pass.
  • Snapshot tests in internal/storage pass.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Changed
    • Database snapshots now run once daily instead of every six hours, with 14 snapshots retained for a 14-day period.
    • Snapshot storage is reduced to approximately 60 MB.
    • Restores may now lose up to 24 hours of telemetry.
    • The stale-snapshot health check threshold is now 48 hours, up from 12 hours.

COTEL_SNAPSHOT_INTERVAL 6h -> 24h and COTEL_SNAPSHOT_KEEP 56 -> 14, in the
binary's defaults and in docker-compose.yml. Reach stays 14 days; a restore
now loses up to a day of telemetry instead of six hours, for about a
quarter of the disk. The owner's call, recorded as an amendment to
ADR-0023.

The probe's SNAPSHOT_STALE_AFTER_SECONDS default moves from 43200 to
172800 (two intervals) so a healthy daily worker does not read as stale.
The rpi5 wrapper and the loopback job both take the script's default.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Snapshot defaults change to a 24-hour interval and 14 retained snapshots. The stale-snapshot threshold changes from 12 hours to 48 hours. Configuration, runtime fallback, changelog, and operational documentation reflect these defaults.

Changes: Snapshot policy defaults

Layer / File(s) Summary
Daily cadence and retention
internal/storage/snapshot.go, docker-compose.yml, docs/decisions/0023-production-database-snapshots.md, README.md, docs/index.md, CHANGELOG.md
The default interval changes from 6 hours to 24 hours, and the retention count changes from 56 to 14. Documentation describes the 14-day retention reach and records the backlog-thinning step for the transition.
Stale-snapshot threshold
scripts/probe-healthz.sh, README.md, docs/index.md, docs/operations/duckdb-snapshots.md, docs/operations/health-probe.md
The stale-snapshot threshold default and fallback change from 43,200 seconds to 172,800 seconds. Documentation and example probe output reflect the updated threshold.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Other

Merge Risk: Minimal · up to 146d0

This change moves snapshots to once a day with 14 kept and raises the stale-probe threshold to match. The code and documentation are consistent, and the migration caveat is documented. Before deploying, the operator should thin the existing six-hourly backlog to one snapshot per UTC day, otherwise the first export prunes older recovery points.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "Snapshots: once a day, keep 14" matches the main change in the changeset. The PR changes the snapshot interval from 6 hours to 24 hours and the retention count from 56 to 14 in internal/sto…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "Snapshots: once a day, keep 14" matches the main change in the changeset. The PR changes the snapshot interval from 6 hours to 24 hours and the retention count from 56 to 14 in internal/storage/snapshot.go, docker-compose.yml, and the docs. The title is short, specific, and reads as a clear summary. It does not mention the stale-probe threshold change, which is a secondary change and does not need to appear in the title.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 268ace04-a364-4b79-a915-637a64aba3b4
Commits

Reviewing files that changed from the base of the PR and between daead07 and 146d01e.

Files selected for processing: 9

  • CHANGELOG.md
  • README.md
  • docker-compose.yml
  • docs/decisions/0023-production-database-snapshots.md
  • docs/index.md
  • docs/operations/duckdb-snapshots.md
  • docs/operations/health-probe.md
  • internal/storage/snapshot.go
  • scripts/probe-healthz.sh

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@Fl0p
Fl0p merged commit 294ca28 into main Nov 15, 2026
12 checks passed
@Fl0p
Fl0p deleted the snapshots-daily-14 branch November 15, 2026 12:31
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