feat: Added retry logic to remote api request #760
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Summary
ErrRemoteUnavailable
. This error is supposed to be used for cases when Remote API is unavailable, e.g. repetitively returns following errors: 401, 502, 503, 504, transport errors, timeoutsRemote
section in checker, api and notifier configs:json: retry_seconds
- defines time intervals in seconds for retry calls for errors above, ex.:'1 10 30'
,'1 1
json: health_check_timeout
- defines timeout for calls for health check, ex.:5s
json: health_check_retry_seconds
defines time intervals in seconds for health check retry calls, ex.:5 5
makeRequestWithRetries
is added to perform calls with retries in case of getting errors from the list above. This method is applied in both health check call and fetching trigger metrics call.Future work
There will be follow-up PR for including logic of handling of
ErrRemoteUnavailable
error in trigger check processing and PR for adding new metric for monitoring of graphite unavailability