Skip to content

Commit

Permalink
Merge pull request apache#206 from mark4z/develop
Browse files Browse the repository at this point in the history
update ratelimit samples
  • Loading branch information
AlexStocks committed Jul 9, 2021
2 parents 25e5652 + e05da21 commit afaeb01
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 15 deletions.
5 changes: 3 additions & 2 deletions configs/api_config.yaml
Expand Up @@ -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
2 changes: 1 addition & 1 deletion pkg/config/api_config.go
Expand Up @@ -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
Expand Down
14 changes: 8 additions & 6 deletions samples/plugins/ratelimit/README.md
Expand Up @@ -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:
Expand Down
14 changes: 8 additions & 6 deletions samples/plugins/ratelimit/README_CN.md
Expand Up @@ -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
```

### 测试:
Expand Down

0 comments on commit afaeb01

Please sign in to comment.