Skip to content
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

update ratelimit samples #206

Merged
merged 1 commit into from Jul 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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