client_rust
client_rust copied to clipboard
Add .get() to Family hashmap wrapper
I have come across a few instances were I would like to check if a particular metric exists in the metric Family
without creating a new entry if it doesn't. This PR simply exposes the HashMap::get()
function to allow for match metric_family.get()
type logic.
Let me know if there is anything else needed to get this change merged.
Thanks for the pull request.
In order for me to better understand the feature request, mind expanding on your concrete use-cases for this method?
https://github.com/prometheus/client_rust/issues/131#issuecomment-1481962341 describes the use case (allows me to access the metrics of a family to do comparisons against, or use to trigger logic without modifying the underlying data structure).