Closed
Description
Describe the issue
In v1 I was able to add a lambda to intercept exceptions in client and emit metrics if desired, I'm struggling to do the same with v2.
import com.amazonaws.retry.PredefinedRetryPolicies;
import com.amazonaws.retry.RetryPolicy;
private RetryPolicy buildRetryPolicy() {
return new RetryPolicy(
(originalRequest, exception, retriesAttempted) -> {
LOGGER.info("AWS failed with exception {}", exception.getClass());
if (exception instanceof ProvisionedThroughputExceededException) {
metrics.getCounter(PROVIDER_EXCEPTION,Map.of("exception", "ProvisionedThroughputExceededException")).inc();
}
return PredefinedRetryPolicies.DEFAULT_RETRY_CONDITION.shouldRetry(
originalRequest, exception, retriesAttempted);
},
PredefinedRetryPolicies.DEFAULT_BACKOFF_STRATEGY,
PredefinedRetryPolicies.DEFAULT_MAX_ERROR_RETRY,
false);
}
Your Environment
- AWS Java SDK version used: '2.15.26'
- JDK version used: 11
- Operating System and version: N/A