stats: log errors instead of sending 500

As 200 is already out the door, we cannot send 500s anymore.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
This commit is contained in:
Valentin Rothberg 2020-09-21 09:45:19 +02:00
parent ae0e4dfd75
commit 3fdb83a2ee
1 changed files with 6 additions and 6 deletions

View File

@ -95,28 +95,28 @@ streamLabel: // A label to flatten the scope
// Container stats // Container stats
stats, err := ctnr.GetContainerStats(stats) stats, err := ctnr.GetContainerStats(stats)
if err != nil { if err != nil {
utils.InternalServerError(w, err) logrus.Errorf("Unable to get container stats: %v", err)
return return
} }
inspect, err := ctnr.Inspect(false) inspect, err := ctnr.Inspect(false)
if err != nil { if err != nil {
utils.InternalServerError(w, err) logrus.Errorf("Unable to inspect container: %v", err)
return return
} }
// Cgroup stats // Cgroup stats
cgroupPath, err := ctnr.CGroupPath() cgroupPath, err := ctnr.CGroupPath()
if err != nil { if err != nil {
utils.InternalServerError(w, err) logrus.Errorf("Unable to get cgroup path of container: %v", err)
return return
} }
cgroup, err := cgroups.Load(cgroupPath) cgroup, err := cgroups.Load(cgroupPath)
if err != nil { if err != nil {
utils.InternalServerError(w, err) logrus.Errorf("Unable to load cgroup: %v", err)
return return
} }
cgroupStat, err := cgroup.Stat() cgroupStat, err := cgroup.Stat()
if err != nil { if err != nil {
utils.InternalServerError(w, err) logrus.Errorf("Unable to get cgroup stats: %v", err)
return return
} }
@ -192,7 +192,7 @@ streamLabel: // A label to flatten the scope
} }
if err := coder.Encode(s); err != nil { if err := coder.Encode(s); err != nil {
utils.InternalServerError(w, err) logrus.Errorf("Unable to encode stats: %v", err)
return return
} }
if flusher, ok := w.(http.Flusher); ok { if flusher, ok := w.(http.Flusher); ok {