Skip to content

receive: Fix duplicate metric registration panic on hashring reload#313

Open
yuchen-db wants to merge 7 commits intodb_mainfrom
yuchen-db/fix-reg
Open

receive: Fix duplicate metric registration panic on hashring reload#313
yuchen-db wants to merge 7 commits intodb_mainfrom
yuchen-db/fix-reg

Conversation

@yuchen-db
Copy link
Collaborator

Hoist numShardsGauge creation out of NewMultiHashring into setupHashring so it is registered once and reused across config reloads, preventing a MustRegister panic when the same metric name is re-registered.

  • I added CHANGELOG entry for this change.
  • Change is not relevant to the end user.

Changes

Verification

yuchen-db and others added 5 commits March 3, 2026 15:14
Hoist numShardsGauge creation out of NewMultiHashring into setupHashring
so it is registered once and reused across config reloads, preventing a
MustRegister panic when the same metric name is re-registered.

Co-authored-by: Isaac
@yuchen-db yuchen-db requested review from mkusumdb and willh-db March 14, 2026 01:03
…ller

Follow the same register/unregister pattern used by shuffleShardCacheMetrics:
store the gauge on multiHashring, unregister it in Close(). This keeps
the metric lifecycle internal to hashring.go and avoids changing the
public NewMultiHashring signature.

Co-authored-by: Isaac
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.

2 participants