-
Notifications
You must be signed in to change notification settings - Fork 149
feat(provider): reprovide metrics #944
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
Conversation
provider/reprovider.go
Outdated
| provideCounter: metrics.New("ipfs.boxo.provider.provideCount", "Number of provides since node is running").Counter(), | ||
| reprovideCounter: metrics.New("ipfs.boxo.provider.reprovideCount", "Number of reprovides since node is running").Counter(), |
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.
Regarding the metric name... I believe all metrics in boxo use metrics.NewCtx and figure out their metric prefix from a context.
In HTTP I hardcoded that prefix though, which probably wasn't intelligent:
boxo/bitswap/network/httpnet/metrics.go
Line 75 in 6793986
| ctx := imetrics.CtxScope(context.Background(), "exchange_httpnet") |
If you can get a context, then it doesn't hurt using it. And otherwise, the metric name would, based on prior art, be provider_provide_count and reprovider_reprovide_count.
(I think, I'm not very sure about this. I am more sure that the ipfs.boxo prefix is probably not part of any existing metric).
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.
Thanks for the heads up. I got confused with the doc.
I followed the same approach as you did in
boxo/bitswap/network/httpnet/metrics.go
Line 75 in 6793986
| ctx := imetrics.CtxScope(context.Background(), "exchange_httpnet") |
Adding two metric counters: