diff --git a/exporter/exporterhelper/internal/request/request.go b/exporter/exporterhelper/internal/request/request.go index 3283f01b6be..466bc9ccc56 100644 --- a/exporter/exporterhelper/internal/request/request.go +++ b/exporter/exporterhelper/internal/request/request.go @@ -31,13 +31,13 @@ type Request interface { MergeSplit(context.Context, exporterbatcher.SizeConfig, Request) ([]Request, error) } -// RequestErrorHandler is an optional interface that can be implemented by Request to provide a way handle partial +// ErrorHandler is an optional interface that can be implemented by Request to provide a way handle partial // temporary failures. For example, if some items failed to process and can be retried, this interface allows to // return a new Request that contains the items left to be sent. Otherwise, the original Request should be returned. // If not implemented, the original Request will be returned assuming the error is applied to the whole Request. // Experimental: This API is at the early stage of development and may change without backward compatibility // until https://github.com/open-telemetry/opentelemetry-collector/issues/8122 is resolved. -type RequestErrorHandler interface { +type ErrorHandler interface { Request // OnError returns a new Request may contain the items left to be sent if some items failed to process and can be retried. // Otherwise, it should return the original Request. diff --git a/exporter/exporterhelper/internal/retry_sender.go b/exporter/exporterhelper/internal/retry_sender.go index 0bfc5ecf227..24729a66ac3 100644 --- a/exporter/exporterhelper/internal/retry_sender.go +++ b/exporter/exporterhelper/internal/retry_sender.go @@ -97,7 +97,7 @@ func (rs *retrySender) Send(ctx context.Context, req request.Request) error { return fmt.Errorf("not retryable error: %w", err) } - if errReq, ok := req.(request.RequestErrorHandler); ok { + if errReq, ok := req.(request.ErrorHandler); ok { req = errReq.OnError(err) } diff --git a/exporter/exporterhelper/exporterhelper.go b/exporter/exporterhelper/request.go similarity index 95% rename from exporter/exporterhelper/exporterhelper.go rename to exporter/exporterhelper/request.go index 7d7b4557049..29a116c7374 100644 --- a/exporter/exporterhelper/exporterhelper.go +++ b/exporter/exporterhelper/request.go @@ -18,4 +18,4 @@ type Request = request.Request // If not implemented, the original Request will be returned assuming the error is applied to the whole Request. // Experimental: This API is at the early stage of development and may change without backward compatibility // until https://github.com/open-telemetry/opentelemetry-collector/issues/8122 is resolved. -type RequestErrorHandler = request.RequestErrorHandler +type RequestErrorHandler = request.ErrorHandler