Struct metrics_process::Collector
source · pub struct Collector { /* private fields */ }
Expand description
Prometheus style process metrics collector
Implementations§
source§impl Collector
impl Collector
sourcepub fn prefix(self, prefix: impl Into<String>) -> Self
pub fn prefix(self, prefix: impl Into<String>) -> Self
Add an prefix that is prepended to metric keys.
Examples
let collector = Collector::default().prefix("my_prefix_");
sourcepub fn describe(&self)
pub fn describe(&self)
Describe available metrics through describe_gauge!
macro of metrics
crate.
Example
// Recorder must be initialized prior to describe.
let builder = PrometheusBuilder::new();
builder.install().expect("failed to install recorder/exporter");
let collector = Collector::default();
// Describe collector
collector.describe();
sourcepub fn collect(&self)
pub fn collect(&self)
Collect metrics and record through gauge!
macro of metrics
crate.
Example
// Recorder must be initialized prior to describe.
let builder = PrometheusBuilder::new();
builder.install().expect("failed to install recorder/exporter");
let collector = Collector::default();
collector.describe();
// Collect metrics
collector.collect();
Trait Implementations§
source§impl PartialEq for Collector
impl PartialEq for Collector
impl Eq for Collector
impl StructuralEq for Collector
impl StructuralPartialEq for Collector
Auto Trait Implementations§
impl RefUnwindSafe for Collector
impl Send for Collector
impl Sync for Collector
impl Unpin for Collector
impl UnwindSafe for Collector
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