-
Notifications
You must be signed in to change notification settings - Fork 919
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
fix(nodebuilder/host): Ensure libp2p metrics are collected to prometheus #3753
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3753 +/- ##
==========================================
+ Coverage 44.83% 45.69% +0.85%
==========================================
Files 265 281 +16
Lines 14620 16066 +1446
==========================================
+ Hits 6555 7341 +786
- Misses 7313 7885 +572
- Partials 752 840 +88 ☔ View full report in Codecov by Sentry. |
// Set the default global registerer to the wrapped one with labels. This way all the metrics | ||
// registered with the default registerer will be labeled with the provided labels. It is important | ||
// because unlike libp2p metrics, bitswap metrics are registered with the default global registerer. | ||
prometheus.DefaultRegisterer = wrapped |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren't bitswap metrics registered on init causing this overwrite being unaffectual?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, right now it can get racy. Need to ensure order of init:
- update global
- inject bitswap Registrer
- start bitswap
This PR fixes the bug of prometheus registry not being provided to libp2p constructor as well as few additional improvements of adjustment code:
enableMetrics
. It will enable usage of prometheus based metrics, while p2p metrics are disabled