V3MetricBuilder

Struct V3MetricBuilder 

Source
pub struct V3MetricBuilder<'a> { /* private fields */ }
Expand description

Builder for a single metric within a V3 payload.

Use the setter methods to configure the metric, add points with add_point, then call close to finalize.

Implementations§

Source§

impl<'a> V3MetricBuilder<'a>

Source

pub fn set_tags<I, S>(&mut self, tags: I)
where I: Iterator<Item = S>, S: AsRef<str>,

Sets the tags for this metric.

Tags should be in “key:value” format.

Source

pub fn set_resources(&mut self, resources: &[(&str, &str)])

Sets the resources for this metric.

Resources are (type, name) pairs, for example, (host, server1).

Source

pub fn set_interval(&mut self, interval: u64)

Sets the interval for this metric (used for rate metrics).

Source

pub fn set_source_type(&mut self, source_type: &str)

Sets the source type name for this metric.

Source

pub fn set_origin( &mut self, product: u32, category: u32, service: u32, no_index: bool, )

Sets the origin metadata for this metric.

Source

pub fn set_unit(&mut self, unit: &str)

Sets the unit for this metric.

Source

pub fn add_point(&mut self, timestamp: i64, value: f64)

Adds a data point to this metric.

Source

pub fn add_sketch( &mut self, timestamp: i64, count: i64, sum: f64, min: f64, max: f64, bin_keys: &[i32], bin_counts: &[u32], )

Adds sketch data for a distribution metric.

For sketches, the summary values (count, sum, min, max) are stored as points, and the bin keys/counts are stored separately.

Source

pub fn close(self)

Finalizes this metric.

This compacts the point values to use the smallest representation that can hold all values without loss.

Auto Trait Implementations§

§

impl<'a> Freeze for V3MetricBuilder<'a>

§

impl<'a> RefUnwindSafe for V3MetricBuilder<'a>

§

impl<'a> Send for V3MetricBuilder<'a>

§

impl<'a> Sync for V3MetricBuilder<'a>

§

impl<'a> Unpin for V3MetricBuilder<'a>

§

impl<'a> !UnwindSafe for V3MetricBuilder<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.