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 #1790 from piosz/more-debug
Browse files Browse the repository at this point in the history
Ignore duplicated stats for containers
  • Loading branch information
piosz authored Aug 30, 2017
2 parents d7df1c0 + 64aabde commit ae12a18
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ ifndef TEMP_DIR
TEMP_DIR:=$(shell mktemp -d /tmp/heapster.XXXXXX)
endif

VERSION?=v1.4.1
VERSION?=v1.4.2
GIT_COMMIT:=$(shell git rev-parse --short HEAD)

TESTUSER=
Expand Down
14 changes: 2 additions & 12 deletions metrics/sources/summary/summary.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,27 +197,17 @@ func (this *summaryMetricsSource) decodePodStats(metrics map[string]*MetricSet,
// This check ensures that we are not replacing metrics of running container with metrics of terminated one if
// there are two exactly same containers reported by kubelet.
if _, exist := metrics[key]; exist {
glog.V(8).Infof("Metrics reported from two containers with the same key: %v. Create time of "+
glog.V(2).Infof("Metrics reported from two containers with the same key: %v. Create time of "+
"containers are %v and %v. Metrics from the older container are going to be dropped.", key,
container.StartTime.Time, metrics[key].CreateTime)
if containerIsTerminated(&container, metrics[key].CreateTime) {
if container.StartTime.Time.Before(metrics[key].CreateTime) {
continue
}
}
metrics[key] = this.decodeContainerStats(podMetrics.Labels, &container, false)
}
}

func containerIsTerminated(container *stats.ContainerStats, otherStartTime time.Time) bool {
if container.StartTime.Time.Before(otherStartTime) {
if *container.CPU.UsageNanoCores == 0 && *container.Memory.UsageBytes == 0 {
return true
}
glog.Warningf("Two identical containers are reported and the older one is not terminated: %v", container)
}
return false
}

func (this *summaryMetricsSource) decodeContainerStats(podLabels map[string]string, container *stats.ContainerStats, isSystemContainer bool) *MetricSet {
glog.V(9).Infof("Decoding container stats stats for container %s...", container.Name)
containerMetrics := &MetricSet{
Expand Down

0 comments on commit ae12a18

Please # to comment.