diff --git a/configs/api_config.yaml b/configs/api_config.yaml index 7650eae4b..43b4e1dc2 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 b2b3c7935..e369bf2a5 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 696fc7356..487136550 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 08cd1309d..8c3995359 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 ``` ### 测试: