-
Notifications
You must be signed in to change notification settings - Fork 76
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
Way to unregister "MetricFamily" from registry #204
Comments
Actually #154 solves the first part of my usecase since I can just stitch together the registries of my sub-systems. 👍 The only part left is just a way to unregister a metric family. |
sub_registry
with prefix. and unregister "MetricFamily" from registrysub_registry
with prefix. and~ unregister "MetricFamily" from registry
sub_registry
with prefix. and~ unregister "MetricFamily" from registryAll credits on the initial idea, implementation, and testing belong to @amunra, who is the original author of this PR prometheus#154. From the original PR description: Adds new `encode_registry` and `encode_eof` functions to allow encoding of parts of the response. This is useful when there are multiple registries at play, or when composing metrics for a process that embeds Rust as part of its logic whilst serving metrics to Prometheus outside of Rust. Fixes: prometheus#153 Refs: prometheus#154, prometheus#204 Co-authored-by: Adam Cimarosti <amunra@users.noreply.github.com> Signed-off-by: Tyrone Wu <wudevelops@gmail.com>
All credits on the initial idea, implementation, and testing belong to @amunra, who is the original author of this PR prometheus#154. From the original PR description: Adds new `encode_registry` and `encode_eof` functions to allow encoding of parts of the response. This is useful when there are multiple registries at play, or when composing metrics for a process that embeds Rust as part of its logic whilst serving metrics to Prometheus outside of Rust. Fixes: prometheus#153 Refs: prometheus#154, prometheus#204 Co-authored-by: amunra <amunra@users.noreply.github.com> Signed-off-by: tyrone-wu <wudevelops@gmail.com>
All credits on the initial idea, implementation, and testing belong to @amunra, who is the original author of this PR prometheus#154. From the original PR description: Adds new `encode_registry` and `encode_eof` functions to allow encoding of parts of the response. This is useful when there are multiple registries at play, or when composing metrics for a process that embeds Rust as part of its logic whilst serving metrics to Prometheus outside of Rust. Fixes: prometheus#153 Refs: prometheus#154, prometheus#204 Co-authored-by: amunra <cimarosti@gmail.com> Signed-off-by: tyrone-wu <wudevelops@gmail.com>
Adds function `unregister` that remove a metric family from the registry from the family's name and unit (if present). Fixes: prometheus#204 Signed-off-by: tyrone-wu <wudevelops@gmail.com>
Adds function `unregister` that remove a metric family from the registry from the family's name and unit (if present). Fixes: prometheus#204 Signed-off-by: tyrone-wu <wudevelops@gmail.com>
Alright, so I have sort of a working progress. Removing it from metrics list is pretty straightforward, however, there's the issue how to approach cleaning up leftover My initial idea was to have |
All credits on the initial idea, implementation, and testing belong to @amunra, who is the original author of this PR prometheus#154. From the original PR description: Adds new `encode_registry` and `encode_eof` functions to allow encoding of parts of the response. This is useful when there are multiple registries at play, or when composing metrics for a process that embeds Rust as part of its logic whilst serving metrics to Prometheus outside of Rust. Fixes: prometheus#153 Refs: prometheus#154, prometheus#204 Co-authored-by: amunra <cimarosti@gmail.com> Signed-off-by: tyrone-wu <wudevelops@gmail.com>
#205) All credits on the initial idea, implementation, and testing belong to @amunra, who is the original author of this PR #154. From the original PR description: Adds new `encode_registry` and `encode_eof` functions to allow encoding of parts of the response. This is useful when there are multiple registries at play, or when composing metrics for a process that embeds Rust as part of its logic whilst serving metrics to Prometheus outside of Rust. Fixes: #153 Refs: #154, #204 Co-authored-by: amunra <cimarosti@gmail.com> Signed-off-by: tyrone-wu <wudevelops@gmail.com> Signed-off-by: Max Inden <mail@max-inden.de>
Hello! 👋
I have a usecase that can be split into 2 separate issues (let me know and I can split it 👍), but I'll have them here for now to describe my overall usecase.
I'm creating a library with sub-systems that each manage their own
registry
, and are logically grouped together to form a rootregistry
. For each sub-system, they hold some state that is used to register/unregister metric families.For the first part of my usecase, I've tried usingsub_registry_with_prefix()
and theCollector
trait, however, they both have these limitations:Forsub_registry_with_prefix()
, since it returns a reference, I can only operate on thesub_registry
within the same scope when it's first created.For theCollector
trait, the collector struct can't be modified after it's registered.If possible, I'd like for my sub-systems to either "own" theirsub_registry
so that they can individually manage their own metrics. Perhaps something similar toFamily
, soVec<Rc<RwLock<Registry>>>
orVec<Rc<RefCell<Registry>>>
forsub_registries
?For the second part of my usecase, this is simply adding a way to unregister metric families, something like
Registry::unregister(&mut self, name: &str, unit: Option<Unit>)
?If these changes make sense to be apart of the library, I'd be happy to open a PR for these. 🐱
And sorry if what I described above is messy, I can elaborate if need be.
The text was updated successfully, but these errors were encountered: