Skip to main content

Module metrics

Module metrics 

Source
Expand description

The metric catalog: one table of key values, one reading per run.

Market metrics are the key values of a market summary. Token and address metrics are read by watchlists (scope::watch). Each MetricId has one MetricGroup; describe gives its label, unit and threshold.

summary_metrics defines the market list once. Labels, units, thresholds and CSV column names all come from it. sample reads one MarketSummary into values in the same order as the table, and csv_columns gives the CSV order of the same table.

Every market value is a field the summary computed once for its health checks (spread, top-N depth, health). This module only reads them, so a charted value and the check that judged it cannot differ.

The table has no timestamp or run entry: the CSV writer adds those two columns in front. This module has no presentation types.

Structs§

Metric
One entry of the metric table.
MissingMetric
A CSV column the caller needs is missing from the table it passed.
Sample
One run’s reading. values[i] belongs to the metric at index i of the table passed to sample. A missing value is None, never zero.

Enums§

MetricGroup
Where a metric’s value comes from.
MetricId
Identifies one metric of the catalog.
Threshold
The limit a metric is judged against.
Unit
What a metric’s number measures.

Functions§

csv_columns
The table in CSV column order: today’s columns first, then the rest in table order. The writer adds timestamp and run before these.
csv_header
The CSV header line for columns (see csv_columns), with its newline.
csv_row
One CSV row, with its newline. sample reads in the order of metrics (the table sample used); columns sets the cell order. A flag is true or false; a missing value is -.
describe
The catalog entry of id. Market thresholds come from t; token and address metrics have no default threshold.
sample
Reads one summary into values, in the order of metrics.
summary_metrics
The market metric table, built from the thresholds in force.