Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Histogram ¶
type Histogram interface { // Returns an approximation of the given percentile of the distribution. // Note: the argument passed to Percentile() is a number between // 0 and 1. For example 0.5 corresponds to the median and 0.9 to the // 90th percentile. // If the histogram is empty, Percentile() returns 0.0. Percentile(percentile float64) float64 // Add a sample with a given value and weight. AddSample(value float64, weight float64, time time.Time) // Remove a sample with a given value and weight. Note that the total // weight of samples with a given value cannot be negative. SubtractSample(value float64, weight float64, time time.Time) // Add all samples from another histogram. Requires the histograms to be // of the exact same type. Merge(other Histogram) // Returns true if the histogram is empty. IsEmpty() bool // Returns true if the histogram is equal to another one. The two // histograms must use the same HistogramOptions object (not two // different copies). // If the two histograms are not of the same runtime type returns false. Equals(other Histogram) bool // Returns a human-readable text description of the histogram. String() string // SaveToChekpoint returns a representation of the histogram as a // HistogramCheckpoint. During conversion buckets with small weights // can be omitted. SaveToChekpoint() (*vpa_types.HistogramCheckpoint, error) // LoadFromCheckpoint loads data from the checkpoint into the histogram // by appending samples. LoadFromCheckpoint(*vpa_types.HistogramCheckpoint) error }
Histogram represents an approximate distribution of some variable.
func NewDecayingHistogram ¶
func NewDecayingHistogram(options HistogramOptions, halfLife time.Duration) Histogram
func NewHistogram ¶
func NewHistogram(options HistogramOptions) Histogram
type HistogramOptions ¶
type HistogramOptions interface { // Returns the number of buckets in the histogram. NumBuckets() int // Returns the index of the bucket to which the given value falls. // If the value is outside of the range covered by the histogram, it // returns the closest bucket (either the first or the last one). FindBucket(value float64) int // Returns the start of the bucket with a given index. If the index is // outside the [0..NumBuckets() - 1] range, the result is undefined. GetBucketStart(bucket int) float64 // Returns the minimum weight for a bucket to be considered non-empty. Epsilon() float64 }
HistogramOptions define the number and size of buckets of a histogram.
func NewLinearHistogramOptions ¶
func NewLinearHistogramOptions(maxValue float64, bucketSize float64, epsilon float64) (HistogramOptions, error)
Click to show internal directories.
Click to hide internal directories.