Skip to content

rate limit - add unit_multiplier#38529

Closed
Pawan-Bishnoi wants to merge 1 commit intoenvoyproxy:mainfrom
Pawan-Bishnoi:rls_unit_multiplier
Closed

rate limit - add unit_multiplier#38529
Pawan-Bishnoi wants to merge 1 commit intoenvoyproxy:mainfrom
Pawan-Bishnoi:rls_unit_multiplier

Conversation

@Pawan-Bishnoi
Copy link
Copy Markdown
Contributor

Commit Message: add a unit multiplier field to rls proto
Additional Description: so that we can configure rate limits for n minutes/days etc.
Risk Level: Low
Testing: todo
Docs Changes: todo
Release Notes: todo
Fixes: #33277

Signed-off-by: Pawan Bishnoi <pawanbishnoi@outlook.com>
@repokitteh-read-only
Copy link
Copy Markdown

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to (api/envoy/|docs/root/api-docs/).
envoyproxy/api-shepherds assignee is @wbpcode
CC @envoyproxy/api-watchers: FYI only for changes made to (api/envoy/|docs/root/api-docs/).

🐱

Caused by: #38529 was opened by Pawan-Bishnoi.

see: more, trace.

Comment on lines +115 to +120

// The multiplier for the unit of time.
// This value multiplies the base unit of time to define a custom time period for the rate limit.
// For example, if the unit is set to MINUTE and the unit_multiplier is set to 5, the rate limit
// will be applied over a 5-minute period.
uint32 unit_multiplier = 4;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually cannot get the value of this requirement. And this change will also make the API a little weird because the requests_per_unit means the allowed requests number of single unit. It's conflict with the unit_multiplier.

cc @envoyproxy/api-shepherds

/wait-any

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, we only support single time unit, i.e for 1 minute, 1 hour or 1 day etc., but this PR is to support for time units like mentioned below.

X requests over 30 seconds
X requests over 5 minutes
X requests over 30 minutes
X requests over 12 hours
X requests over 7 days

which would allow you to represent any time period.

Copy link
Copy Markdown
Member

@wbpcode wbpcode Mar 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know the requirement. But my worry is this new feature will make the API become weird and not sure if it deserves that.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But because @mattklein123 think it's fine, so I won't block this PR and will let the matt to make the decision. Thanks for all these contributions. 🌷

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can help with the implementation if the matt give the LGTM to the API. :)

Copy link
Copy Markdown
Member

@wbpcode wbpcode Apr 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we add the new field which have overrlapping feature with exist unit, we may should deprecate the old unit.

I have no strong preference here, actually. But I think unit_multiplier may be easier to implment. Orz.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine, let's go head with the unit_multiplier.


I think we need add a comment and limit about the zero value of the unit_multiplier?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome! I will polish it a bit and reach out to you.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following this thread, see a proposal at #40222 (comment) on a related issue.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

created a new one instead: #40830
@wbpcode plz review that.

@github-actions
Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@github-actions github-actions Bot added stale stalebot believes this issue/PR has not been touched recently and removed stale stalebot believes this issue/PR has not been touched recently labels Apr 23, 2025
@Pawan-Bishnoi
Copy link
Copy Markdown
Contributor Author

not stale

@github-actions
Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@github-actions github-actions Bot added the stale stalebot believes this issue/PR has not been touched recently label Jun 27, 2025
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jul 4, 2025

This pull request has been automatically closed because it has not had activity in the last 37 days. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@github-actions github-actions Bot closed this Jul 4, 2025
@wbpcode wbpcode added no stalebot Disables stalebot from closing an issue and removed stale stalebot believes this issue/PR has not been touched recently labels Jul 7, 2025
@wbpcode wbpcode reopened this Jul 7, 2025
@vamsibandarupalli
Copy link
Copy Markdown

not stale

@Pawan-Bishnoi
Copy link
Copy Markdown
Contributor Author

working on this here: #40830

@Pawan-Bishnoi Pawan-Bishnoi deleted the rls_unit_multiplier branch August 27, 2025 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api no stalebot Disables stalebot from closing an issue waiting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support multiples of units for rate limits

5 participants