-
Notifications
You must be signed in to change notification settings - Fork 902
feat: cluster-key-rate-limit support setting global rate limit thresholds for routes #2262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: cluster-key-rate-limit support setting global rate limit thresholds for routes #2262
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2262 +/- ##
===========================================
+ Coverage 35.91% 46.06% +10.15%
===========================================
Files 69 81 +12
Lines 11576 13010 +1434
===========================================
+ Hits 4157 5993 +1836
+ Misses 7104 6671 -433
- Partials 315 346 +31 🚀 New features to boost your workflow:
|
…s://github.com/hanxiantao/higress into feat/cluster-rate-limiter-full-route-threshold
johnlanni
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
johnlanni
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Ⅰ. Describe what this PR did
feat: cluster-key-rate-limit supports setting global rate limit thresholds for routes
Other fixes:
rejected_msgconfiguration in cluster-key-rate-limit and ai-token-ratelimitⅡ. Does this pull request fix one issue?
fixes #2251
fixes #2326
Ⅲ. Why don't you add test cases (unit test/integration test)?
Ⅳ. Describe how to verify it
测试用例如下:
1)、global_threshold
一分钟内请求三次:
curl -kvv -X GET 'http://localhost:8082/foo'2)、limit_by_param和limit_by_per_param
wasmplugin.yam:
1)根据第一个apikey进行限流
一分钟内请求三次:
curl -kvv -X GET 'http://localhost:8082/foo?apikey=9a342114-ba8a-11ec-b1bf-00163e1250b5'响应头中x-ratelimit-limit为10(限制的总请求数),x-ratelimit-remaining为7(剩余还可以发送的请求数)
2)根据第二个apikey限流
请求三次:
curl -kvv -X GET 'http://localhost:8082/foo?apikey=a6a6d7f2-ba8a-11ec-bec2-00163e1250b5'3)正则表达式以b开头的字符串
一分钟内请求三次:
curl -kvv -X GET 'http://localhost:8082/foo?apikey=b123456777'响应头中x-ratelimit-limit为100(限制的总请求数),x-ratelimit-remaining为97(剩余还可以发送的请求数)s
4)*
请求三次:
curl -kvv -X GET 'http://localhost:8082/foo?apikey=1234567777'3)、limit_by_header和limit_by_per_header
wasmplugin.yam:
1)根据第一个请求头进行限流
一分钟内请求三次:
响应头中x-ratelimit-limit为10(限制的总请求数),x-ratelimit-remaining为7(剩余还可以发送的请求数)
2)根据第二个请求头进行限流
请求三次:
3)正则表达式以b开头的字符串
一分钟内请求三次:
响应头中x-ratelimit-limit为100(限制的总请求数),x-ratelimit-remaining为97(剩余还可以发送的请求数)
4)*
请求三次:
Ⅴ. Special notes for reviews