Skip to main content

Module data

Module data 

Source
Expand description

Loading and shaping the data shown on the dashboard.

Structs§

BucketRow
One printed row of the per-interval savings table.
Dashboard
Everything a page render needs.
SavingsRow
One printed row of the savings table.

Constants§

MAX_BUCKET_ROWS
How many intervals the savings table lists.
REFRESH_EVERY
How often a connected page re-reads the logs.

Functions§

bucket_noun
minute, hour, day or month: the interval a query’s savings are grouped by.
bucket_rows
The per-interval savings table, newest first, at most limit rows. The interval is the chart’s: a minute, hour, day or month.
build_dashboard
Shape collected rows into a Dashboard scoped to selection (pure — no I/O).
load
Read the logs on a blocking thread and build the Dashboard.
savings_headline
compact tokens + money, for the headline card’s sub-label.
savings_rows
The savings table: a row per source and a closing total (empty when nothing was saved). spent_usd gives the share of the would-be cost.
share_percent
Width (0–100) of a share bar for value against max.