Struct prometheus::Registry
source · [−]pub struct Registry { /* private fields */ }
Expand description
A struct for registering Prometheus collectors, collecting their metrics, and gathering
them into MetricFamilies
for exposition.
Implementations
sourceimpl Registry
impl Registry
sourcepub fn new_custom(
prefix: Option<String>,
labels: Option<HashMap<String, String>>
) -> Result<Registry>
pub fn new_custom(
prefix: Option<String>,
labels: Option<HashMap<String, String>>
) -> Result<Registry>
Create a new registry, with optional custom prefix and labels.
sourcepub fn register(&self, c: Box<dyn Collector>) -> Result<()>
pub fn register(&self, c: Box<dyn Collector>) -> Result<()>
register
registers a new Collector
to be included in metrics
collection. It returns an error if the descriptors provided by the
Collector
are invalid or if they — in combination with descriptors of
already registered Collectors — do not fulfill the consistency and
uniqueness criteria described in the documentation of Desc
.
If the provided Collector
is equal to a Collector
already registered
(which includes the case of re-registering the same Collector
), the
AlreadyReg error returns.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Registry
impl Send for Registry
impl Sync for Registry
impl Unpin for Registry
impl !UnwindSafe for Registry
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more