From 49f6568138a0bfb2fc81702f56390e3adda0003c Mon Sep 17 00:00:00 2001 From: Alfonso Acosta Date: Fri, 19 Feb 2016 13:04:24 +0000 Subject: [PATCH] Place buffer infront of the docker stats decoder --- probe/docker/container.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/probe/docker/container.go b/probe/docker/container.go index cb89e6b193..d8f6496b47 100644 --- a/probe/docker/container.go +++ b/probe/docker/container.go @@ -203,7 +203,9 @@ func (c *container) StartGatheringStats() error { }() var stats docker.Stats - decoder := codec.NewDecoder(resp.Body, &codec.JsonHandle{}) + // Use a buffer since the codec library doesn't implicitly do it + bufReader := bufio.NewReader(resp.Body) + decoder := codec.NewDecoder(bufReader, &codec.JsonHandle{}) for err := decoder.Decode(&stats); err != io.EOF; err = decoder.Decode(&stats) { if err != nil { log.Errorf("docker container: error reading event, did container stop? %v", err)