feat: Enhance limit-count
Plugin to Support Aligned Time Windows
#11880
Labels
enhancement
New feature or request
limit-count
Plugin to Support Aligned Time Windows
#11880
Description
The
limit-count
plugin starts its time window based on the timestamp of the first request. This approach is problematic for quota-based use cases, especially when quotas need to align with standard periods such as calendar months.To address this, I propose introducing a new attribute:
aligned_time_window
: A configuration option to define time intervals in named units (e.g.,"minute"
,"hour"
,"day"
,"month"
,"year"
) and automatically align them to standard boundaries.This attribute would be mutually exclusive with the existing
time_window
attribute.Proposed Changes
New Attribute:
aligned_time_window
:string
"minute"
,"hour"
,"day"
,"month"
,"year"
Use Case
Monthly Quota Enforcement:
A user has a monthly quota of 10,000 requests. With the current implementation, if the first request occurs on January 15th, the quota applies from January 15th to February 14th. Instead, the quota should align with the calendar month (January 1st to January 31st) for better consistency, fairness, and integration with monitoring tools.
Examples
Aligned Window with
aligned_time_window
The text was updated successfully, but these errors were encountered: