Skip to content

feat(analytics): implement daily rollup job (AnalyticsDaily) - #1132

Merged
Akanimoh12 merged 1 commit into
Akanimoh12:test-implement-dripsfrom
BernardOnuh:test-implement-drips
Jul 27, 2026
Merged

feat(analytics): implement daily rollup job (AnalyticsDaily)#1132
Akanimoh12 merged 1 commit into
Akanimoh12:test-implement-dripsfrom
BernardOnuh:test-implement-drips

Conversation

@BernardOnuh

Copy link
Copy Markdown
Contributor

Summary

Implements the daily analytics rollup job (AnalyticsDaily) as a scheduled BullMQ worker that computes and persists pre-aggregated daily platform metrics.

Changes

  • Added computeDailyAnalytics(date) — queries completed tips and new users for a given UTC day, computes active users (distinct sender/receiver addresses), and upserts an AnalyticsDaily row. Idempotent.
  • Fixed pre-existing type error: COMPLETEDCONFIRMED in getTipVolume (Prisma enum mismatch)

New files

  • backend/src/jobs/analyticsDaily.queue.ts — BullMQ queue definition
  • backend/src/jobs/analyticsDaily.worker.ts — worker that runs computeDailyAnalytics for yesterday UTC and schedules the cron job
  • backend/src/jobs/analyticsDaily.worker.test.ts — worker unit tests

Config

  • Added ANALYTICS_DAILY_CRON env var (default: 5 0 * * *, i.e. 00:05 UTC daily)
  • Added config.analytics.dailyCron to src/config/index.ts
  • Documented in .env.example

Startup

  • Registered AnalyticsDailyWorker in src/server.ts with graceful shutdown and cron scheduling

Tests

  • 12 new tests pass (10 in analytics.test.ts + 2 in analyticsDaily.worker.test.ts)
  • Typecheck and lint pass

Closes #1007

- Add computeDailyAnalytics service function that queries completed
  tips and registered users for a given date, then upserts an
  AnalyticsDaily row
- Add BullMQ queue (analytics-daily) and worker with cron scheduling
- Add ANALYTICS_DAILY_CRON env var with default 00:05 UTC daily
- Register the analytics worker in server.ts bootstrap
- Fix pre-existing type error: COMPLETED -> CONFIRMED in getTipVolume
- Add tests for computeDailyAnalytics and runDailyAnalyticsRollup

Closes Akanimoh12#1007
@drips-wave

drips-wave Bot commented Jul 27, 2026

Copy link
Copy Markdown

@BernardOnuh Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Akanimoh12
Akanimoh12 merged commit 5d575b4 into Akanimoh12:test-implement-drips Jul 27, 2026
4 of 5 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.

Analytics: Daily rollup job (AnalyticsDaily)

2 participants