Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added CPU usage check to memory stats list #12062

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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