[−][src]Struct prometheus_exporter_base::PrometheusCounter
Fields
counter_name: &'a str
counter_type: &'a str
counter_help: &'a str
Methods
impl<'a> PrometheusCounter<'a>
[src]
pub fn new(
counter_name: &'a str,
counter_type: &'a str,
counter_help: &'a str
) -> PrometheusCounter<'a>
[src]
counter_name: &'a str,
counter_type: &'a str,
counter_help: &'a str
) -> PrometheusCounter<'a>
pub fn render_header(&self) -> String
[src]
pub fn render_counter<N>(
&self,
attributes: Option<&[(&'a str, &'a str)]>,
value: N
) -> String where
N: Display,
[src]
&self,
attributes: Option<&[(&'a str, &'a str)]>,
value: N
) -> String where
N: Display,
Returns the valid Prometheus string, given the optional attributes and the value.
The counter name is in &self
.
Arguments
attributes
- A slice of pairs indicating Attribute-Value. It is optional.value
- A Display-able value that will be appended as counter value.
Example
use prometheus_exporter_base::PrometheusCounter; let pc = PrometheusCounter::new("folder_size", "counter", "Size of the folder"); let mut s = pc.render_header(); let mut attributes = Vec::new(); attributes.push(("folder", "/var/log/")); s.push_str(&pc.render_counter(Some(&attributes), 1024)); attributes[0].1 = "/tmp"; s.push_str(&pc.render_counter(Some(&attributes), 5_000_000));
Auto Trait Implementations
impl<'a> Send for PrometheusCounter<'a>
impl<'a> Sync for PrometheusCounter<'a>
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for 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.
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,