Skip to content

Commit

Permalink
check for length of perusage for stat gathering and removed not used …
Browse files Browse the repository at this point in the history
…function (influxdata#9009)
  • Loading branch information
Aladex authored Mar 22, 2021
1 parent 74a1acd commit dc8e4ef
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion plugins/inputs/docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ func parseContainerStats(
acc.AddFields("docker_container_cpu", cpufields, cputags, tm)
}

if choice.Contains("cpu", perDeviceInclude) {
if choice.Contains("cpu", perDeviceInclude) && len(stat.CPUStats.CPUUsage.PercpuUsage) > 0 {
// If we have OnlineCPUs field, then use it to restrict stats gathering to only Online CPUs
// (https://github.com/moby/moby/commit/115f91d7575d6de6c7781a96a082f144fd17e400)
var percpuusage []uint64
Expand Down

0 comments on commit dc8e4ef

Please sign in to comment.