fab.metrics module#

A module for recording and summarising metrics, with the following concepts:

init

create pipes create reading process - daemonic, exits with main process

send

group, name, value -> reading process overwrites any previous value for group[name]

reading process

creates and add to metrics dict finishes -> send whole lot down a summary pipe and close

stop

closes pipes & process return metrics from summary pipe

fab.metrics.init_metrics(metrics_folder)#

Create the pipe for sending metrics, the process to read them, and another pipe to push the final collated data.

Only one call to init_metrics can be called before calling stop_metrics.

Parameters:

metrics_folder (Path) – The folder where we will write metrics.

fab.metrics.send_metric(group, name, value)#

Pass a metric to the reader process.

Metrics will be written to a json file after build steps have run.

Example:

send_metric('my step', 'reading took', 123)
send_metric('my step', 'writing took', 456)
Parameters:
  • group (str) – Name of the metrics group.

  • name (str) – Name of the metric.

  • value – Value of the metric.

fab.metrics.stop_metrics()#

Close the metrics pipe and reader process.

fab.metrics.metrics_summary(metrics_folder)#

Create various summary charts from the metrics json.