#[non_exhaustive]pub struct Distribution {
pub count: i64,
pub mean: f64,
pub minimum: f64,
pub maximum: f64,
pub sum_of_squared_deviation: f64,
pub bucket_counts: Vec<i64>,
pub exemplars: Vec<Exemplar>,
pub bucket_option: Option<BucketOption>,
/* private fields */
}Expand description
Distribution represents a frequency distribution of double-valued sample points. It contains the size of the population of sample points plus additional optional information:
- the arithmetic mean of the samples
- the minimum and maximum of the samples
- the sum-squared-deviation of the samples, used to compute variance
- a histogram of the values of the sample points
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.count: i64The total number of samples in the distribution. Must be >= 0.
mean: f64The arithmetic mean of the samples in the distribution. If count is
zero then this field must be zero.
minimum: f64The minimum of the population of values. Ignored if count is zero.
maximum: f64The maximum of the population of values. Ignored if count is zero.
sum_of_squared_deviation: f64The sum of squared deviations from the mean:
Sum[i=1..count]((x_i - mean)^2)
where each x_i is a sample values. If count is zero then this field
must be zero, otherwise validation of the request fails.
bucket_counts: Vec<i64>The number of samples in each histogram bucket. bucket_counts are
optional. If present, they must sum to the count value.
The buckets are defined below in bucket_option. There are N buckets.
bucket_counts[0] is the number of samples in the underflow bucket.
bucket_counts[1] to bucket_counts[N-1] are the numbers of samples
in each of the finite buckets. And bucket_counts[N] is the number of samples in the overflow bucket. See the comments of bucket_option`
below for more details.
Any suffix of trailing zeros may be omitted.
exemplars: Vec<Exemplar>Example points. Must be in increasing order of value field.
bucket_option: Option<BucketOption>Defines the buckets in the histogram. bucket_option and bucket_counts
must be both set, or both unset.
Buckets are numbered in the range of [0, N], with a total of N+1 buckets.
There must be at least two buckets (a single-bucket histogram gives
no information that isn’t already provided by count).
The first bucket is the underflow bucket which has a lower bound of -inf. The last bucket is the overflow bucket which has an upper bound of +inf. All other buckets (if any) are called “finite” buckets because they have finite lower and upper bounds. As described below, there are three ways to define the finite buckets.
(1) Buckets with constant width. (2) Buckets with exponentially growing widths. (3) Buckets with arbitrary user-provided widths.
In all cases, the buckets cover the entire real number line (-inf, +inf). Bucket upper bounds are exclusive and lower bounds are inclusive. The upper bound of the underflow bucket is equal to the lower bound of the smallest finite bucket; the lower bound of the overflow bucket is equal to the upper bound of the largest finite bucket.
Implementations§
Source§impl Distribution
impl Distribution
pub fn new() -> Self
Sourcepub fn set_minimum<T: Into<f64>>(self, v: T) -> Self
pub fn set_minimum<T: Into<f64>>(self, v: T) -> Self
Sets the value of minimum.
Sourcepub fn set_maximum<T: Into<f64>>(self, v: T) -> Self
pub fn set_maximum<T: Into<f64>>(self, v: T) -> Self
Sets the value of maximum.
Sourcepub fn set_sum_of_squared_deviation<T: Into<f64>>(self, v: T) -> Self
pub fn set_sum_of_squared_deviation<T: Into<f64>>(self, v: T) -> Self
Sets the value of sum_of_squared_deviation.
Sourcepub fn set_bucket_counts<T, V>(self, v: T) -> Self
pub fn set_bucket_counts<T, V>(self, v: T) -> Self
Sets the value of bucket_counts.
Sourcepub fn set_exemplars<T, V>(self, v: T) -> Self
pub fn set_exemplars<T, V>(self, v: T) -> Self
Sets the value of exemplars.
Sourcepub fn set_bucket_option<T: Into<Option<BucketOption>>>(self, v: T) -> Self
pub fn set_bucket_option<T: Into<Option<BucketOption>>>(self, v: T) -> Self
Sets the value of bucket_option.
Note that all the setters affecting bucket_option are mutually
exclusive.
Sourcepub fn linear_buckets(&self) -> Option<&Box<LinearBuckets>>
pub fn linear_buckets(&self) -> Option<&Box<LinearBuckets>>
The value of bucket_option
if it holds a LinearBuckets, None if the field is not set or
holds a different branch.
Sourcepub fn set_linear_buckets<T: Into<Box<LinearBuckets>>>(self, v: T) -> Self
pub fn set_linear_buckets<T: Into<Box<LinearBuckets>>>(self, v: T) -> Self
Sets the value of bucket_option
to hold a LinearBuckets.
Note that all the setters affecting bucket_option are
mutually exclusive.
Sourcepub fn exponential_buckets(&self) -> Option<&Box<ExponentialBuckets>>
pub fn exponential_buckets(&self) -> Option<&Box<ExponentialBuckets>>
The value of bucket_option
if it holds a ExponentialBuckets, None if the field is not set or
holds a different branch.
Sourcepub fn set_exponential_buckets<T: Into<Box<ExponentialBuckets>>>(
self,
v: T,
) -> Self
pub fn set_exponential_buckets<T: Into<Box<ExponentialBuckets>>>( self, v: T, ) -> Self
Sets the value of bucket_option
to hold a ExponentialBuckets.
Note that all the setters affecting bucket_option are
mutually exclusive.
Sourcepub fn explicit_buckets(&self) -> Option<&Box<ExplicitBuckets>>
pub fn explicit_buckets(&self) -> Option<&Box<ExplicitBuckets>>
The value of bucket_option
if it holds a ExplicitBuckets, None if the field is not set or
holds a different branch.
Sourcepub fn set_explicit_buckets<T: Into<Box<ExplicitBuckets>>>(self, v: T) -> Self
pub fn set_explicit_buckets<T: Into<Box<ExplicitBuckets>>>(self, v: T) -> Self
Sets the value of bucket_option
to hold a ExplicitBuckets.
Note that all the setters affecting bucket_option are
mutually exclusive.
Trait Implementations§
Source§impl Clone for Distribution
impl Clone for Distribution
Source§fn clone(&self) -> Distribution
fn clone(&self) -> Distribution
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more