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 TypeMethodDescriptionlongcount()Returns the number of recorded values.id()Returns the metric identifier.doublemax()Returns the maximum recorded value.doublemean()Returns the mean of all recorded values.doublepercentile(double p) Returns the value at the given percentile.voidrecord(double value) Records a value in the histogram.doubleReturns 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
-