faucet.fctl module

Report state based on FAUCET/Gauge/Prometheus variables.

faucet.fctl.decode_value(metric_name, value)[source]

Convert values to human readible format based on metric name

faucet.fctl.get_samples(endpoints, metric_name, label_matches, nonzero_only=False, retries=3)[source]

return a list of Prometheus samples for a given metric

Prometheus Sample objects are named tuples with the fields: name, labels, value, timestamp, exemplar.

Parameters
  • endpoints (list of strings) – the prometheus endpoints to query

  • metric_name (string) – the metric to retrieve

  • label_matches (dict) – filters results by label

  • nonzero_only (bool) – only return samples with non-zero values

  • retries (int) – number of retries when querying

Returns

list of Prometheus Sample objects

faucet.fctl.main()[source]
faucet.fctl.parse_args(sys_args)[source]

Parse and return CLI args.

faucet.fctl.report_label_match_metrics(report_metrics, metrics, display_labels=None, nonzero_only=False, delim='\t', label_matches=None)[source]

Text report on a list of Prometheus metrics.

faucet.fctl.scrape_prometheus(endpoints, retries=3, err_output_file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>)[source]

Scrape a list of Prometheus/FAUCET/Gauge endpoints and aggregate results.