Documentation
¶
Index ¶
- type Aggregate
- type DB
- func (s *DB) ByModel(q Query) ([]Aggregate, error)
- func (s *DB) ByProvider(q Query) ([]Aggregate, error)
- func (s *DB) Close() error
- func (s *DB) Recent(page, pageSize int) (*RecentPage, error)
- func (s *DB) RecentFiltered(q Query, page, pageSize int) (*RecentPage, error)
- func (s *DB) Summary(q Query) (*Summary, error)
- func (s *DB) TimeSeries(q Query) ([]Aggregate, error)
- type Query
- type RecentPage
- type Server
- type StatsEntry
- type Summary
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Aggregate ¶
type Aggregate struct {
Label string `json:"label"`
Vendor string `json:"vendor"`
Protocol string `json:"protocol"`
Model string `json:"model"`
InputTokens int `json:"inputTokens"`
OutputTokens int `json:"outputTokens"`
TotalTokens int `json:"totalTokens"`
Requests int `json:"requests"`
}
Aggregate represents aggregated stats for a dimension.
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB wraps a SQLite connection for stats queries.
func Open ¶
Open opens the stats database at the given sessions.db path. It runs schema migrations to ensure all required tables exist (e.g. when opening an old DB from a previous vibecoding version).
func OpenDefault ¶
OpenDefault opens the default sessions.db in the user's config directory.
func (*DB) ByProvider ¶
ByProvider returns stats grouped by vendor and protocol.
func (*DB) Recent ¶
func (s *DB) Recent(page, pageSize int) (*RecentPage, error)
Recent returns a paginated list of stats entries, ordered by most recent first.
func (*DB) RecentFiltered ¶
func (s *DB) RecentFiltered(q Query, page, pageSize int) (*RecentPage, error)
RecentFiltered returns a paginated list of stats entries matching the query, ordered by most recent first.
type Query ¶
type Query struct {
From time.Time
To time.Time
Vendor string
Protocol string
Model string
GroupBy string // "day", "1h", "week", "month", "provider", "model"
}
Query represents a stats query with filters.
type RecentPage ¶
type RecentPage struct {
Items []StatsEntry `json:"items"`
Total int `json:"total"`
Page int `json:"page"`
PageSize int `json:"pageSize"`
}
RecentPage represents a paginated result of recent stats entries.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the HTTP server for the stats dashboard.
type StatsEntry ¶
type StatsEntry struct {
ID int64 `json:"id"`
Timestamp time.Time `json:"timestamp"`
SessionID string `json:"sessionId"`
Vendor string `json:"vendor"`
Protocol string `json:"protocol"`
Model string `json:"model"`
InputTokens int `json:"inputTokens"`
OutputTokens int `json:"outputTokens"`
TotalTokens int `json:"totalTokens"`
DurationMs int `json:"durationMs"`
}
StatsEntry represents a single recorded LLM request.