mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 14:07:14 +00:00
Merge pull request #21370 from gmarek/gather
Fix bug in resource gatherer and add logging to help debug if it doesn't help
This commit is contained in:
commit
041d6bc775
@ -87,10 +87,12 @@ func (g *containerResourceGatherer) startGatheringData(c *client.Client, period
|
|||||||
now := time.Now()
|
now := time.Now()
|
||||||
data, err := g.getKubeSystemContainersResourceUsage(c)
|
data, err := g.getKubeSystemContainersResourceUsage(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
Logf("Error while getting resource usage: %v", err)
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
g.usageTimeseries[now] = data
|
g.usageTimeseries[now] = data
|
||||||
case <-g.stopCh:
|
case <-g.stopCh:
|
||||||
|
Logf("Stop channel is closed. Stopping gatherer.")
|
||||||
g.wg.Done()
|
g.wg.Done()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -100,8 +102,9 @@ func (g *containerResourceGatherer) startGatheringData(c *client.Client, period
|
|||||||
|
|
||||||
func (g *containerResourceGatherer) stopAndSummarize(percentiles []int, constraints map[string]resourceConstraint) *ResourceUsageSummary {
|
func (g *containerResourceGatherer) stopAndSummarize(percentiles []int, constraints map[string]resourceConstraint) *ResourceUsageSummary {
|
||||||
close(g.stopCh)
|
close(g.stopCh)
|
||||||
g.timer.Stop()
|
Logf("Closed stop channel.")
|
||||||
g.wg.Wait()
|
g.wg.Wait()
|
||||||
|
Logf("Waitgroup finished.")
|
||||||
if len(percentiles) == 0 {
|
if len(percentiles) == 0 {
|
||||||
Logf("Warning! Empty percentile list for stopAndPrintData.")
|
Logf("Warning! Empty percentile list for stopAndPrintData.")
|
||||||
return &ResourceUsageSummary{}
|
return &ResourceUsageSummary{}
|
||||||
|
Loading…
Reference in New Issue
Block a user