-
Notifications
You must be signed in to change notification settings - Fork 18
feat: Add Ping command to monitor workspace latency #409
Conversation
internal/cmd/ping.go
Outdated
return err | ||
} | ||
|
||
fmt.Printf("%.2fms (%s) seq=%d\n", |
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.
not needed for an MVP, of course, but would be nice if this printed stats when the user quit, like the actual ping command:
$ ping -c 3 google.com
PING google.com(sfo03s24-in-x0e.1e100.net (2607:f8b0:4005:80c::200e)) 56 data bytes
64 bytes from sfo03s24-in-x0e.1e100.net (2607:f8b0:4005:80c::200e): icmp_seq=1 ttl=118 time=10.8 ms
64 bytes from sfo03s24-in-x0e.1e100.net (2607:f8b0:4005:80c::200e): icmp_seq=2 ttl=118 time=10.3 ms
64 bytes from sfo03s24-in-x0e.1e100.net (2607:f8b0:4005:80c::200e): icmp_seq=3 ttl=118 time=11.2 ms
--- google.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 10.329/10.785/11.239/0.371 ms
also, what happens if we lose a ping response? this seems to assume the ping packets always come back, but that seems difficult to guarantee in general on a lossy network?
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 believe the Ping
func would return an error and we'd exit... I'll check.
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.
Fixed in the latest iteration. Just like ping, failures will display inline.
We don't have stats yet, but that can be added later on!
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.
just really minor comments, I suggest just merging & we can iterate later if needed 🎉
[ch13708]