Skip to content

Commit

Permalink
Merge pull request #989 from weaveworks/812-docker-stats-perf
Browse files Browse the repository at this point in the history
Improve performance of docker stats obtention
  • Loading branch information
Alfonso Acosta committed Feb 19, 2016
2 parents 0402f6d + 49f6568 commit d744278
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion probe/docker/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit d744278

Please sign in to comment.