pub struct PrometheusInstance<'a, N, ValueSet>{ /* private fields */ }
Implementations§
Source§impl<'a, N> PrometheusInstance<'a, N, MissingValue>
impl<'a, N> PrometheusInstance<'a, N, MissingValue>
Source§impl<'a, N, ValueSet> PrometheusInstance<'a, N, ValueSet>
impl<'a, N, ValueSet> PrometheusInstance<'a, N, ValueSet>
pub fn with_label<L, V>(self, l: L, v: V) -> Self
Sourcepub fn with_timestamp(self, timestamp: u128) -> Self
pub fn with_timestamp(self, timestamp: u128) -> Self
Adds the optional timestamp to the instance.
Example:
use prometheus_exporter_base::prelude::*;
PrometheusInstance::new()
.with_timestamp(123)
.with_value(123);
Sourcepub fn with_current_timestamp(self) -> Result<Self, SystemTimeError>
pub fn with_current_timestamp(self) -> Result<Self, SystemTimeError>
Adds the current timestamp to the instance. The timestamp
is calculated as milliseconds from the current UNIX_EPOCH
as per
specification.
Example:
use prometheus_exporter_base::prelude::*;
PrometheusInstance::new()
.with_current_timestamp()
.expect("failed to get the UNIX epoch")
.with_value(123);
Sourcepub fn with_value(self, value: N) -> PrometheusInstance<'a, N, Yes>
pub fn with_value(self, value: N) -> PrometheusInstance<'a, N, Yes>
Adds the current value to the instance. The value will be formatted as float as per specification.
Example:
use prometheus_exporter_base::prelude::*;
PrometheusInstance::new()
.with_value(123);
Trait Implementations§
Source§impl<'a, N, ValueSet: Clone> Clone for PrometheusInstance<'a, N, ValueSet>
impl<'a, N, ValueSet: Clone> Clone for PrometheusInstance<'a, N, ValueSet>
Source§fn clone(&self) -> PrometheusInstance<'a, N, ValueSet>
fn clone(&self) -> PrometheusInstance<'a, N, ValueSet>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<'a, N, ValueSet: Debug> Debug for PrometheusInstance<'a, N, ValueSet>
impl<'a, N, ValueSet: Debug> Debug for PrometheusInstance<'a, N, ValueSet>
Source§impl<'a, N> Default for PrometheusInstance<'a, N, MissingValue>
impl<'a, N> Default for PrometheusInstance<'a, N, MissingValue>
Auto Trait Implementations§
impl<'a, N, ValueSet> Freeze for PrometheusInstance<'a, N, ValueSet>where
N: Freeze,
impl<'a, N, ValueSet> RefUnwindSafe for PrometheusInstance<'a, N, ValueSet>where
N: RefUnwindSafe,
ValueSet: RefUnwindSafe,
impl<'a, N, ValueSet> Send for PrometheusInstance<'a, N, ValueSet>
impl<'a, N, ValueSet> Sync for PrometheusInstance<'a, N, ValueSet>
impl<'a, N, ValueSet> Unpin for PrometheusInstance<'a, N, ValueSet>
impl<'a, N, ValueSet> UnwindSafe for PrometheusInstance<'a, N, ValueSet>where
N: UnwindSafe,
ValueSet: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more