Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions pkg/agent/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,11 +331,14 @@ func gatherAndOutputData(ctx context.Context, eventf Eventf, config CombinedConf

notificationFunc := backoff.Notify(func(err error, t time.Duration) {
eventf("Warning", "PushingErr", "retrying in %v after error: %s", t, err)
log.Info("Warning: PushingErr: retrying", "in", t, "reason", err)
log.Error(err, "Warning: PushingErr: will retry", "retry_after", t)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will make the temporary problem more prominent (Error instead of Info) in the logs of the affected user.
There's a risk that other users might find it annoying to suddenly get new errors logged in normal operation.
This backoff feature is intended to smooth over temporary network errors or API errors, so that the user doesn't have to worry about them.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with Richard. I believe a warning level is more appropriate.

})

post := func() (any, error) {
return struct{}{}, postData(klog.NewContext(ctx, log), config, preflightClient, readings)
postCtx, cancel := context.WithTimeout(ctx, config.BackoffMaxTime)
defer cancel()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Good idea, using the existing BackoffMaxTime as the operation timeout, to ensure that no single upload attempt can hang for ever and block the retry.

It seems to me that the backoff module should do this, but it doesn't seem to.

...and the author seems to be adamant that the supplied function should do it's own context cancellation:


return struct{}{}, postData(klog.NewContext(postCtx, log), config, preflightClient, readings)
}

group.Go(func() error {
Expand Down