Skip to content

Feat/1374 1373 1372 1377 - #1646

Merged
davedumto merged 5 commits into
StreamFi-x:devfrom
aboisamcrypto:feat/1374-1373-1372-1377
Oct 3, 2026
Merged

davedumto merged 5 commits into
StreamFi-x:devfrom
aboisamcrypto:feat/1374-1373-1372-1377

Conversation

@aboisamcrypto

Copy link
Copy Markdown
Contributor

StreamFi Analytics Infrastructure Enhancement

Summary

Implemented time-series rollup storage and materialized analytics views to replace expensive COUNT(*) queries. This PR addresses performance bottlenecks in admin analytics and enables historical trend analysis for platform metrics.

Issues Closed

Closes #1374
Closes #1373
Closes #1372
Closes #1377

Changes

#1373: Admin Analytics Materialized Rollup

  • Created admin_analytics_daily_rollup table to store daily snapshots of key metrics (total users, live streams, pending reports, etc.)
  • Implemented getCurrentAdminAnalytics() function that serves metrics from rollup with fallback to fresh capture if needed
  • Updated /api/admin/analytics endpoint to use materialized rollup instead of live COUNT(*) queries
  • Eliminates expensive full-table scans on every admin dashboard load

#1374: Platform Metrics Time-Series Storage

  • Created tables for hourly, daily, and monthly metric aggregations (platform_metrics_hourly, platform_metrics_daily, platform_metrics_monthly)
  • Implemented metric capture system for DAU, MAU, live streams, tip volume, streaming hours, new creators
  • Added metric versioning support to handle metric definition changes over time
  • Provides foundation for historical trend charts and platform health monitoring

Implementation Details

  • Cron Jobs: Added two scheduled jobs for capturing metrics
    • cron-capture-admin-analytics: Runs daily to snapshot admin metrics
    • cron-capture-platform-metrics: Runs daily to capture platform-wide metrics
  • Idempotency: All capture jobs are idempotent; safe to re-run
  • Performance: Eliminated expensive queries from critical paths; rollups enable efficient trending queries
  • Resilience: Uses existing scheduled-job framework with lease management and failure tracking

Testing

  • Lint passes with no new errors
  • All new code follows existing patterns and conventions
  • Ready for end-to-end testing with migration and cron job execution

@drips-wave

drips-wave Bot commented Sep 25, 2026

Copy link
Copy Markdown

@aboisamcrypto 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

@vercel

vercel Bot commented Sep 25, 2026

Copy link
Copy Markdown

Deployment failed for project streamfi-frontend with the following error:

Invalid vercel.json file provided

@vercel

vercel Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
streamfi-frontend Error Error Sep 25, 2026 10:30pm UTC

@vercel

vercel Bot commented Sep 25, 2026

Copy link
Copy Markdown

Deployment failed for project streamfi-frontend with the following error:

Invalid vercel.json file provided

@vercel

vercel Bot commented Oct 3, 2026

Copy link
Copy Markdown

@aboisamcrypto is attempting to deploy a commit to the david's projects Team on Vercel.

A member of the Team first needs to authorize it.

@davedumto
davedumto merged commit a49e674 into StreamFi-x:dev Oct 3, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment