Fixing some nits.
Docker-DCO-1.1-Signed-off-by: Vishnu Kannan <vishnuk@google.com> (github: vishh)
This commit is contained in:
parent
3e5fe45417
commit
813d247bc7
2
api.go
2
api.go
|
@ -6,7 +6,7 @@ import (
|
|||
)
|
||||
|
||||
// Returns all available stats for the given container.
|
||||
func GetContainerStats(container *Config, state *State) (*ContainerStats, error) {
|
||||
func GetStats(container *Config, state *State) (*ContainerStats, error) {
|
||||
var containerStats ContainerStats
|
||||
stats, err := fs.GetStats(container.Cgroups)
|
||||
if err != nil {
|
||||
|
|
|
@ -30,14 +30,16 @@ func GetStats(networkState *NetworkState) (NetworkStats, error) {
|
|||
return NetworkStats{}, err
|
||||
}
|
||||
|
||||
return NetworkStats{RxBytes: data["rx_bytes"],
|
||||
return NetworkStats{
|
||||
RxBytes: data["rx_bytes"],
|
||||
RxPackets: data["rx_packets"],
|
||||
RxErrors: data["rx_errors"],
|
||||
RxDropped: data["rx_dropped"],
|
||||
TxBytes: data["tx_bytes"],
|
||||
TxPackets: data["tx_packets"],
|
||||
TxErrors: data["tx_errors"],
|
||||
TxDropped: data["tx_dropped"]}, nil
|
||||
TxDropped: data["tx_dropped"],
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Reads all the statistics available under /sys/class/net/<EthInterface>/statistics as a map with file name as key and data as integers.
|
||||
|
|
|
@ -26,7 +26,7 @@ func statsAction(context *cli.Context) {
|
|||
log.Fatal(err)
|
||||
}
|
||||
|
||||
stats, err := getContainerStats(container, runtimeCkpt)
|
||||
stats, err := getStats(container, runtimeCkpt)
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to get stats - %v\n", err)
|
||||
}
|
||||
|
@ -35,8 +35,8 @@ func statsAction(context *cli.Context) {
|
|||
}
|
||||
|
||||
// returns the container stats in json format.
|
||||
func getContainerStats(container *libcontainer.Config, state *libcontainer.State) (string, error) {
|
||||
stats, err := libcontainer.GetContainerStats(container, state)
|
||||
func getStats(container *libcontainer.Config, state *libcontainer.State) (string, error) {
|
||||
stats, err := libcontainer.GetStats(container, state)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue