Repository navigation
fix: preserve existing exposition names after registration failures - #2668
Open
yangjj-iso wants to merge 1 commit into
Open
yangjj-iso wants to merge 1 commit into
yangjj-iso wants to merge 1 commit into
Conversation
Roll back only names acquired by the current registration attempt. Keep claims and rollback within the existing per-name registry compute operation to protect concurrent registrations and unregistration. Fixes prometheus#2667 Signed-off-by: redyyang <3202137046@qq.com>
yangjj-iso
requested review from
dhoard,
fstab,
jaydeluca and
zeitlinger
as code owners
November 7, 2026 14:46
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2667.
After a counter
eventsis registered, rejecting a duplicate registration currently removes the first collector'sevents_total/events_createdreservations. A gauge namedevents_totalcan then be registered despite the original counter still being present.Track only exposition names newly claimed by the current attempt and release only those names on either claim or registration-validation failure. Keep claiming, validation, and rollback inside the existing per-name
registered.compute()operation, consistent with unregistration, so concurrent registrations of the same name cannot reuse a claim that another attempt then rolls back. No public API or global lock is added.Add five regression tests covering duplicate label schemas, conflicting metadata, conflicting types, partial exposition-name conflicts, and failed MultiCollector registration. They also verify that temporary claims are released and normal unregistration still frees the existing names.
Validation:
./mvnw -pl prometheus-metrics-model -am test -Dcoverage.skip=truepassed on Java 25 with default Error Prone/NullAway: 328 tests (model 266, config 62), zero failures/errors/skips.mise run --skip-tools lint:fixpassed after applying its formatting changes.mise run --skip-tools buildpassed on Java 25 across all 56 modules, with-DskipITsappended toMAVEN_ARGSbecause Docker is unavailable. No build configuration was changed; this task skips unit test execution, so the 328 tests above were run separately.git diff --checkand independent review passed. Full test, Docker integration, and native test suites were not run locally.AI assistance was used to investigate, implement, and test this change.
@fstab