-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
feat: add a text output encoding for the stats provide command #8154
Conversation
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.
I was trying to see how it behaves irl and numbers were stuck at zero:
TotalProvides: 0
AvgProvideDuration: 0s
LastReprovideDuration: 0s
LastReprovideBatchSize: 0
I thought that might be because the repo I used had English Wikipedia so a lot of blocks, so I left it for a night and same numbers in the morning. Looks like stats are not updated for some reason?
Re-tested with new repo (ipfs init
+ all ports set to 0
to avoid conflict with my other node) and found a panic after 1 minute:
$ ipfs daemon
....
Daemon is ready
panic: runtime error: integer divide by zero
goroutine 4522104 [running]:
github.com/libp2p/go-libp2p-kad-dht/fullrt.(*FullRT).bulkMessageSend.func1(0xc007bb14b0, 0xc0119c1ca0, 0x2, 0x4, 0xc007bb14a0, 0x0, 0xc0119c1b80, 0x16, 0x16, 0xc01390d7d0, ...)
pkg/mod/github.com/libp2p/[email protected]/fullrt/dht.go:981 +0x451
created by github.com/libp2p/go-libp2p-kad-dht/fullrt.(*FullRT).bulkMessageSend
pkg/mod/github.com/libp2p/[email protected]/fullrt/dht.go:977 +0x256
ipfs daemon 347.53s user 59.88s system 112% cpu 6:00.68 total
I was able to reproduce the panic after restarting the daemon, failed again, exactly after 1 minute, with:
panic: runtime error: integer divide by zero
goroutine 4450306 [running]:
github.com/libp2p/go-libp2p-kad-dht/fullrt.(*FullRT).bulkMessageSend.func1(0xc005f86240, 0xc003f68800, 0x2, 0x4, 0xc005f86220, 0x0, 0xc003f686e0, 0x16, 0x16, 0xc014aab380, ...)
pkg/mod/github.com/libp2p/[email protected]/fullrt/dht.go:981 +0x451
created by github.com/libp2p/go-libp2p-kad-dht/fullrt.(*FullRT).bulkMessageSend
pkg/mod/github.com/libp2p/[email protected]/fullrt/dht.go:977 +0x256
panic: runtime error: integer divide by zero
goroutine 4450250 [running]:
github.com/libp2p/go-libp2p-kad-dht/fullrt.(*FullRT).bulkMessageSend.func1(0xc005f86240, 0xc003f68700, 0x2, 0x14, 0xc005f86220, 0x0, 0xc003f686e0, 0x16, 0x16, 0xc014aab380, ...)
pkg/mod/github.com/libp2p/[email protected]/fullrt/dht.go:981 +0x451
created by github.com/libp2p/go-libp2p-kad-dht/fullrt.(*FullRT).bulkMessageSend
pkg/mod/github.com/libp2p/[email protected]/fullrt/dht.go:977 +0x256
panic: runtime error: integer divide by zero
goroutine 4450253 [running]:
github.com/libp2p/go-libp2p-kad-dht/fullrt.(*FullRT).bulkMessageSend.func1(0xc005f86240, 0xc003f68760, 0x2, 0xe, 0xc005f86220, 0x0, 0xc003f686e0, 0x16, 0x16, 0xc014aab380, ...)
pkg/mod/github.com/libp2p/[email protected]/fullrt/dht.go:981 +0x451
created by github.com/libp2p/go-libp2p-kad-dht/fullrt.(*FullRT).bulkMessageSend
pkg/mod/github.com/libp2p/[email protected]/fullrt/dht.go:977 +0x256
ipfs daemon 556.69s user 60.15s system 171% cpu 6:00.65 total
@lidel the panic you encountered is unrelated to this and should be resolved by libp2p/go-libp2p-kad-dht#719. I'll rebase this PR on #8156 to make this one more testable though |
64642b2
to
96f318c
Compare
@lidel can you think of a reason why we should/shouldn't have some -H or --human flag here to enable the humanized numbers? I see we do it in other commands ( |
Good question. I think it is a matter of things growing organically and not having a clear convention from the beginning. Anyway, I rounded Durations to miliseconds, it looks like this:
Perhaps we should hide "(val)" if it is the same as SI (values under 1k) |
Ya, I guess we might as well for sanity's sake. Although I'd be in favor of pushing us to a place where Text is human readable + flexible and other formats are more machine friendly.
I wouldn't quite do that, as the number of provides get larger the average duration shrinks and can drop into the single digit ms range. e.g. I recently got this log output |
6929c19
to
68ffb36
Compare
68ffb36
to
a4c4b7d
Compare
This hides "(n)" when value is same as SI, and makes SI "3k" (instead of "3 k")
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.
Given this is experimental opt-in, should be good enough.
We can refine output when/if we decide to move this outside of Experiments.
I pushed small refactor for text representation (12ebbe5):
- hides "(n)" when value is same as SI,
- removed space separator from SI notation ("3k" instead of "3 k")
TotalProvides: 35k (35,171)
AvgProvideDuration: 2.728ms
LastReprovideDuration: 1m35.952581s
LastReprovideBatchSize: 35k (35,171)
#8154 (comment) (cherry picked from commit c082c73)
#8154 (comment) (cherry picked from commit c082c73)
This adds a text output encoding to the
ipfs stats provide
command for easier glance valueIt looks something like:
It could be a little prettier, but here's a first stab so at least we have something.