Skip to content

Reject Enum labels that collide with prefixed metric names - #1226

Open
zhechen-cs wants to merge 1 commit into
prometheus:masterfrom
zhechen-cs:codex/enum-prefixed-labels
Open

zhechen-cs wants to merge 1 commit into
prometheus:masterfrom
zhechen-cs:codex/enum-prefixed-labels

Conversation

@zhechen-cs

Copy link
Copy Markdown

An Enum uses its full metric name as the state label, but the overlap check only checks the unprefixed name. For example, Enum('state', ..., namespace='app', labelnames=['app_state'], states=['running', 'stopped']) accepts the conflicting label and silently overwrites its values. Two children then expose duplicate time series with conflicting values.

Check the fully constructed name before registration, retaining the existing unprefixed-name check. Added regressions for namespace, subsystem, and their combination, including registry reuse after failure and valid labeled children. All three collision cases fail on the unmodified base.

Validation on macOS / Python 3.12:

  • Full suite: 442 passed, 1 skipped, 31 subtests passed.
  • tox -e flake8,isort,mypy and git diff --check: passed.

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