Skip to content
This repository has been archived by the owner on Dec 1, 2018. It is now read-only.

Commit

Permalink
Merge pull request #1807 from piosz/mem-fix
Browse files Browse the repository at this point in the history
Use RSS instead of Usage when filtering out terminated containers
  • Loading branch information
piosz authored Sep 13, 2017
2 parents c079c2a + ed41324 commit 0b96b6a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion metrics/sources/summary/summary.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ func (this *summaryMetricsSource) decodePodStats(metrics map[string]*MetricSet,

func containerIsTerminated(container *stats.ContainerStats, otherStartTime time.Time) bool {
if container.StartTime.Time.Before(otherStartTime) {
if *container.CPU.UsageNanoCores == 0 && *container.Memory.UsageBytes == 0 {
if *container.CPU.UsageNanoCores == 0 && *container.Memory.RSSBytes == 0 {
return true
}
glog.Warningf("Two identical containers are reported and the older one is not terminated: %v", container)
Expand Down
4 changes: 2 additions & 2 deletions metrics/sources/summary/summary_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,9 +338,9 @@ func genTestSummaryCPU(seed int) *stats.CPUStats {
func genTestSummaryZeroMemory(seed int) *stats.MemoryStats {
return &stats.MemoryStats{
Time: metav1.NewTime(scrapeTime),
UsageBytes: uint64Val(seed, -seed),
UsageBytes: uint64Val(seed, offsetMemUsageBytes),
WorkingSetBytes: uint64Val(seed, offsetMemWorkingSetBytes),
RSSBytes: uint64Val(seed, offsetMemRSSBytes),
RSSBytes: uint64Val(seed, -seed),
PageFaults: uint64Val(seed, offsetMemPageFaults),
MajorPageFaults: uint64Val(seed, offsetMemMajorPageFaults),
}
Expand Down

0 comments on commit 0b96b6a

Please sign in to comment.