Skip to content

Conversation

@stordahl
Copy link
Collaborator

@stordahl stordahl commented Nov 13, 2025

Overview

This PR adds the most long awaited feature to Counterscale - long term data storage.

tl;dr - we now setup an R2 bucket on install and setup a daily cron to store the previous days metrics into an Apache Arrow file.

Changes by Package

@counterscale/cli

  • Adds a storage [enable | disable] command to toggle storage enabled state

@counterscale/server

  • Adds Apache Arrow integration via the official TS sdk
    • Had to use patch-package to allow the sdk to be run in CF workers context
  • Adds the daily cron to the workers definition and configuration
    • cron returns early if storage is disabled
  • Adds R2 bucket to configuration to auto setup on install

@counterscale/tracker

No tracker changes

Other Changes

Additional Notes

@codecov
Copy link

codecov bot commented Nov 13, 2025

Codecov Report

❌ Patch coverage is 0% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.76%. Comparing base (1f92237) to head (1db3921).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
packages/server/app/analytics/query.ts 0.00% 16 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #237      +/-   ##
==========================================
- Coverage   84.58%   83.76%   -0.82%     
==========================================
  Files          55       55              
  Lines        1855     1873      +18     
  Branches      517      519       +2     
==========================================
  Hits         1569     1569              
- Misses        252      268      +16     
- Partials       34       36       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@stordahl stordahl force-pushed the stordahl/long-term-storage branch from cb11578 to 44661f2 Compare November 19, 2025 01:51
@numdefined
Copy link

Hi thanks for implementing this and sorry to bother but is this planned as a opt-in/out feature?
I'd prefer not to have long term storage so i wouldn't want to enable this.
Alternatively could this have a configurable age?

@stordahl stordahl marked this pull request as ready for review December 14, 2025 14:10
@stordahl stordahl merged commit 9290681 into main Dec 14, 2025
3 checks passed
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.

3 participants