Skip to content

Add unit multiplier#552

Closed
harpunius wants to merge 2 commits intoenvoyproxy:mainfrom
harpunius:unit-multiplier
Closed

Add unit multiplier#552
harpunius wants to merge 2 commits intoenvoyproxy:mainfrom
harpunius:unit-multiplier

Conversation

@harpunius
Copy link
Copy Markdown

@harpunius harpunius commented Apr 6, 2024

Implements the unit multiplier idea suggested in #190.

rate_limit:
  unit: <second, minute, hour, day>
  requests_per_unit: <uint>
  unit_multiplier: <uint | optional>

I chose to force unit multiplier to 1 if the value is unset to avoid if/else checks whenever we rely on the value or log anything. This means the PR got slightly bigger than intended, but I think it's nicer.

The config parser panics if unit_multiplier: 0 is set. One RFC is the TODO in UnitToDividerWithMultiplier where I added a redundant if-zero runtime check to make sure we don't multiply by zero and effectively disable the rate limiting.

Note, this is a draft and doesn't build due to the dependencies on both https://github.com/envoyproxy/go-control-plane/blob/main/envoy/service/ratelimit/v3/rls.pb.go#L357-L367 and https://github.com/envoyproxy/go-control-plane/blob/main/ratelimit/config/ratelimit/v3/rls_conf.pb.go#L246-L263. I opened an issue to track this: envoyproxy/envoy#33277.

I couldn't run the integration tests locally (WSL setup) so let me know if we need to extend those tests as well.

Happy to hear your thoughts.

@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 label May 10, 2024
@harpunius
Copy link
Copy Markdown
Author

Not stale. Still waiting for input from e.g. @mattklein123

@github-actions github-actions Bot removed the stale label May 13, 2024
@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 label Jun 12, 2024
@harpunius
Copy link
Copy Markdown
Author

Still waiting for input.

@github-actions github-actions Bot removed the stale label Jun 18, 2024
@dnbn
Copy link
Copy Markdown

dnbn commented Jul 2, 2024

Hello @harpunius thanks It appears that one check were not successful.
Thank you for your implementation proposal. Do you know when it can be merged?

@ramaraochavali
Copy link
Copy Markdown

@harpunius are you actively working on this? If not we would like to contribute this as this is needed for us

@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 label Aug 29, 2024
@harpunius
Copy link
Copy Markdown
Author

Not stale, still waiting for input envoyproxy/envoy#33277.

@github-actions github-actions Bot removed the stale label Aug 29, 2024
@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 label Sep 28, 2024
@ramaraochavali
Copy link
Copy Markdown

Not stale

@github-actions github-actions Bot removed the stale label Sep 30, 2024
@Pawan-Bishnoi
Copy link
Copy Markdown

@harpunius is draft still the correct status of this PR?
(asking because that's probably the reason it isn't seeing much traction)

Signed-off-by: Tobias Sommer <harpunius@gmail.com>
Signed-off-by: Tobias Sommer <harpunius@gmail.com>
@harpunius
Copy link
Copy Markdown
Author

Hey, thanks for your input and interest in this PR.

As mentioned in the PR description:

Note, this is a draft and doesn't build due to the dependencies on both https://github.com/envoyproxy/go-control-plane/blob/main/envoy/service/ratelimit/v3/rls.pb.go#L357-L367 and https://github.com/envoyproxy/go-control-plane/blob/main/ratelimit/config/ratelimit/v3/rls_conf.pb.go#L246-L263. I opened an issue to track this: envoyproxy/envoy#33277.

For my implementation we need to extend the ratelimit protobuf definitions linked above. Tests run locally by statically linking the fixed protobuf files (with the new field added, see the issue in envoyproxy/envoy). Unfortunately, I don't see a way around that due to how the ratelimit envoy filter communicates with the ratelimit service.

I opened an issue to track this, but I still haven't gotten a response from the maintainers. I'm not very skilled with c++, so I'm having a hard time figuring out what additional work is needed in envoyproxy/envoy, for instance https://github.com/envoyproxy/envoy/blob/f580ed067db0f2a48085aa33e45a3a9cf5e36bfe/source/extensions/filters/http/ratelimit/ratelimit_headers.cc#L32 also needs to reflect the unit multiplier.

I did rebase so there at least aren't merge conflicts any more :)

@Pawan-Bishnoi
Copy link
Copy Markdown

ah, I see.
So you are waiting to someone to update the rls proto in envoy. And only after that you will be able to merge your changes to this repo.

Makes sense. Let me see if I can move the envoy piece.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Nov 1, 2024

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!

@harpunius
Copy link
Copy Markdown
Author

Still waiting for input for envoyproxy/envoy#33277.

@github-actions github-actions Bot removed the stale label Nov 2, 2024
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Dec 2, 2024

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!

@harpunius
Copy link
Copy Markdown
Author

Still waiting for input.

@github-actions github-actions Bot removed the stale label Dec 7, 2024
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jan 6, 2025

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 label Jan 6, 2025
@Pawan-Bishnoi
Copy link
Copy Markdown

not stale.
Planning to work on this envoyproxy/envoy#37841

@github-actions github-actions Bot removed the stale label Jan 6, 2025
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 5, 2025

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 label Feb 5, 2025
@taer
Copy link
Copy Markdown

taer commented Feb 12, 2025

@Pawan-Bishnoi what happened w/ the envoy proto change? This would be a very nice feature to have in the "reference" implementation.

@github-actions github-actions Bot removed the stale label Feb 12, 2025
@Pawan-Bishnoi
Copy link
Copy Markdown

I spent some time last weekend but the devContainer build was failing and ended up spending the whole day on that.
Will try again this weekend.

@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 label Mar 22, 2025
@Pawan-Bishnoi
Copy link
Copy Markdown

Pawan-Bishnoi commented Mar 23, 2025

not stale: envoyproxy/envoy#38529

@github-actions github-actions Bot removed the stale label Mar 23, 2025
@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 label Apr 22, 2025
@harpunius
Copy link
Copy Markdown
Author

Not stale.

@github-actions github-actions Bot removed the stale label Apr 27, 2025
@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 label May 27, 2025
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 3, 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 Jun 3, 2025
@taer
Copy link
Copy Markdown

taer commented Jun 3, 2025

This seemed like a nice feature. Let's me say per 30 minutes or similar. Is there work needed on this to get it in?

@Pawan-Bishnoi
Copy link
Copy Markdown

yes. This work: envoyproxy/envoy#38529

I am struggling to find time for this 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants