diff options
Diffstat (limited to 'pkg/api')
-rw-r--r-- | pkg/api/handlers/generic/containers_stats.go | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/pkg/api/handlers/generic/containers_stats.go b/pkg/api/handlers/generic/containers_stats.go index 538fc6f21..eb9cfca4a 100644 --- a/pkg/api/handlers/generic/containers_stats.go +++ b/pkg/api/handlers/generic/containers_stats.go @@ -81,19 +81,44 @@ func StatsContainer(w http.ResponseWriter, r *http.Request) { time.Sleep(DefaultStatsPeriod) } - cgroupPath, _ := ctnr.CGroupPath() - cgroup, _ := cgroups.Load(cgroupPath) + cgroupPath, err := ctnr.CGroupPath() + if err != nil { + utils.InternalServerError(w, err) + return + } + + cgroup, err := cgroups.Load(cgroupPath) + if err != nil { + utils.InternalServerError(w, err) + return + } for ok := true; ok; ok = query.Stream { - state, _ := ctnr.State() + state, err := ctnr.State() + if err != nil { + utils.InternalServerError(w, err) + return + } if state != define.ContainerStateRunning { time.Sleep(10 * time.Second) continue } - stats, _ := ctnr.GetContainerStats(stats) - cgroupStat, _ := cgroup.Stat() - inspect, _ := ctnr.Inspect(false) + stats, err := ctnr.GetContainerStats(stats) + if err != nil { + utils.InternalServerError(w, err) + return + } + cgroupStat, err := cgroup.Stat() + if err != nil { + utils.InternalServerError(w, err) + return + } + inspect, err := ctnr.Inspect(false) + if err != nil { + utils.InternalServerError(w, err) + return + } net := make(map[string]docker.NetworkStats) net[inspect.NetworkSettings.EndpointID] = docker.NetworkStats{ |