Repository navigation
Analytics: time-range/granularity controls + worker-backed incremental aggregation - #556
Merged
Merged
Conversation
…y controls to Analytics wi Closes stellar-vortex-protocol#462
…ion off the main thread wi Closes stellar-vortex-protocol#463
|
@NuMziE26 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! 🚀 |
# Conflicts: # src/app/analytics/AnalyticsPageClient.tsx # src/lib/analytics.ts # src/lib/time.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Analytics: time-range/granularity controls + worker-backed incremental aggregation
What was solved
#462 — [High] Add time-range and granularity controls to Analytics with correct UTC bucketing
Add user-selectable time ranges (24h/7d/30d/90d/custom) and granularity (hour/day/week) to the Analytics page, refactoring computeAnalytics into a pure, time-injected function that buckets by UTC via explicit helpers, fills gaps with zeros, counts and surfaces ignored invalid timestamps, syncs selection to the URL, shows a data-completeness notice when the capped feed doesn't cover the range, and documents the timezone policy with a local-time axis-label toggle.
Addressed:
#463 — [High] Move heavy analytics computation off the main thread with a Web Worker and memoized incremental updates
Move the heavy
computeAnalyticsaggregation off the main thread by introducing a shared incremental aggregator core, a Web Worker wrapper exposinginit/apply/snapshotover a typed message protocol, and wiring the analytics page to render from worker snapshots with deferred/transition semantics, while falling back to synchronous computation whenWorkeris unavailable.Addressed:
init(intents, options),apply(delta)andsnapshot()over a typed message protocol.src/lib/analytics.tssocomputeAnalyticsdelegates to the same core aggregator, preserving the existing public API and output shape.Changes
src/lib/time.ts(modify)src/lib/analytics.ts(modify)src/lib/analytics/worker.ts(create)src/app/analytics/AnalyticsPageClient.tsx(modify)Approach
Issues
Closes #462
Closes #463