Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add with_prefix to Registry #70

Merged
merged 4 commits into from Jul 14, 2022
Merged

Conversation

Victor-N-Suadicani
Copy link
Contributor

Adds the ability to create a registry with a prefix.

This is actually already possible through the below hack but this makes it a lot easier and neater.

let prefixed_registry = {
    let mut registry = <Registry>::default();
    let prefixed_registry = registry.sub_registry_with_prefix(prefix);
    std::mem::take(prefixed_registry)
};

This is useful to set an application-wide prefix on the single registry for all your metrics.

Copy link
Member

@mxinden mxinden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just two comments. Thanks for sending in a pull request!

Would you mind adding a changelog entry?

src/registry.rs Show resolved Hide resolved
src/registry.rs Outdated Show resolved Hide resolved
Signed-off-by: Victor Nordam Suadicani <v.n.suadicani@gmail.com>
Co-authored-by: Max Inden <mail@max-inden.de>

Signed-off-by: Victor Nordam Suadicani <v.n.suadicani@gmail.com>
Signed-off-by: Victor Nordam Suadicani <v.n.suadicani@gmail.com>
CHANGELOG.md Outdated Show resolved Hide resolved
Signed-off-by: Max Inden <mail@max-inden.de>
Copy link
Member

@mxinden mxinden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great. Thanks!

@mxinden mxinden merged commit 353c7ac into prometheus:master Jul 14, 2022
ackintosh pushed a commit to ackintosh/client_rust that referenced this pull request Aug 27, 2022
Signed-off-by: Victor Nordam Suadicani <v.n.suadicani@gmail.com>
Signed-off-by: ackintosh <sora.akatsuki@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants