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
👎Deprecated since 1.1.0: Use Collector::new(prefix)
.
pub fn prefix(self, prefix: impl Into<String>) -> Self
Collector::new(prefix)
.sourcepub fn new(prefix: impl AsRef<str>) -> Self
pub fn new(prefix: impl AsRef<str>) -> Self
Create a new Collector instance with the provided prefix that is prepended to metric keys.
§Examples
let collector = Collector::default();
sourcepub fn describe(&self)
pub fn describe(&self)
Describe available metrics through describe_counter!
and 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 counter!
and 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 StructuralPartialEq for Collector
Auto Trait Implementations§
impl Freeze for Collector
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