From c24dfeb047a8d0ca4c5a210c305be8ea80c10994 Mon Sep 17 00:00:00 2001 From: Bogdan Drutu Date: Tue, 2 Nov 2021 18:13:48 -0700 Subject: [PATCH] otlpexporter: simplify shouldRetry logic (#4348) Signed-off-by: Bogdan Drutu --- exporter/otlpexporter/otlp.go | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/exporter/otlpexporter/otlp.go b/exporter/otlpexporter/otlp.go index f8ed53dcbed..3fbfde292c9 100644 --- a/exporter/otlpexporter/otlp.go +++ b/exporter/otlpexporter/otlp.go @@ -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, @@ -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 {