Interface Histogram


public interface Histogram
Histogram - A metric for recording value distributions Histogram - 用于记录值分布的指标

Histograms track the distribution of observed values, providing count, sum, max, mean, and percentile calculations.

直方图跟踪观察值的分布,提供计数、总和、最大值、均值和百分位数计算。

Since:
JDK 25, opencode-base-observability V1.0.3
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    Returns the number of recorded values.
    id()
    Returns the metric identifier.
    double
    max()
    Returns the maximum recorded value.
    double
    Returns the mean of all recorded values.
    double
    percentile(double p)
    Returns the value at the given percentile.
    void
    record(double value)
    Records a value in the histogram.
    double
    Returns the total sum of all recorded values.
  • Method Details

    • record

      void record(double value)
      Records a value in the histogram. 在直方图中记录一个值。
      Parameters:
      value - the value to record | 要记录的值
    • count

      long count()
      Returns the number of recorded values. 返回已记录值的数量。
      Returns:
      the count | 计数
    • totalAmount

      double totalAmount()
      Returns the total sum of all recorded values. 返回所有已记录值的总和。
      Returns:
      the total amount | 总量
    • max

      double max()
      Returns the maximum recorded value. 返回最大已记录值。
      Returns:
      the max value | 最大值
    • mean

      double mean()
      Returns the mean of all recorded values. 返回所有已记录值的均值。
      Returns:
      the mean value | 均值
    • percentile

      double percentile(double p)
      Returns the value at the given percentile. 返回给定百分位数处的值。
      Parameters:
      p - the percentile in range [0.0, 1.0] | 百分位数,范围 [0.0, 1.0]
      Returns:
      the value at that percentile | 该百分位数处的值
      Throws:
      ObservabilityException - if p is outside [0.0, 1.0] | 如果 p 不在 [0.0, 1.0] 范围内
    • id

      MetricId id()
      Returns the metric identifier. 返回指标标识符。
      Returns:
      the MetricId | 指标 ID