apache_beam.utils.histogram module¶
- class apache_beam.utils.histogram.Histogram(bucket_type)[source]¶
Bases:
object
A histogram that supports estimated percentile with linear interpolation.
- get_linear_interpolation(percentile)[source]¶
Calculate percentile estimation based on linear interpolation.
It first finds the bucket which includes the target percentile and projects the estimated point in the bucket by assuming all the elements in the bucket are uniformly distributed.
- Parameters:
percentile – The target percentile of the value returning from this method. Should be a floating point number greater than 0 and less than 1.
- class apache_beam.utils.histogram.LinearBucket(start, width, num_buckets)[source]¶
Bases:
BucketType
Create a histogram with linear buckets.
- Parameters:
start – Lower bound of a starting bucket.
width – Bucket width. Smaller width implies a better resolution for percentile estimation.
num_buckets – The number of buckets. Upper bound of an ending bucket is defined by start + width * numBuckets.