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

Bases: ray.util.metrics.Metric

A cumulative metric that is monotonically increasing.

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

  • 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.

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

Increment the counter by value (defaults to 1).

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

  • value (int, float) – Value to increment the counter by (default=1).

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