You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2021/07/09 12:46:27 UTC
[dubbo-go-pixiu] branch develop updated: update ratelimit samples
This is an automated email from the ASF dual-hosted git repository.
alexstocks pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/dubbo-go-pixiu.git
The following commit(s) were added to refs/heads/develop by this push:
new 4f34562 update ratelimit samples
new ffc58b6 Merge pull request #206 from mark4z/develop
4f34562 is described below
commit 4f345624616119324d4572212830ac0dbd1daf4a
Author: mark4z <an...@outlook.com>
AuthorDate: Fri Jul 9 17:34:56 2021 +0800
update ratelimit samples
---
configs/api_config.yaml | 5 +++--
pkg/config/api_config.go | 2 +-
samples/plugins/ratelimit/README.md | 14 ++++++++------
samples/plugins/ratelimit/README_CN.md | 14 ++++++++------
4 files changed, 20 insertions(+), 15 deletions(-)
diff --git a/configs/api_config.yaml b/configs/api_config.yaml
index 7650eae..43b4e1d 100644
--- a/configs/api_config.yaml
+++ b/configs/api_config.yaml
@@ -106,8 +106,9 @@ rateLimit:
rules:
#qps sample At most 100 requests can be passed in 1000ms, so qps is 100
- - resource: "test-dubbo"
- enable: true
+ - enable: true
flowRule:
+ #the resource's name
+ resource: "test-dubbo"
threshold: 100
statintervalinms: 1000
\ No newline at end of file
diff --git a/pkg/config/api_config.go b/pkg/config/api_config.go
index b2b3c79..e369bf2 100644
--- a/pkg/config/api_config.go
+++ b/pkg/config/api_config.go
@@ -565,7 +565,7 @@ func getCheckPluginsGroupRegexp() *regexp.Regexp {
}
func getCheckRatelimitRegexp() *regexp.Regexp {
- return regexp.MustCompile(".+/filter/ratelimit/[^/]+/?$")
+ return regexp.MustCompile(".+/filter/ratelimit")
}
// RegisterConfigListener register APIConfigListener
diff --git a/samples/plugins/ratelimit/README.md b/samples/plugins/ratelimit/README.md
index 696fc73..4871365 100644
--- a/samples/plugins/ratelimit/README.md
+++ b/samples/plugins/ratelimit/README.md
@@ -32,12 +32,14 @@ resources:
- The second step is to set the rules. for example, the threshold is 100, and the statistical statintervalinms is 1000ms, which means that the qps/tps of the `resource` will not exceed 100.
```
-rules:
- #qps sample At most 100 requests can be passed in 1000ms, so qps is 100
- - resource: "test-dubbo"
- enable: true
- threshold: 100
- statintervalinms: 1000
+ rules:
+ #qps sample At most 100 requests can be passed in 1000ms, so qps is 100
+ - enable: true
+ flowRule:
+ #the resource's name
+ resource: "test-dubbo"
+ threshold: 100
+ statintervalinms: 1000
```
### Test:
diff --git a/samples/plugins/ratelimit/README_CN.md b/samples/plugins/ratelimit/README_CN.md
index 08cd130..8c39953 100644
--- a/samples/plugins/ratelimit/README_CN.md
+++ b/samples/plugins/ratelimit/README_CN.md
@@ -29,12 +29,14 @@ resources:
- 第二步,设置限流的规则,例如上限设置为100,统计周期为1000ms,这意味着这个`资源`的qps/tps最高只能达到100。
```
-rules:
- #qps sample At most 100 requests can be passed in 1000ms, so qps is 100
- - resource: "test-dubbo"
- enable: true
- threshold: 100
- statintervalinms: 1000
+ rules:
+ #qps sample At most 100 requests can be passed in 1000ms, so qps is 100
+ - enable: true
+ flowRule:
+ #the resource's name
+ resource: "test-dubbo"
+ threshold: 100
+ statintervalinms: 1000
```
### 测试: