mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-01 18:58:18 +00:00
Fix computing of cpu nano core usage
CRI runtimes do not supply cpu nano core usage as it is not part of CRI stats. However, there are upstream components that still rely on such stats to function. The previous fix was faulty because the multiple callers could compete and update the stats, causing inconsistent/incoherent metrics. This change, instead, creates a separate call for updating the usage, and rely on eviction manager, which runs periodically, to trigger the updates. The caveat is that if eviction manager is completley turned off, no one would compute the usage.
This commit is contained in:
@@ -84,10 +84,16 @@ func (sp *summaryProviderImpl) Get(updateStats bool) (*statsapi.Summary, error)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get imageFs stats: %v", err)
|
||||
}
|
||||
podStats, err := sp.provider.ListPodStats()
|
||||
var podStats []statsapi.PodStats
|
||||
if updateStats {
|
||||
podStats, err = sp.provider.ListPodStatsAndUpdateCPUNanoCoreUsage()
|
||||
} else {
|
||||
podStats, err = sp.provider.ListPodStats()
|
||||
}
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to list pod stats: %v", err)
|
||||
}
|
||||
|
||||
rlimit, err := sp.provider.RlimitStats()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get rlimit stats: %v", err)
|
||||
|
||||
Reference in New Issue
Block a user