Closed thiagohora closed 1 month ago
Add rate limit functionality.
Added @RateLimited annotation to apply rate limit to an endpoint.
@RateLimited
The following properties control the limit buckets (For now, only one generalEvents)
generalEvents
rateLimit: enabled: ${RATE_LIMIT_ENABLED:-false} generalLimit: limit: ${RATE_LIMIT_GENERAL_EVENTS_LIMIT:-5000} durationInSeconds: ${RATE_LIMIT_GENERAL_EVENTS_DURATION_IN_SEC:-1}
In the case of batch operations, an interface called RateEventContainer allows the interceptor to know the number of items in the batch.
RateEventContainer
When enabled, the rate limit is communicated via headers and status 429 (TOO_MANY_REQUESTS) when the limit is reached.
Opik-User-Limit: general_events Opik-User-Remaining-Limit: 0 Opik-User-Remaining-Limit-TTL-Millis: 300
OPIK-68
Tested locally via Minikube setup and also via Component Tests in the pipeline.
Sorry, I found a typo
Details
Add rate limit functionality.
Added
@RateLimited
annotation to apply rate limit to an endpoint.The following properties control the limit buckets (For now, only one
generalEvents
)In the case of batch operations, an interface called
RateEventContainer
allows the interceptor to know the number of items in the batch.When enabled, the rate limit is communicated via headers and status 429 (TOO_MANY_REQUESTS) when the limit is reached.
Issues
OPIK-68
Testing
Tested locally via Minikube setup and also via Component Tests in the pipeline.