ray.util.metrics.Gauge#

class ray.util.metrics.Gauge(name: str, description: str = '', tag_keys: Optional[Tuple[str]] = None)[source]#

Bases: ray.util.metrics.Metric

Gauges keep the last recorded value and drop everything before.

Unlike counters, gauges can go up or down over time.

This corresponds to Prometheus’ gauge metric: https://prometheus.io/docs/concepts/metric_types/#gauge

Parameters
  • name – Name of the metric.

  • description – Description of the metric.

  • tag_keys – Tag keys of the metric.

DeveloperAPI: This API may change across minor Ray releases.

set(value: Union[int, float], tags: Optional[Dict[str, str]] = None)[source]#

Set the gauge to the given value.

Tags passed in will take precedence over the metric’s default tags.

Parameters
  • value (int, float) – Value to set the gauge to.

  • tags (Dict[str, str]) – Tags to set or override for this gauge.