-
Notifications
You must be signed in to change notification settings - Fork 85
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
feat(registry): add with_prefix_and_labels
constructor
#147
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put simply there are two ways to create a registry:
- From scratch e.g. via
Registry::with_prefix
or<Registry as Default>::default
. - From a parent registry e.g. via
Registry::sub_registry_with_prefix
.
What do you think of changing this patch to follow (2) and not (1). It would be a convenience method for folks wanting a sub registry with a prefix and one or more labels. It would still be possible for folks that want (1) via Registry::default().sub_registry_with_prefix_and_labels(..)
.
Is there any reason there is a separate
I think we might still want something similar to (1), at least that's my usecase (and that's why I made this pull request in the first place). If I really want ALL my metrics to have a prefix AND a bunch of labels, it seems a bit weird to simulate the root registry using a sub-registry. |
Signed-off-by: Adrian Pop <[email protected]>
@mxinden any update/feedback on this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay here. Thank you for expanding on your use-case. Agreed that we should support it.
For the sake of consistency, what do you think about also adding Registry::with_labels
?
Also can you bump the crate version in Cargo.toml
to v0.21.2
and add a changelog entry in CHANGELOG.md
?
Signed-off-by: Adrian Pop <[email protected]>
Signed-off-by: Adrian Pop <[email protected]>
Done, added the extra method + updated changelog and bumped version. |
Signed-off-by: Adrian Pop <[email protected]>
with_prefix_and_labels
constructor
Signed-off-by: Max Inden <[email protected]>
Signed-off-by: Max Inden <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the continued work!
Added new constructor per discussion in #146.