-
Notifications
You must be signed in to change notification settings - Fork 617
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
setup stats command #73
Conversation
Thanks for working on this, but needs cleaning up the code, squashing the commits, and rebasing with the master. |
@fahedouch Are you still planning to work on this? |
@AkihiroSuda yes, if you see if it's a priority I can prioritize it over other tasks |
This enhancement is pending for quite a while. Would this PR be accepted anytime soon ? @fahedouch @AkihiroSuda |
@nehaldattani i will revisit this PR by the end of the week ;) |
9371e08
to
e89233b
Compare
9749704
to
1a99994
Compare
cmd/nerdctl/stats_linux.go
Outdated
} | ||
|
||
if showAll { | ||
// TODO: watches for container creation and removal (dynamic stats) |
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.
Could you add this limitation to the --help
text and README.md
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.
And open an issue ticket
CI failing for Windows and FreeBSD |
c3ebdcc
to
372fbf4
Compare
@AkihiroSuda I added the support for dynamic container creation/deletion. I will fix the CI error this night or tomorrow. Sorry for the delay I am traveling abroad. |
0b149e4
to
fb54465
Compare
pkg/eventutil/eventutil.go
Outdated
func (w *eventHandler) Watch(c <-chan *events.Envelope) { | ||
for e := range c { | ||
w.mu.Lock() | ||
fmt.Println(e.Topic) |
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.
remove
Thanks, but creation doesn't seem handled yet |
mem = calculateCgroup2MemUsage(metrics) | ||
memLimit = float64(metrics.Memory.UsageLimit) | ||
memPercent = calculateMemPercent(memLimit, mem) | ||
pidsStatsCurrent = metrics.Pids.Current |
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.
NetworkTx/Rx missing?
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.
@AkihiroSuda it seems that network is not supported by cgroupv2 https://pkg.go.dev/github.com/containerd/[email protected]/v2/stats#Metrics
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.
But docker stats
work with cgroup v2.
We can revisit this in another PR.
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.
@AkihiroSuda I'm assuming that docker
doesn't consume the cgroup api from containerd https://github.com/containerd/cgroups.
do you think it is a lack in the containerd cgroup api and that I have to open a ticket at https://github.com/containerd/cgroups
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.
docker scans the stats from netlink, not from cgroups
https://github.com/moby/libnetwork/blob/64b7a4574d1426139437d20e81c0b6d391130ec8/osl/interface_linux.go#L179-L203
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.
@AkihiroSuda thank you for checking this I will fix it.
@AkihiroSuda creation is handled only with |
Can we watch creation events by default? |
84c44d2
to
de74599
Compare
Signed-off-by: fahed dorgaa <[email protected]>
de74599
to
3295435
Compare
fixed @AkihiroSuda |
Display a live stream of container(s) resource usage statistics. | ||
|
||
|
||
Usage: `nerdctl stats [flags]` |
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.
Next time please add flags
too
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
Signed-off-by: fahed dorgaa [email protected]