aws-sdk-go-v2
aws-sdk-go-v2 copied to clipboard
Allow callbacks on retry attempt in Retryer
Describe the feature
Retryer is a great library. One thing which prevents us from using it right now is the lack of reporting/logging something custom/specific to the business log where a retry attempt could be made.
Currently only logging attempt number if possible, but it would be great if we could register a method which could be invoked as part of the retry.
Use Case
We use sagemaker invoke API to hit sagemaker endpoints. At the scale we operate at, we have run into "ThrottleException" in the past. Retryer does seem to allow retrying on such exceptions but we want to track how frequently this happens (through prometheus ideally). It would be great if we could register functions as callbacks which are called at each retry attempt (would be great if attempt number is passed as well). This function could just increment a prometheus counter or use verbose logging to log the state of the request.
Proposed Solution
Allow registering a method as a callback or pass the method as a function parameter (this could be a list of callbacks as well) which gets invoked after waking up from the retry delay.
Other Information
No response
Acknowledgements
- [x] I may be able to implement this feature request
- [ ] This feature might incur a breaking change
AWS Go SDK V2 Module Versions Used
go: downloading github.com/aws/aws-sdk-go-v2/config v1.15.12 go: downloading github.com/aws/aws-sdk-go-v2 v1.16.6 go: downloading github.com/aws/aws-sdk-go-v2/service/sagemaker v1.34.0 go: added github.com/aws/aws-sdk-go-v2/service/sagemaker v1.34.0
Go version used
1.19