Skip to content

Commit

Permalink
otlpexporter: simplify shouldRetry logic (#4348)
Browse files Browse the repository at this point in the history
Signed-off-by: Bogdan Drutu <[email protected]>
  • Loading branch information
bogdandrutu authored Nov 3, 2021
1 parent 9c65d76 commit c24dfeb
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions exporter/otlpexporter/otlp.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,6 @@ func processError(err error) error {

func shouldRetry(code codes.Code) bool {
switch code {
case codes.OK:
// Success. This function should not be called for this code, the best we
// can do is tell the caller not to retry.
return false

case codes.Canceled,
codes.DeadlineExceeded,
codes.PermissionDenied,
Expand All @@ -166,21 +161,9 @@ func shouldRetry(code codes.Code) bool {
codes.DataLoss:
// These are retryable errors.
return true

case codes.Unknown,
codes.InvalidArgument,
codes.NotFound,
codes.AlreadyExists,
codes.FailedPrecondition,
codes.Unimplemented,
codes.Internal:
// These are fatal errors, don't retry.
return false

default:
// Don't retry on unknown codes.
return false
}
// Don't retry on any other code.
return false
}

func getThrottleDuration(status *status.Status) time.Duration {
Expand Down

0 comments on commit c24dfeb

Please sign in to comment.