@Experimental public class HistogramData extends java.lang.Object implements java.io.Serializable
We may consider using Apache Commons or HdrHistogram library in the future for advanced features such as sparsely populated histograms.
This class is considered experimental and may break or receive backwards-incompatible changes in future versions of the Apache Beam SDK.
| Modifier and Type | Class and Description |
|---|---|
static interface |
HistogramData.BucketType |
static class |
HistogramData.LinearBuckets |
| Constructor and Description |
|---|
HistogramData(HistogramData.BucketType bucketType)
Create a histogram.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
long |
getBottomBucketCount() |
HistogramData.BucketType |
getBucketType() |
long |
getCount(int bucketIndex)
TODO(BEAM-12103): Update this function to allow indexing the -INF and INF bucket (using 0 and
length -1) Get the bucket count for the given bucketIndex.
|
java.lang.String |
getPercentileString(java.lang.String elemType,
java.lang.String unit) |
long |
getTopBucketCount() |
long |
getTotalCount() |
void |
incBottomBucketCount(long count) |
void |
incBucketCount(int bucketIndex,
long count) |
void |
incTopBucketCount(long count) |
static HistogramData |
linear(double start,
double width,
int numBuckets)
TODO(BEAM-12103): Update this function to define numBuckets total, including the infinite
buckets.
|
double |
p50() |
double |
p90() |
double |
p99() |
void |
record(double... values) |
void |
record(double value) |
void |
update(HistogramData other) |
public HistogramData(HistogramData.BucketType bucketType)
bucketType - a bucket type for a new histogram instance.public HistogramData.BucketType getBucketType()
public static HistogramData linear(double start, double width, int numBuckets)
start - Lower bound of a starting bucket.width - Bucket width. Smaller width implies a better resolution for percentile estimation.numBuckets - The number of buckets. Upper bound of an ending bucket is defined by start +
width * numBuckets.public void record(double... values)
public void update(HistogramData other)
public void incBucketCount(int bucketIndex,
long count)
public void incTopBucketCount(long count)
public void incBottomBucketCount(long count)
public void clear()
public void record(double value)
public long getTotalCount()
public java.lang.String getPercentileString(java.lang.String elemType,
java.lang.String unit)
public long getCount(int bucketIndex)
This method does not guarantee the atomicity when sequentially accessing the multiple buckets i.e. other threads may alter the value between consecutive invocations. For summing the total number of elements in the histogram, use `getTotalCount()` instead.
bucketIndex - index of the bucketpublic long getTopBucketCount()
public long getBottomBucketCount()
public double p99()
public double p90()
public double p50()