forked from wrenn/wrenn
Add daily usage metrics (CPU-minutes, RAM GB-minutes)
Introduce pre-computed daily usage rollups from sandbox_metrics_snapshots. An hourly background worker aggregates completed days, while today's usage is computed live from snapshots at query time for freshness. Backend: new daily_usage table, rollup worker, UsageService, and GET /v1/capsules/usage endpoint with date range filtering (up to 92 days). Frontend: replace Usage page placeholder with bar charts (Chart.js), summary total cards, and preset/custom date range controls.
This commit is contained in:
@ -41,6 +41,13 @@ type Channel struct {
|
||||
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
||||
}
|
||||
|
||||
type DailyUsage struct {
|
||||
TeamID pgtype.UUID `json:"team_id"`
|
||||
Day pgtype.Date `json:"day"`
|
||||
CpuMinutes pgtype.Numeric `json:"cpu_minutes"`
|
||||
RamMbMinutes pgtype.Numeric `json:"ram_mb_minutes"`
|
||||
}
|
||||
|
||||
type Host struct {
|
||||
ID pgtype.UUID `json:"id"`
|
||||
Type string `json:"type"`
|
||||
|
||||
Reference in New Issue
Block a user