Skip to content

Commit

Permalink
[metricbeat] added CPU usage check to docker memory stats (elastic#12062
Browse files Browse the repository at this point in the history
)
  • Loading branch information
fearful-symmetry authored and ph committed May 21, 2019
1 parent cffe6fe commit 29f5ba7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions metricbeat/module/docker/memory/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ func (s *MemoryService) getMemoryStatsList(containers []docker.Stat, dedot bool)
for _, containerStats := range containers {
//There appears to be a race where a container will report with a stat object before it actually starts
//during this time, there doesn't appear to be any meaningful data,
// and Limit will never be 0 unless the container is not running & there's no cgroup data
if containerStats.Stats.MemoryStats.Limit == 0 {
// and Limit will never be 0 unless the container is not running
//and there's no cgroup data, and CPU usage should be greater than 0 for any running container.
if containerStats.Stats.MemoryStats.Limit == 0 && containerStats.Stats.PreCPUStats.CPUUsage.TotalUsage == 0 {
continue
}
formattedStats = append(formattedStats, s.getMemoryStats(containerStats, dedot))
Expand Down

0 comments on commit 29f5ba7

Please sign in to comment.