Skip to content
This repository has been archived by the owner on May 5, 2021. It is now read-only.

Commit

Permalink
Merge pull request kubernetes#1881 from bskiba/log-add-sample
Browse files Browse the repository at this point in the history
Add logging for errors on adding samples.
  • Loading branch information
k8s-ci-robot authored Apr 11, 2019
2 parents 5a94337 + e700715 commit cf8c8a5
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions vertical-pod-autoscaler/pkg/recommender/input/cluster_feeder.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,12 @@ func (feeder *clusterStateFeeder) InitFromHistoryProvider(historyProvider histor
ContainerName: containerName}
klog.V(4).Infof("Adding %d samples for container %v", len(sampleList), containerID)
for _, sample := range sampleList {
feeder.clusterState.AddSample(
if err := feeder.clusterState.AddSample(
&model.ContainerUsageSampleWithKey{
ContainerUsageSample: sample,
Container: containerID})
Container: containerID}); err != nil {
klog.Warningf("Error adding metric sample for container %v: %v", containerID, err)
}
}
}
}
Expand Down Expand Up @@ -372,13 +374,18 @@ func (feeder *clusterStateFeeder) LoadRealTimeMetrics() {
}

sampleCount := 0
droppedSampleCount := 0
for _, containerMetrics := range containersMetrics {
for _, sample := range newContainerUsageSamplesWithKey(containerMetrics) {
feeder.clusterState.AddSample(sample)
sampleCount++
if err := feeder.clusterState.AddSample(sample); err != nil {
klog.Warningf("Error adding metric sample for container %v: %v", sample.Container, err)
droppedSampleCount++
} else {
sampleCount++
}
}
}
klog.V(3).Infof("ClusterSpec fed with #%v ContainerUsageSamples for #%v containers", sampleCount, len(containersMetrics))
klog.V(3).Infof("ClusterSpec fed with #%v ContainerUsageSamples for #%v containers. Dropped #%v samples.", sampleCount, len(containersMetrics), droppedSampleCount)

Loop:
for {
Expand Down

0 comments on commit cf8c8a5

Please sign in to comment.