Skip to content

Commit

Permalink
sockmem: optimize the unnecessary fail handling
Browse files Browse the repository at this point in the history
enhancement: Too many unnecessary failed logs in the current sockmem plugin

Signed-off-by: Robin Lu <[email protected]>
  • Loading branch information
lubinszARM committed Feb 12, 2025
1 parent fb6d1d8 commit 1325ea9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pkg/agent/qrm-plugins/memory/dynamicpolicy/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ func (p *DynamicPolicy) Start() (err error) {
general.Infof("setSockMem enabled")
err := periodicalhandler.RegisterPeriodicalHandlerWithHealthz(memconsts.SetSockMem,
general.HealthzCheckStateNotReady, qrm.QRMMemoryPluginPeriodicalHandlerGroupName,
sockmem.SetSockMemLimit, 120*time.Second, healthCheckTolerationTimes)
sockmem.SetSockMemLimit, 240*time.Second, healthCheckTolerationTimes)
if err != nil {
general.Infof("setSockMem failed, err=%v", err)
}
Expand Down
10 changes: 4 additions & 6 deletions pkg/agent/qrm-plugins/memory/handlers/sockmem/sockmem_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,19 +200,17 @@ func SetSockMemLimit(conf *coreconfig.Configuration,
continue
}
for _, containerStatus := range pod.Status.ContainerStatuses {
podUID, containerID := string(pod.UID), native.TrimContainerIDPrefix(containerStatus.ContainerID)
if !containerStatus.Ready {
continue
}

podUID, containerID := string(pod.UID), native.TrimContainerIDPrefix(containerStatus.ContainerID)
memLimit, err := helper.GetPodMetric(metaServer.MetricsFetcher, emitter, pod, coreconsts.MetricMemLimitContainer, -1)
if err != nil {
errList = append(errList, err)
general.Infof("memory limit not found:%v..\n", podUID)
continue
}

memTCPLimit, err := helper.GetPodMetric(metaServer.MetricsFetcher, emitter, pod, coreconsts.MetricMemTCPLimitContainer, -1)
if err != nil {
errList = append(errList, err)
general.Infof("memory tcp.limit not found:%v..\n", podUID)
continue
}

Expand Down

0 comments on commit 1325ea9

Please sign in to comment.