Skip to content

Commit

Permalink
Add with_prefix
Browse files Browse the repository at this point in the history
Signed-off-by: Victor Nordam Suadicani <[email protected]>
  • Loading branch information
Victor-N-Suadicani committed Jul 8, 2022
1 parent 69e6674 commit 1af568b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@ impl<M> Default for Registry<M> {
}

impl<M> Registry<M> {
/// Creates a new default registry with the given prefix.
pub fn with_prefix(prefix: impl Into<String>) -> Self {
Self {
prefix: Some(Prefix(prefix.into())),
..Default::default()
}
}

/// Register a metric with the [`Registry`].
///
/// Note: In the Open Metrics text exposition format some metric types have
Expand Down

0 comments on commit 1af568b

Please sign in to comment.