Struct metrics_process::Collector
source · [−]pub struct Collector { /* private fields */ }
Expand description
Prometheus style process metrics collector
Implementations
sourceimpl Collector
impl Collector
sourcepub fn new(prefix: impl Into<String>) -> Self
pub fn new(prefix: impl Into<String>) -> Self
Create a new Collector instance
prefix
- A prefix string that is prepended to metric keys.
Examples
let collector = Collector::new("my_metrics_");
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::new("my_metrics_");
// 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::new("my_metrics_");
collector.describe();
// Collect metrics
collector.collect();
Trait Implementations
sourceimpl PartialEq<Collector> for Collector
impl PartialEq<Collector> 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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more