Repository navigation
perf(Analytics): Read usage and evaluation reports from replicas - #9219
IlarionHalushka wants to merge 2 commits into
Conversation
Usage, top-organisation, total-event, flag evaluation and features-in-use reports read analytics buckets from the writer even when read replicas are configured. When analytics shares the main database, bind those reads to a main replica with the existing `using_database_replica` helper. With a separate analytics database, keep them on it, since main replicas do not copy it. Bucket rollup and its writes stay on the writer.
|
@IlarionHalushka is attempting to deploy a commit to the Flagsmith Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
All reported issues were addressed across 4 files
Reply to a comment to ask cubic a question or push back. It learns from your replies.
Re-trigger cubic
Top organisations usage feeds the subscription cache that drives usage alerts, and the total events count drives overage when the deprecated usage flag is on. Replica lag could defer those, so only dashboard reports read from replicas.
There was a problem hiding this comment.
0 issues found across 2 files (changes from recent commits).
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Requires human review: Auto-approval skipped because this PR is from an external contributor.
Re-trigger cubic
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9219 +/- ##
==========================================
- Coverage 98.96% 98.10% -0.86%
==========================================
Files 1724 1725 +1
Lines 73823 73927 +104
==========================================
- Hits 73056 72528 -528
- Misses 767 1399 +632 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Thanks for submitting a PR! Please check the boxes below:
docs/if required so people know about the feature.Changes
Contributes to #9217
When analytics shares the main database, analytics report reads now use
using_database_replica(). With a separate analytics database they stay on it, because main replicas don't copy it. Rollup, writes, and the usage reads behind billing and usage alerts stay on the writer. Reports may trail the writer by replica lag; they cover windows of days, so this is negligible.How did you test this code?
New tests cover each report read in both setups: through a replica when analytics shares the main database, never through one when it's separate.