pub struct AnalyticsData {
pub trends: TrendsData,
pub forecast: ForecastData,
pub patterns: UsagePatterns,
pub insights: Vec<String>,
pub computed_at: DateTime<Utc>,
pub period: Period,
}Expand description
Complete analytics data for a period
Fields§
§trends: TrendsDataTime series trends
forecast: ForecastDataUsage forecasting
patterns: UsagePatternsBehavioral patterns
insights: Vec<String>Actionable insights
computed_at: DateTime<Utc>Timestamp of computation
period: PeriodPeriod analyzed
Implementations§
Source§impl AnalyticsData
impl AnalyticsData
Sourcepub fn compute(sessions: &[Arc<SessionMetadata>], period: Period) -> Self
pub fn compute(sessions: &[Arc<SessionMetadata>], period: Period) -> Self
Compute analytics from sessions (sync function)
This is a sync function for simplicity. If computation exceeds 16ms
(render deadline), caller should offload to tokio::task::spawn_blocking.
§Performance
Target: <100ms for 1000 sessions over 30 days
Sourcepub fn from_sessions_only(
sessions: &[Arc<SessionMetadata>],
period: Period,
) -> Self
pub fn from_sessions_only( sessions: &[Arc<SessionMetadata>], period: Period, ) -> Self
Graceful fallback if stats-cache.json missing
Cost forecasting requires pricing data from StatsCache. If unavailable, returns limited analytics.
Trait Implementations§
Source§impl Clone for AnalyticsData
impl Clone for AnalyticsData
Source§fn clone(&self) -> AnalyticsData
fn clone(&self) -> AnalyticsData
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for AnalyticsData
impl RefUnwindSafe for AnalyticsData
impl Send for AnalyticsData
impl Sync for AnalyticsData
impl Unpin for AnalyticsData
impl UnsafeUnpin for AnalyticsData
impl UnwindSafe for AnalyticsData
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more