Count total requests sent to dex API #102
Merged
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.
Context
The oneinch solver on arbitrum currently causes a lot of noisy alerts which aren't really actionable.
When looking at the alert it appears as if ~40% of the request to the 1inch API return unexpected errors. However, after closer investigation it seems like this alert actually counts how many of the errors are unexpected errors.
Specifically for the arbitrum 1inch case <1% of all requests result in an unexpected error but 40% of all errors are unexpected.
Since 99% of the requests actually result in reasonable responses (albeit not good enough to satisfy the order's limit price) the 1inch solver should actually be considered healthy.
Solution
The error handling logic is surprisingly messy: Errors are grouped in weird ways, handled in multiple places and used in conjunction with
Option
.To resolve the noisy alert ASAP using a minimal patch without having to rethink all the error handling logic I decided to just introduce another metric which simply counts all requests sent to the API.
After this gets merged the alert should be updated to alert based on the ratio
unexpected_errors / total_requests
instead ofunexpected_errors / total_errors