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.
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 or 0 clears 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, 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).
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
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.
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.