mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-13 21:01:21 +08:00
## Summary - Move `loadTotalUsers`, `loadAuthOverview`, and `loadRecentlyActiveUsers` off direct Postgres queries to read from the ClickHouse `analytics_internal` tables. - Route the remaining `projectUser.findMany` reads in `loadActiveUsersByCountry` and `loadRecentlyActiveUsers` through `$replica()`. - `loadRecentlyActiveUsers` falls back to an empty list on ClickHouse query failure (captured via `captureError`) rather than failing the whole metrics endpoint. ## Test plan - [ ] Hit the internal metrics endpoint on a tenancy with users/teams and confirm totals, daily series, and recently-active users match the previous Postgres-backed numbers. - [ ] Verify the 30-day daily-users series fills zero-activity days correctly. - [ ] Simulate a ClickHouse failure for the recently-active query and confirm the endpoint still responds with the rest of the payload. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes & Improvements** * Improved metrics aggregation for more consistent reporting. * More accurate active-user and total-user time series with missing days zero-filled. * Authentication overview updated with clearer counts for verified, unverified, and anonymous users. * Performance improvements: recently-active and overview calculations run more efficiently and in parallel. <!-- review_stack_entry_start --> [](https://app.coderabbit.ai/change-stack/hexclave/stack-auth/pull/1463?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) <!-- review_stack_entry_end --> <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|---|---|---|
| .. | ||
| app | ||
| auto-migrations | ||
| lib | ||
| oauth | ||
| private | ||
| route-handlers | ||
| scripts | ||
| utils | ||
| analytics.tsx | ||
| globals.d.ts | ||
| instrumentation.ts | ||
| polyfills.tsx | ||
| prisma-client.tsx | ||
| proxy.tsx | ||
| s3.tsx | ||
| smart-router.tsx | ||
| stack.tsx | ||