Skip to content

RetryToken: expose attempts, scope and status #5818

Description

@elruwen

Describe the feature

Hi!

I want the RetryToken class to expose the fields attempt count, scope and status so I can get visibility when a retry is happening.

Cheers
Ruwen

Use Case

I am currently migrating from the SDK v1. In the SDK v1 I got custom retry condition which extends PredefinedRetryPolicies.SDKDefaultRetryCondition.

I do that in order to log retries:

    public boolean shouldRetry(AmazonWebServiceRequest originalRequest, AmazonClientException exception, int retriesAttempted) {
        boolean retry = super.shouldRetry(originalRequest, exception, retriesAttempted);
        String source = originalRequest.getClass().getSimpleName();
        LOGGER.warn("Retrying: {}, Retry Attempt: {}, Source: {}, Exception: {}", retry, retriesAttempted, source, exception.getMessage());
        return retry;
    }

In the past that has been quite helpful and so I want to keep that behaviour.

Currently the RetryToken doesn't expose any fields. If I log toString() on the retry token, then the log message is way to verbose.

Proposed Solution

Expose the fields:

  • attempts
  • state
  • scope

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

AWS Java SDK version used

2.29.52

JDK version used

17

Operating System and version

Debian stable

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestA feature should be added or improved.p3This is a minor priority issue

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions