Skip to content

Commit 6f9c280

Browse files
committed
cli(debug.zip): update retry configuration for GCS upload of logs
Previously, we are observing intermittent "EOF" errors during uploading logs to GCS. This patch updates the retry configuration for debug.zip log upload for rehydration. We are using "RetryAlways" policy in GCS client so that it will retry on all types errors. Epic: None Fixes: CRDB-51115 Release note: None
1 parent 4344c0a commit 6f9c280

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

pkg/cli/zip_upload.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ const (
9797
ddArchiveDefaultClient = "datadog-archive" // TODO(arjunmahishi): make this a flag also
9898

9999
gcsPathTimeFormat = "dt=20060102/hour=15"
100-
zipUploadRetries = 5
100+
zipUploadRetries = 100
101101

102102
// datadog allows us to use logs API logs only for the last 72 hours. So, we
103103
// are setting the oldest allowed log duration to 71 hours. The -1 hour is to
@@ -950,9 +950,14 @@ var gcsLogUpload = func(ctx context.Context, sig logUploadSig) (int, error) {
950950

951951
retryOpts := base.DefaultRetryOptions()
952952
retryOpts.MaxRetries = zipUploadRetries
953+
retryOpts.InitialBackoff = 1 * time.Second
954+
retryOpts.MaxBackoff = 10 * time.Second
953955

954956
for retry := retry.Start(retryOpts); retry.Next(); {
955-
objectWriter := gcsClient.Bucket(ddArchiveBucketName).Object(filename).NewWriter(ctx)
957+
958+
objectWriter := gcsClient.Bucket(ddArchiveBucketName).Object(filename).Retryer(
959+
storage.WithPolicy(storage.RetryAlways),
960+
).NewWriter(ctx)
956961
w := gzip.NewWriter(objectWriter)
957962
_, err = w.Write(data)
958963
if err != nil {

0 commit comments

Comments
 (0)