Skip to content

retry: add onRetry callback #356

Closed
Closed
@ericwenn

Description

@ericwenn

Currently (v1.2.2) the retry interceptor logs retries to the trace, see https://github.com/grpc-ecosystem/go-grpc-middleware/blob/master/retry/retry.go#L49

It would be great if we could hook in our own logger here via options. Something along the lines of:

type OnRetryCallback func(ctx context.Context, attempt uint, err error)

func WithOnRetryCallback(fn OnRetryCallback) CallOption

Additional context
We have our own request logger for gRPC Client calls, which we are currently wrapping outside retry.UnaryClientInterceptor, to only log the "final" response (after potential retries). We only retry Unavailable status codes. This is great as we are not alerted for any intermittent Unavailable status codes, but we have come across situations where we think a request should have been retried but can't really know what the retry interceptor is doing.

** Maintainer edit**: merged this with #375 and updated description.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions