vantage6.backend.common.metrics.Metrics

class Metrics(labels)

Bases: object

Class to manage all system metrics and their Prometheus gauges.

__init__(labels)

Initialize the Metrics class and create Prometheus gauges.

Parameters:

labels (list[str]) – List of labels to be used for all metrics.

Methods

__init__(labels)

Initialize the Metrics class and create Prometheus gauges.

get_gauge(metric_name)

Retrieve the Prometheus gauge for a given metric.

set_metric(metric_name, value, labels)

Set the value of a metric, handling GPU-specific logic if necessary.

get_gauge(metric_name)

Retrieve the Prometheus gauge for a given metric.

Parameters:

metric_name (str) – The name of the metric.

Returns:

The Prometheus gauge for the metric.

Return type:

Gauge

set_metric(metric_name, value, labels)

Set the value of a metric, handling GPU-specific logic if necessary.

Parameters:
  • metric_name (str) – The name of the metric to set.

  • value (Any) – The value to set for the metric.

  • labels (dict) – A dictionary of labels to apply to the metric.

Return type:

None