Package bucket provides utility functions for constructing and merging histogram buckets. Buckets are meant to be used in the base metrics package's HistogramSpec struct.
Flatten concatenates multiple sets of buckets into a single slice. After flattening, it checks that the result is sorted and that no buckets are duplicated.
NewExponential creates n exponential buckets, starting with the supplied initial value and increasing by a user-defined factor each time.
If n is less than one, the initial value is less than one, or the factor is less than two, NewExponential returns a nil slice.
NewLinear creates n linear buckets, starting with the supplied initial value and increasing by a user-defined width.
If n or width are less than one, NewLinear returns a nil slice.
NewRPCLatency returns a hand-crafted set of buckets useful for tracking the latency of RPCs (in milliseconds). Buckets range from 1 to 10000 (i.e., 1ms-10s), getting less granular as latency increases.