stats

package
v0.62.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 29, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package stats provides simple local usage statistics for personal assistant systems. This is a lightweight alternative to enterprise monitoring solutions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collector

type Collector struct {
	// contains filtered or unexported fields
}

Collector collects and manages usage statistics.

func NewCollector

func NewCollector(st *store.Store) *Collector

NewCollector creates a new statistics collector.

func (*Collector) GetStats

func (c *Collector) GetStats() *Stats

GetStats returns a copy of current statistics.

func (*Collector) RecordAIQuery

func (c *Collector) RecordAIQuery()

RecordAIQuery records an AI query action.

func (*Collector) RecordSearch

func (c *Collector) RecordSearch()

RecordSearch records a search action.

func (*Collector) Start

func (c *Collector) Start(ctx context.Context)

Start begins periodic statistics collection. Updates every hour.

func (*Collector) Stop

func (c *Collector) Stop()

Stop stops the statistics collector.

type Stats

type Stats struct {
	Mu sync.RWMutex

	// Memo stats
	TotalMemos     int64
	MemosLastWeek  int64
	MemosLastMonth int64

	// Schedule stats
	TotalSchedules    int64
	SchedulesThisWeek int64
	SchedulesNextWeek int64

	// Search stats
	TotalSearches  int64
	SearchesToday  int64
	LastSearchTime time.Time

	// Activity stats
	ActiveDays       int64 // Days with activity in the last 30 days
	LastActivityTime time.Time
	StreakDays       int64 // Current consecutive days with activity

	// AI stats
	TotalAIQueries    int64
	AIQueriesToday    int64
	AIQueriesThisWeek int64

	// Timestamp
	LastUpdated time.Time
}

Stats represents usage statistics.

func (*Stats) GetSummary

func (s *Stats) GetSummary() string

GetSummary returns a human-readable summary.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL