Commit 69ea6fa
committed
Remove nameless collectors from the registry on unregister
When a collector is registered under support_collectors_without_names
with no metric names, register() appends it to _collectors_without_names
in addition to the usual bookkeeping. unregister() only cleaned up
_collector_to_names and _names_to_collectors, so the collector stayed in
_collectors_without_names and kept being collected.
A normal collect() no longer returned the collector's metrics, but
RestrictedRegistry.collect() -- which seeds its collector set from
_collectors_without_names -- still did, so an unregistered collector's
samples reappeared under restricted_registry(). unregister() now also
drops the collector from that list.
Add test_unregister_removes_no_names_collector, asserting a nameless
collector is no longer collected by a restricted registry after it has
been unregistered.
Signed-off-by: Sean Kim <skim8705@gmail.com>1 parent a96f6f4 commit 69ea6fa
2 files changed
Lines changed: 17 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
| 65 | + | |
64 | 66 | | |
65 | 67 | | |
66 | 68 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
960 | 960 | | |
961 | 961 | | |
962 | 962 | | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
963 | 978 | | |
964 | 979 | | |
965 | 980 | | |
| |||
0 commit comments