Replies: 1 comment
-
Any updates on this? If it's a bug (not recalculating the ID), I can issue a fix, but I did not want to attempt that unless it's confirmed... |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am writing a custom exporter with collectors discovering and adding new metrics based on response from the server. Up until now, we were simply sending a single request when the exporter starts up and based on the response we were adding metrics and then registering collectors. However, we have a use case where not all metrics we may want to track are available when the exporter first starts, so I would like to be able to add new metrics to the collector during scrape (basically in
Collect()
).Simply creating e.g.
NewGaugeVec()
with config for the new metric seems to work, but there is a problem when I try to unregister the collector - since I added new metrics and those are exposed in myDescribe()
implementation, thecollectorID
calculated infunc (r *Registry) Unregister(c Collector) bool
will be different from the one calculated when first registering the collector. Because of that, the collector is never removed from collectors map inRegistry
(https://github.com/prometheus/client_golang/blob/main/prometheus/registry.go#L383).Is my approach to the problem even valid? If so, do you have any suggestions how this problem can be solved?
Beta Was this translation helpful? Give feedback.
All reactions