feat(metrics/family): 🍫 add Family::get_or_create_owned()#244
Merged
mxinden merged 5 commits intoprometheus:masterfrom Feb 9, 2025
Merged
feat(metrics/family): 🍫 add Family::get_or_create_owned()#244mxinden merged 5 commits intoprometheus:masterfrom
Family::get_or_create_owned()#244mxinden merged 5 commits intoprometheus:masterfrom
Conversation
13dbb03 to
fb14089
Compare
fb14089 to
708c1ec
Compare
Contributor
Author
|
i've rebased this commit to address merge conflicts, and added information to the changelog. let me know if there is anything else that needs to be done. i am keen on a release that addresses the deadlocks reported in #231. |
mxinden
reviewed
Feb 3, 2025
Member
mxinden
left a comment
There was a problem hiding this comment.
Thank you for working on this.
mxinden
reviewed
Feb 9, 2025
Member
mxinden
left a comment
There was a problem hiding this comment.
Two more comments. Otherwise looks good to me.
Agreed, that this is not the ideal solution, but in my eyes a good compromise, given that it is not a breaking change. Long term, we can redesign this interface in a breaking release.
cratelyn
added a commit
to cratelyn/prometheus-client
that referenced
this pull request
Feb 9, 2025
prometheus#244 (comment) Signed-off-by: katelyn martin <me+cratelyn@katelyn.world>
fixes prometheus#231. this introduces a new method to `Family<S, M, C>` to help alleviate the risk of deadlocks when accessing multiple series within a given metrics family. this returns a plain `M`, rather than the `MappedRwLockReadGuard<M>` RAII guard returned by `get_or_create()`. a test case is introduced in this commit to demonstrate that structures accessing multiple series within a single expression will not accidentally create a deadlock. Signed-off-by: katelyn martin <me+cratelyn@katelyn.world>
this linked to the wrong method. this is now fixed. Signed-off-by: katelyn martin <me+cratelyn@katelyn.world>
prometheus#244 (comment) Signed-off-by: katelyn martin <me+cratelyn@katelyn.world>
9e34bd3 to
4f11006
Compare
mxinden
reviewed
Feb 9, 2025
Signed-off-by: Max Inden <mail@max-inden.de>
Family::get_or_create_clone()Family::get_or_create_owned()
mxinden
reviewed
Feb 9, 2025
Signed-off-by: Max Inden <mail@max-inden.de>
mxinden
approved these changes
Feb 9, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #231.
this introduces a new method to
Family<S, M, C>to help alleviate the risk of deadlocks when accessing multiple series within a given metrics family.this returns a plain
M, rather than theMappedRwLockReadGuard<M>RAII guard returned byget_or_create().a test case is introduced in this commit to demonstrate that structures accessing multiple series within a single expression will not accidentally create a deadlock.