[OPIK-1216]: [SDK] Client-side dynamic rate limiting
Details
Implemented dynamic rate limiting to handle rate-limited exceptions with configurable retry logic. Enhanced message queue functionality with a maximum size, discard handling, and queue size monitoring to prevent overflows. Added unit tests to validate rate limiting, queue size limits, and queue behavior under various conditions.
Testing
Implemented related unit and e2e tests
Just FYI today the backend returns headers with the rate limit values, name and remaining time. you can use it rather than hard-coding limits
@thiagohora Hey! Could you provide example of such response and more details about when such response will be returned.
@thiagohora Hey! Could you provide example of such response and more details about when such response will be returned.
Sure! @yaricom
For all the calls with rate limit, the backend returns the following headers:
Opik-{rate-limit-name}-Limit: {bucket_name}
Opik-{rate-limit-name}-Remaining-Limit: {number_remaining_calls}
Opik-{rate-limit-name}-Remaining-Limit-TTL-Millis: {number_millis_until_renewal}
Once you receive the 429 error, you can check the response headers and find those.
SDK Unit Tests Results
440 tests 438 ✅ 33s ⏱️ 1 suites 0 💤 1 files 2 ❌
For more details on these failures, see this check.
Results for commit f3189dc5.
:recycle: This comment has been updated with latest results.
SDK E2E Tests Results
52 tests +52 22 ✅ +22 3m 54s ⏱️ + 3m 54s 1 suites + 1 0 💤 ± 0 1 files + 1 30 ❌ +30
For more details on these failures, see this check.
Results for commit cb5c680f. ± Comparison against base commit 751d3eb7.
:recycle: This comment has been updated with latest results.