Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

corehttp/metrics.go: ERROR with more than one RPC API listener #9397

Open
Tracked by #10000
lidel opened this issue Nov 10, 2022 · 1 comment
Open
Tracked by #10000

corehttp/metrics.go: ERROR with more than one RPC API listener #9397

lidel opened this issue Nov 10, 2022 · 1 comment
Labels
kind/bug A bug in existing code (including security flaws) need/triage Needs initial labeling and prioritization

Comments

@lidel
Copy link
Member

lidel commented Nov 10, 2022

Version

0.17.0-rc1

Config

> ipfs config --json Addresses.API                                                                                                      
[
  "/ip4/127.0.0.1/tcp/5001",
  "/ip6/::1/tcp/5001"
]

Description

Daemon is ready
2022-11-10T22:46:26.286Z	ERROR	core/server	corehttp/metrics.go:64	OC default registry ERROR	{"error": "cannot register the collector: duplicate metrics collector registration attempted"}

A potential fix would be to detect that metrics are already registered, and reuse the existing instance.

@lidel lidel added kind/bug A bug in existing code (including security flaws) need/triage Needs initial labeling and prioritization labels Nov 10, 2022
@forgondolin
Copy link

Also happening on 0.18

gammazero added a commit that referenced this issue Aug 21, 2024
When there are multiple listeners configured for Addresses.API, serving metrics results in an errors: "<metric> was collected before with the same name and label values".

This PR fixes this by maintaining a global map of metrics handlers, and only creating and reginstering them once. The same metrics handlers are provided to the mux for every listener.

Fixes #9891
Fixes #9397

Unblocks #9637
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug A bug in existing code (including security flaws) need/triage Needs initial labeling and prioritization
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants