ray.util.metrics.Histogram#

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

Bases: ray.util.metrics.Metric

Tracks the size and number of events in buckets.

Histograms allow you to calculate aggregate quantiles such as 25, 50, 95, 99 percentile latency for an RPC.

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

Parameters
  • name – Name of the metric.

  • description – Description of the metric.

  • boundaries – Boundaries of histogram buckets.

  • tag_keys – Tag keys of the metric.

DeveloperAPI: This API may change across minor Ray releases.

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

Observe a given value and add it to the appropriate bucket.

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.

property info#

Return information about histogram metric.