ray.util.metrics.Counter#
- class ray.util.metrics.Counter(name: str, description: str = '', tag_keys: Tuple[str, ...] | None = None)[source]#
Bases:
Metric
A cumulative metric that is monotonically increasing.
This corresponds to Prometheus’ counter metric: https://prometheus.io/docs/concepts/metric_types/#counter
Before Ray 2.10, this exports a Prometheus gauge metric instead of a counter metric, which is wrong. Since 2.10, this exports both counter (with a suffix “_total”) and gauge metrics (for bug compatibility). Use
RAY_EXPORT_COUNTER_AS_GAUGE=0
to disable exporting the gauge metric.- 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.
Methods
Increment the counter by
value
(defaults to 1).Set default tags of metrics.
Attributes
Return the information of this metric.