Expand description
Loading and shaping the data shown on the dashboard.
Structs§
- Bucket
Row - One printed row of the per-interval savings table.
- Dashboard
- Everything a page render needs.
- Savings
Row - 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.
- WATCH_
EVERY - How often the server looks for newly crossed limits, with or without a page open.
Functions§
- apply_
limit_ params - Apply submitted fields to
current: empty or0clears a limit, anything that is not a non-negative number is an error (nothing changes). - bar_
percent - The percent of a limit used, for a progress bar (0–100).
- bucket_
noun minute,hour,dayormonth: the interval a query’s savings are grouped by.- bucket_
rows - The per-interval savings table, newest first, at most
limitrows. The interval is the chart’s: a minute, hour, day or month. - build_
dashboard - Shape collected rows into a
Dashboardscoped toselection(pure — no I/O). - check_
limits - Check the spending limits on a blocking thread, read-only: pages only show how much is used. The alarm (log + desktop notification) is the server’s watcher.
- level_
class - CSS class of a limit’s state.
- load
- Read the logs on a blocking thread and build the
Dashboard. - savings_
headline compacttokens + 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_usdgives the share of the would-be cost. - share_
percent - Width (0–100) of a share bar for
valueagainstmax. - watch_
limits - One watcher pass: raise alerts nobody raised yet (logged, so the TUI, GUI and CLI stay quiet about them) as desktop notifications. Returns the alerts.