Skip to content

Avoid retaining nameless collectors after repeated registration - #1224

Open
zhechen-cs wants to merge 1 commit into
prometheus:masterfrom
zhechen-cs:codex/nameless-reregistration
Open

zhechen-cs wants to merge 1 commit into
prometheus:masterfrom
zhechen-cs:codex/nameless-reregistration

Conversation

@zhechen-cs

Copy link
Copy Markdown

With support_collectors_without_names=True, registering the same collector twice adds two entries to _collectors_without_names, while the main registry stores it only once. After unregister(), normal collection is empty but restricted_registry() still calls the collector and exposes its stale metrics.

Keep the auxiliary list unique on registration. The regression covers repeated registration, normal and restricted collection, unregistering, and registering the collector again. This covers a remaining case after #1191, which fixed unregistering a collector registered once.

Validation: the regression fails on the unmodified base. After the fix, 429 tests pass and 14 are skipped; the configured flake8, isort and mypy checks pass. Local HTTP tests used NO_PROXY=localhost,127.0.0.1,::1 to bypass the local proxy.

@csmarchbanks

Signed-off-by: Zhe Chen <zhechen.cs@connect.hku.hk>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant