Am I still able to intercept exceptions on retry to emit client side metrics?
See original GitHub issueDescribe 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
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Introducing Retry Throttling | AWS Developer Tools Blog
Client side retries are used to avoid surfacing unnecessary exceptions back to the caller in the case of transient network or service issues ......
Read more >Azure Application Insights for JavaScript web apps
As a result, distributed tracing is incomplete until the SDK fully initializes. To remedy this problem, you can include dynamic JavaScript on ...
Read more >Node.js Best Practice Exception Handling - Stack Overflow
This gotcha is very easy to do as your code becomes more complex. As such, it is best to either use domains or...
Read more >Error Handling in Large .NET Projects - Best Practices
Hiding errors silently is only appropriate in very specific scenarios, for example to catch exceptions thrown when attempting to log an error in ......
Read more >Let's Rebuild AWS EC2 (Part 1). Looking deeper into some of the ...
This is not possible if retries do not return the same reservation id. ... fails with a ConditionalCheckFailedException (only catch this specific exception, ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Let us know if this would help.
Thanks! that worked. For anyone who reads this in the future.