opik icon indicating copy to clipboard operation
opik copied to clipboard

[OPIK-1216]: [SDK] Client-side dynamic rate limiting

Open yaricom opened this issue 7 months ago • 5 comments

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

yaricom avatar May 07 '25 18:05 yaricom

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 avatar May 07 '25 19:05 thiagohora

@thiagohora Hey! Could you provide example of such response and more details about when such response will be returned.

yaricom avatar May 08 '25 11:05 yaricom

@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.

thiagohora avatar May 08 '25 12:05 thiagohora

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.

github-actions[bot] avatar May 08 '25 16:05 github-actions[bot]

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.

github-actions[bot] avatar May 08 '25 16:05 github-actions[bot]