forked from wrenn/wrenn
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.
12 lines
290 B
SQL
12 lines
290 B
SQL
-- +goose Up
|
|
CREATE TABLE daily_usage (
|
|
team_id UUID NOT NULL,
|
|
day DATE NOT NULL,
|
|
cpu_minutes NUMERIC(18, 4) NOT NULL DEFAULT 0,
|
|
ram_mb_minutes NUMERIC(18, 4) NOT NULL DEFAULT 0,
|
|
PRIMARY KEY (team_id, day)
|
|
);
|
|
|
|
-- +goose Down
|
|
DROP TABLE daily_usage;
|