From ab3898ef54f612150ac933833a45f6de081ae858 Mon Sep 17 00:00:00 2001 From: Bogdan Drutu Date: Tue, 15 Oct 2024 12:43:53 -0700 Subject: [PATCH] [chore] Remove internal helper, no need to have it (#11454) Signed-off-by: Bogdan Drutu --- exporter/exporterhelper/internal/retry_sender.go | 4 +++- exporter/internal/request.go | 9 --------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/exporter/exporterhelper/internal/retry_sender.go b/exporter/exporterhelper/internal/retry_sender.go index 2f5e179fd00..ee364dc2fd1 100644 --- a/exporter/exporterhelper/internal/retry_sender.go +++ b/exporter/exporterhelper/internal/retry_sender.go @@ -96,7 +96,9 @@ func (rs *retrySender) Send(ctx context.Context, req internal.Request) error { return fmt.Errorf("not retryable error: %w", err) } - req = internal.ExtractPartialRequest(req, err) + if errReq, ok := req.(internal.RequestErrorHandler); ok { + req = errReq.OnError(err) + } backoffDelay := expBackoff.NextBackOff() if backoffDelay == backoff.Stop { diff --git a/exporter/internal/request.go b/exporter/internal/request.go index 319f9946f95..1b82e23504d 100644 --- a/exporter/internal/request.go +++ b/exporter/internal/request.go @@ -31,12 +31,3 @@ type RequestErrorHandler interface { // Otherwise, it should return the original Request. OnError(error) Request } - -// extractPartialRequest returns a new Request that may contain the items left to be sent -// if only some items failed to process and can be retried. Otherwise, it returns the original Request. -func ExtractPartialRequest(req Request, err error) Request { - if errReq, ok := req.(RequestErrorHandler); ok { - return errReq.OnError(err) - } - return req -}