Fix crash in Docker input plugin - Fixes #1195
Commit fixes crash in Docker input plugin caused by the fact that return value might be nil when error occurs. closes #1195
This commit is contained in:
parent
08ecfb8a67
commit
39df2635bd
|
@ -6,6 +6,8 @@
|
||||||
|
|
||||||
### Bugfixes
|
### Bugfixes
|
||||||
|
|
||||||
|
- [#1195](https://github.com/influxdata/telegraf/pull/1195): Docker panic on timeout. Thanks @zstyblik!
|
||||||
|
|
||||||
## v0.13 [2016-05-11]
|
## v0.13 [2016-05-11]
|
||||||
|
|
||||||
### Release Notes
|
### Release Notes
|
||||||
|
|
|
@ -221,7 +221,7 @@ func (d *Docker) gatherContainer(
|
||||||
defer cancel()
|
defer cancel()
|
||||||
r, err := d.client.ContainerStats(ctx, container.ID, false)
|
r, err := d.client.ContainerStats(ctx, container.ID, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Error getting docker stats: %s\n", err.Error())
|
return fmt.Errorf("Error getting docker stats: %s", err.Error())
|
||||||
}
|
}
|
||||||
defer r.Close()
|
defer r.Close()
|
||||||
dec := json.NewDecoder(r)
|
dec := json.NewDecoder(r)
|
||||||
|
|
Loading…
Reference in New Issue