Skip to content

Commit 6ac04d4

Browse files
authored
improve koordlet log verbosity (#338)
Signed-off-by: saintube <saintube@foxmail.com>
1 parent b8dd567 commit 6ac04d4

File tree

5 files changed

+24
-14
lines changed

5 files changed

+24
-14
lines changed

pkg/koordlet/metricsadvisor/collector.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ func (c *collector) collectPodThrottledInfo() {
362362
if err != nil || currentCPUStat == nil {
363363
if pod.Status.Phase == corev1.PodRunning {
364364
// print running pod collection error
365-
klog.Infof("collect pod %s/%s, uid %v cpu throttled failed, err %v, metric %v",
365+
klog.V(4).Infof("collect pod %s/%s, uid %v cpu throttled failed, err %v, metric %v",
366366
pod.Namespace, pod.Name, uid, err, currentCPUStat)
367367
}
368368
continue
@@ -402,7 +402,7 @@ func (c *collector) collectContainerThrottledInfo(podMeta *statesinformer.PodMet
402402
collectTime := time.Now()
403403
containerStat := &pod.Status.ContainerStatuses[i]
404404
if len(containerStat.ContainerID) == 0 {
405-
klog.Infof("container %s/%s/%s id is empty, maybe not ready, skip this round",
405+
klog.V(4).Infof("container %s/%s/%s id is empty, maybe not ready, skip this round",
406406
pod.Namespace, pod.Name, containerStat.Name)
407407
continue
408408
}
@@ -414,7 +414,7 @@ func (c *collector) collectContainerThrottledInfo(podMeta *statesinformer.PodMet
414414
}
415415
currentCPUStat, err := system.GetCPUStatRaw(containerCgroupPath)
416416
if err != nil {
417-
klog.Infof("collect container %s/%s/%s cpu throttled failed, err %v, metric %v",
417+
klog.V(4).Infof("collect container %s/%s/%s cpu throttled failed, err %v, metric %v",
418418
pod.Namespace, pod.Name, containerStat.Name, err, currentCPUStat)
419419
continue
420420
}

pkg/koordlet/reporter/reporter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ func (r *reporter) sync() {
211211
if retErr != nil {
212212
klog.Warningf("update node metric status failed, status %v, err %v", util.DumpJSON(newStatus), retErr)
213213
} else {
214-
klog.Infof("update node metric status success, detail: %v", util.DumpJSON(newStatus))
214+
klog.V(4).Infof("update node metric status success, detail: %v", util.DumpJSON(newStatus))
215215
}
216216
}
217217

pkg/koordlet/resmanager/cgroup_reconcile.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,8 @@ func makeCgroupResourcesForAnolis(owner *OwnerRef, parentDir string, summary *cg
467467
var resources []MergeableResourceUpdater
468468

469469
if !system.HostSystemInfo.IsAnolisOS {
470+
klog.V(5).Infof("ignored cgroup resources which required non Anolis OS, owner: %v, parentDir: %v",
471+
owner, parentDir)
470472
return nil
471473
}
472474

pkg/koordlet/resmanager/cpu_burst.go

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -509,12 +509,16 @@ func (b *CPUBurst) applyCPUBurst(burstCfg *slov1alpha1.CPUBurstConfig, podMeta *
509509
containerCFSBurstValStr := strconv.FormatInt(containerCFSBurstVal, 10)
510510
updater := NewCommonCgroupResourceUpdater(ownerRef, containerDir, system.CPUBurst, containerCFSBurstValStr)
511511
updated, err := b.executor.UpdateByCache(updater)
512-
if err != nil {
512+
if err == nil {
513+
klog.V(5).Infof("apply container %v/%v/%v cpu burst value success, dir %v, value %v",
514+
pod.Namespace, pod.Name, containerStat.Name, containerDir, containerCFSBurstVal)
515+
} else if system.HostSystemInfo.IsAnolisOS {
516+
// cgroup `cpu.burst_us` is expected available on anolis os, and it may not exist in other kernels.
513517
klog.Infof("update container %v/%v/%v cpu burst failed, dir %v, updated %v, error %v",
514518
pod.Namespace, pod.Name, containerStat.Name, containerDir, updated, err)
515519
} else {
516-
klog.V(5).Infof("apply container %v/%v/%v cpu burst value success, dir %v, value %v",
517-
pod.Namespace, pod.Name, containerStat.Name, containerDir, containerCFSBurstVal)
520+
klog.V(4).Infof("update container %v/%v/%v cpu burst ignored on non Anolis OS, dir %v, "+
521+
"updated %v, info %v", pod.Namespace, pod.Name, containerStat.Name, containerDir, updated, err)
518522
}
519523
}
520524
} // end for containers
@@ -525,12 +529,16 @@ func (b *CPUBurst) applyCPUBurst(burstCfg *slov1alpha1.CPUBurstConfig, podMeta *
525529
podCFSBurstValStr := strconv.FormatInt(podCFSBurstVal, 10)
526530
updater := NewCommonCgroupResourceUpdater(ownerRef, podDir, system.CPUBurst, podCFSBurstValStr)
527531
updated, err := b.executor.UpdateByCache(updater)
528-
if err != nil {
532+
if err == nil {
533+
klog.V(5).Infof("apply pod %v/%v cpu burst value success, dir %v, value %v",
534+
pod.Namespace, pod.Name, podDir, podCFSBurstValStr)
535+
} else if system.HostSystemInfo.IsAnolisOS {
536+
// cgroup `cpu.burst_us` is expected available on anolis os, and it may not exist in other kernels.
529537
klog.Infof("update pod %v/%v cpu burst failed, dir %v, updated %v, error %v",
530538
pod.Namespace, pod.Name, podDir, updated, err)
531539
} else {
532-
klog.V(5).Infof("apply pod %v/%v cpu burst value success, dir %v, value %v",
533-
pod.Namespace, pod.Name, podDir, podCFSBurstValStr)
540+
klog.V(4).Infof("update pod %v/%v cpu burst ignored on non Anolis OS, dir %v, updated %v, "+
541+
"info %v", pod.Namespace, pod.Name, podDir, updated, err)
534542
}
535543
}
536544
}

pkg/koordlet/resmanager/memory_evict.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ func NewMemoryEvictor(mgr *resmanager) *MemoryEvictor {
5151
}
5252

5353
func (m *MemoryEvictor) memoryEvict() {
54-
klog.Infof("starting memory evict process")
55-
defer klog.Infof("memory evict process completed")
54+
klog.V(5).Infof("starting memory evict process")
55+
defer klog.V(5).Infof("memory evict process completed")
5656

5757
if time.Now().Before(m.lastEvictTime.Add(time.Duration(m.resManager.config.MemoryEvictCoolTimeSeconds) * time.Second)) {
58-
klog.Infof("skip memory evict process, still in evict cooling time")
58+
klog.V(5).Infof("skip memory evict process, still in evict cooling time")
5959
return
6060
}
6161

@@ -110,7 +110,7 @@ func (m *MemoryEvictor) memoryEvict() {
110110

111111
nodeMemoryUsage := nodeMetric.MemoryUsed.MemoryWithoutCache.Value() * 100 / memoryCapacity
112112
if nodeMemoryUsage < *thresholdPercent {
113-
klog.Infof("skip memory evict, node memory usage(%v) is below threshold(%v)", nodeMemoryUsage, thresholdConfig)
113+
klog.V(5).Infof("skip memory evict, node memory usage(%v) is below threshold(%v)", nodeMemoryUsage, thresholdConfig)
114114
return
115115
}
116116

0 commit comments

Comments
 (0)