Struct telemetry::plain::Linear [−][src]
Linear histograms.
Linear histograms classify numeric integer values into same-sized buckets. This type is typically used for percentages, or to store a relatively precise approximation of the amount of resources (time, memory) used by a section or a data structure.
With SerializationFormat::SimpleJson
, these histograms are
serialized as an array of numbers, one per bucket, in the numeric
order of buckets.
Implementations
impl<T> Linear<T> where
T: Flatten,
[src]
T: Flatten,
pub fn new(
service: &Service,
name: String,
min: u32,
max: u32,
buckets: usize
) -> Linear<T>
[src]
service: &Service,
name: String,
min: u32,
max: u32,
buckets: usize
) -> Linear<T>
Create a new Linear histogram with a given name.
-
name
is used as key when processing and exporting the data. Eachname
must be unique to theService
. -
min
is the minimal value expected to be entered in this histogram. Any value lower thanmin
is rounded up tomin
. -
max
is the maximal value expected to be entered in this histogram. Any value higher thanmax
is rounded up tomax
. -
buckets
is the number of buckets in this histogram. For highest possible precision, usebuckets = max - min + 1
. In most cases, however, such precision is not needed, so you should use a lower number of buckets.
Performance
Increasing the number of buckets increases the memory usage on the client by a few bytes per bucket. More importantly, it also increases the size of the payload, hence the total amount of data that the application will eventually upload to a central server. If your application has many clients and you wish to keep your server happy and your bandwidth costs manageable, don’t use too many buckets.
Panics
If name
is already used by another histogram in service
.
If min >= max
.
If buckets < max - min + 1
.
Trait Implementations
impl<T> Clone for Linear<T> where
T: Flatten,
[src]
T: Flatten,
fn clone(&self) -> Self
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T> Histogram<T> for Linear<T> where
T: Flatten,
[src]
T: Flatten,
Auto Trait Implementations
impl<T> !RefUnwindSafe for Linear<T>
impl<T> Send for Linear<T> where
T: Send,
T: Send,
impl<T> !Sync for Linear<T>
impl<T> Unpin for Linear<T> where
T: Unpin,
T: Unpin,
impl<T> !UnwindSafe for Linear<T>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,