savant_rs.metrics

class savant_rs.metrics.CounterFamily
delete(label_values=Ellipsis)

Deletes the counter with the given labels.

Parameters:

label_values (List[str]) – The list of label values.

get(label_values=Ellipsis)

Returns the value of the counter with the given labels.

Parameters:

label_values (List[str]) – The list of label values.

Returns:

The value of the counter.

Return type:

Optional[int]

Raises:

PyValueError – If the counter does not exist.

static get_counter_family(name)

Returns a counter with the given name.

Parameters:

name (str) – The name of the counter.

Returns:

The counter.

Return type:

Optional[CounterFamily]

static get_or_create_counter_family(name, description=None, label_names=Ellipsis, unit=None)

Creates or returns a counter with the given name.

Parameters:
  • name (str) – The name of the counter.

  • description (str, optional) – The description of the counter.

  • label_names (List[str], optional) – The list of label names.

  • unit (str, optional) – The unit of the counter.

Returns:

The counter.

Return type:

CounterFamily

inc(value=1, label_values=Ellipsis)
set(value, label_values=Ellipsis)
class savant_rs.metrics.GaugeFamily
delete(label_values=Ellipsis)
get(label_values=Ellipsis)
static get_gauge_family(name)

Returns a counter with the given name.

Parameters:

name (str) – The name of the counter.

Returns:

The counter.

Return type:

Optional[GaugeFamily]

static get_or_create_gauge_family(name, description=None, label_names=Ellipsis, unit=None)

Creates or returns a gauge with the given name.

Parameters:
  • name (str) – The name of the gauge.

  • description (str, optional) – The description of the gauge.

  • label_names (List[str], optional) – The list of label names.

  • unit (str, optional)

Returns:

The gauge.

Return type:

GaugeFamily

set(value, label_values=Ellipsis)
savant_rs.metrics.delete_metric_family(name)

Deletes a counter with the given name.

Parameters:

name (str) – The name of the counter or gauge.

savant_rs.metrics.set_extra_labels(labels)