-
Notifications
You must be signed in to change notification settings - Fork 11
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
Can we make sweeper struct customizable? #23
Comments
Of course! Even better if you discuss the design here first before opening the PR.
How would making the sweeper allow you to collect more stats? |
As far as I understand, the only method of a |
Could you give a specific example of how you'd like to customize it? I'm guessing the best way to go about this will be to let the |
My idea is to move update logic from sweeper to meter, so meter interface would look like that type MeterInterface interface {
Update(timeDifference time.Duration)
IsIdle() bool
SetIdle()
SetActive()
// The rest of Meter methods...
} There methods for i, m := range sw.meters[:sw.activeMeters] {
m.Update(tdiff)
if m.IsIdle() {
sw.meters[i] = nil
}
} |
Maybe that'll work, but we'd want to make the sweeper an interface, not the meter. But my question is: what kinds of changes do you want to make? Without that, there's no way to know what the correct solution is. |
I've proposed changes because I want to be able to calculate user defined statistics (e.g. maximum rate) |
Hi everyone,
Thanks for the awesome library! I've been playing with it for the purpose of tracking bandwidth in my libp2p-based project, it works like a charm and was very easy to modify the code. However, I found that it is difficult to customize how metrics are calculated without manually changing the source code. It would be really nice if we could gather extra statistics for libp2p by defining an interface or callbacks or similar.
I'd really appreciate if you let me modify go-flow-metrics to make it easier to modify Sweeper behavior, by making it into an interface. Or, if you know a better option to achieve this, i'd be happy to implement that as well. Naturally, this will not break compatibility with the rest of libp2p ecosystem.
Would it be okay if i open a pull-request — and hopefully merge it to make go-flow-metrics more flexible by default? Or is this project developed only by libp2p staff?
The text was updated successfully, but these errors were encountered: