Add initial implementation of stats
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
This commit is contained in:
parent
ce387dc505
commit
4bc322397f
9 changed files with 518 additions and 97 deletions
|
@ -230,3 +230,31 @@ var ExecCommand = cli.Command{
|
|||
}
|
||||
},
|
||||
}
|
||||
|
||||
var StatsCommand = cli.Command{
|
||||
Name: "stats",
|
||||
Usage: "get stats for running container",
|
||||
Flags: []cli.Flag{
|
||||
cli.StringFlag{
|
||||
Name: "id",
|
||||
Usage: "container id",
|
||||
},
|
||||
},
|
||||
Action: func(context *cli.Context) {
|
||||
req := &types.StatsRequest{
|
||||
Id: context.String("id"),
|
||||
}
|
||||
c := getClient()
|
||||
stream, err := c.GetStats(netcontext.Background(), req)
|
||||
if err != nil {
|
||||
fatal(err.Error(), 1)
|
||||
}
|
||||
for {
|
||||
stats, err := stream.Recv()
|
||||
if err != nil {
|
||||
fatal(err.Error(), 1)
|
||||
}
|
||||
fmt.Println(stats)
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue