-
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
src/metrics/family.rs: Add remove and clear methods, and tests #85
src/metrics/family.rs: Add remove and clear methods, and tests #85
Conversation
c467c47
to
35f0e3e
Compare
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.
Solid work! Thanks, especially for the doc comment and example!
According to the client library documentation there should be both a remove
and a clear
. I don't have a strong opinion for the latter. But given that is should be easy to add, what do you think of including it in this pull request?
Metrics with labels SHOULD support a remove() method with the same signature as labels() that will remove a Child from the metric no longer exporting it, and a clear() method that removes all Children from the metric. These invalidate caching of Children.
https://prometheus.io/docs/instrumenting/writing_clientlibs/#labels
I'd be happy to work on adding a |
No rush @phyber. Thanks for the help. |
f0acbd5
to
7fb4320
Compare
The redundant |
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.
Thanks for the follow-ups!
Just needs a bump of the patch version in Cargo.toml
and a changelog entry in CHANGELOG.md
.
2768a32
to
79ff924
Compare
Signed-off-by: David O'Rourke <david.orourke@gmail.com>
Also remove redundant write method. Signed-off-by: David O'Rourke <david.orourke@gmail.com>
Signed-off-by: David O'Rourke <david.orourke@gmail.com>
Signed-off-by: David O'Rourke <david.orourke@gmail.com>
79ff924
to
d8c9bce
Compare
Rebased onto the current I didn’t bump the version in |
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.
🙏
This PR adds
Family::remove
as discussed a little in #36 along with a basic test for the behaviour. We also add aFamily::clear
method as discussed in this PR.The
Family::remove
method returns abool
to indicate if a label set was removed, which matches what the Go client does when removing its equivalent of a label set.The
Family::clear
method does not return anything and always successfully clears the label sets.