-
Notifications
You must be signed in to change notification settings - Fork 18.7k
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
Add format to stats #24987
Add format to stats #24987
Conversation
BlockRead float64 | ||
BlockWrite float64 | ||
PidsCurrent uint64 | ||
Mu sync.Mutex |
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 think engine-api/types
should not have mutex
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 can do that. I can embed ContainerStats in another struct which gives the ability to do mutex lock.
I will also move the changes I have done in engine-api into its repo.
Right now, I just want to show all the changes I made.
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.
Agree with @AkihiroSuda
BTW, it seems like that all the failed builds aren't related to this commit. |
Test failures are related, |
@dnephin thanks for noticing. I'll fix it + rebase and push the changes soon. |
I wonder what went wrong this time 😞 |
@ripcurld00d I restarted CI just to be sure it's not a one-time issue |
@thaJeztah thanks. |
@thaJeztah now different failures. BTW, should I create a new PR to docker/engine-api (this commit consists changes in vendor)? |
@ripcurld00d you can make the PR now, or wait until we're in code review. I added the "needs-vendoring" label to let others know |
We're ok with this; moving to code review! |
BlockWrite float64 | ||
PidsCurrent uint64 | ||
Mu sync.Mutex | ||
Err error |
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.
same for Err
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 sure we should move these to engine-api just to get formatting on the client.
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.
@cpuguy83 if we keep the types.ContainerStats
in the container
package then we will get an import cycle error:
import cycle not allowed
package github.com/docker/docker/cmd/docker
imports github.com/docker/docker/cli/cobraadaptor
imports github.com/docker/docker/api/client/container
imports github.com/docker/docker/api/client/formatter
imports github.com/docker/docker/api/client/container
Anyway, to avoid this cycle, that structure should be moved to another package. engine-api's type seems like a good place.
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.
Move to formatter? This isn't really an API type, I don't think it belongs in engine-api.
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.
OK, sounds like a better place.
Commit was updated. |
ummm... any feedback? |
It's sad that |
@vdemeester, I agree! Nevertheless, it should be done in a different PR. BTW, should I open a proposal first? |
@ripcurld00d yes, I'm more than ok for it to be in a separate PR, and you definitely can work on it yes 😉 |
@thaJeztah rebased:
|
@ripcurld00d triggered a rebuild for CI @vdemeester does the current implementation LGTY (if the other issue is handled in a different PR)? |
Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com>
Rebased (2) successfully 😰 |
ping 😊 |
LGTM |
Looks like this went in without documentation changes opened #26779 for tracking that. @ripcurld00d can you do a follow up to update the documentation? |
and ping @albers @sdurrheimer for the completion scripts ❤️ |
looks like my comment went un-noticed as well :) |
|
||
// ContainerStats represents the containers statistics data. | ||
type ContainerStats struct { | ||
Mu sync.RWMutex |
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.
Mu? :) how about Mutex
?
BTW, exposing the mutex seems weird to me, I expected what needs to be done outside of this package was abstracted here so that the mutex is just an internal property of this struct. Exposing it, uhm, doesn't sound good. Maybe locking up in the call stack instead? /cc @cpuguy83 wdyt
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.
agreed
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.
@ripcurld00d @vdemeester I'd love to have this taken care of :(
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.
@runcom I was about to suggest myself but I don't mind you fixing this.
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.
@runcom I was about to suggest myself but I don't mind you fixing this.
yeah, I'll try to find some time so feel free to go ahead and take a stab at this...
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.
@ripcurld00d you can go ahead, @runcom suggested we should take care of it, not that he would like to take care of it. It's all yours @ripcurld00d 😉
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.
@runcom @vdemeester -- thanks. I would love to finish what I have started :)
I'm a bit disappointed that It has always been bothering me that the first column of How about adding |
@albers, this patch supposes to add format to the stats command. The next part, which I would like to work on, is adding container names to the stats. |
@ripcurld00d That's great news! Thanks. |
@ripcurld00d oh, that means #20973 should probably not be closed if this doesn't support |
@thaJeztah that's right. |
docs were addressed in #26892 |
Add format to stats
- What I did
I attempted to use the formatter API to display docker stats.
closes #20973
- How I did it
- How to verify it
docker stats --format "{{.PIDs}}"