Uh oh!
There was an error while loading. Please reload this page.
Support MultiProcessCollector in RestrictedRegistry. - #1150
Conversation
mathias-kende
commented
Nov 27, 2025
@csmarchbanks do you know if you will be able to review this? If you agree with the idea but would prefer a different implementation, I’m happy to rewrite that differently. |
csmarchbanks
commented
Nov 28, 2025
Hello! I am out of town for another week but will review this after I return. In the meantime it looks like the DCO check is failing. |
This change makes it so that the RestrictedRegistry will always attempt to collect metrics from a collector for which it couldn’t find any metrics name. Although this can be used generally, this is meant to be used with MultiProcessCollector. This changes the current behavior of the code but should be somehow safe as it enables filtering in case where it was not working previously. If this is an issue, an alternative approach with an explicit flag could be used (set either in the MultiProcessCollector or in the registry). The intent here is to allow collecting a subset of metrics from production fastapi servers (running in multiprocess mode). So not having to change the library usage in these servers is advantageous to have filtering work out-of-the-box with this change. Signed-off-by: Mathias Kende <mathias.kende@mistral.ai>
ba49b92 to
792e478Compare
csmarchbanks
left a comment
There was a problem hiding this comment.
Giving this some more thought I think it would be good to have an opt in for this feature. If any existing users have registries without names that suddenly started having .collect() called on them that could introduce significant performance issues. Just an optional argument about supporting collectors without names to __init__ would be good enough I think.
a94acbe to
b401adeCompareThis adds a parameters to the constructor of CollectorRegistry to allow that new behavior rather than make it be the default. Signed-off-by: Mathias Kende <mathias.kende@mistral.ai>
b401ade to
d284cbeComparemathias-kende
commented
Dec 31, 2025
Thanks, I added the explicit flag. Please take another look. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Signed-off-by: Mathias Kende <mathias.kende@mistral.ai>
mathias-kende
commented
Feb 18, 2026
Thanks, please take another look. |
Uh oh!
There was an error while loading. Please reload this page.
mathias-kende
commented
Mar 19, 2026
Thanks for the review @csmarchbanks! Would you be so kind as to cut a new release with this? |
This change makes it so that the RestrictedRegistry will always attempt to collect metrics from a collector for which it couldn’t find any metrics name. This is meant to be used with MultiProcessCollector (but there is no strong reason to limit it to that one).
This changes the current behavior of the code but should be somehow safe as it enables filtering in case where it was not working previously. If this is an issue, an alternative approach with an explicit flag could be used (set either in the MultiProcessCollector or in the registry itself).
The intent here is to allow collecting a subset of metrics from production fastapi servers (running in multiprocess mode). So not having to change the library usage in these servers is advantageous to have filtering work out-of-the-box with this change.
@csmarchbanks let me know what you think.
Thanks