datadog-agent icon indicating copy to clipboard operation
datadog-agent copied to clipboard

Add `Scheduled` as retry status

Open keisku opened this issue 7 months ago • 2 comments

What does this PR do?

Add new Scheduled status in pkg/util/retry.

Motivation

After adding this status, I will use it as below to suppress same debug logs.

git diff | cat
diff --git a/pkg/util/containers/cri/util.go b/pkg/util/containers/cri/util.go
index 5c4fb37697..ab49b6f1e0 100644
--- a/pkg/util/containers/cri/util.go
+++ b/pkg/util/containers/cri/util.go
@@ -126,7 +126,11 @@ func GetUtil() (*CRIUtil, error) {
 	})

 	if err := globalCRIUtil.initRetry.TriggerRetry(); err != nil {
-		log.Debugf("CRI init error: %s", err)
+		if retry.IsScheduled(err) {
+			log.Trace("CLI init scheduled")
+		} else {
+			log.Debugf("CRI init error: %s", err)
+		}
 		return nil, err
 	}
 	return globalCRIUtil, nil

In my environment, there are more than 400 debug logs like below in last 15 minutes.

CRI init error: temporary failure in criutil, will retry later: try delay not elapsed yet

2024-07-02_22-14-48

Additional Notes

Possible Drawbacks / Trade-offs

Describe how to test/QA your changes

The status and functions added in this PR are intended to be used in subsequent PRs, so there will be no change in the Agent’s behavior.

keisku avatar Jul 02 '24 13:07 keisku