resource rules (flow/degrade/param/authority) support regex matching #3251
+641
−104
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe what this PR does / why we need it
Resource rules support matching resource names according to regular rules, allowing users to configure traffic limiting rules or batch configuration.
When adding/deleting interfaces, there is no need to manually create/delete rules.
资源规则支持按照正则匹配资源名称,允许用户按照配置兜底限流规则或批量配置的能力。
当新增/删除接口时,无需手动创建/删除规则。
Does this pull request fix one issue?
Fixes #3247
Describe how you did it
Add a RuleManger to uniformly manage ordinary rules and regular rules. In order to reduce the performance loss caused by regular parsing/matching, the following two methods are used:
增加一个 RuleManger 统一管理普通规则和正则规则,为了减少正则解析/匹配所带来的性能损耗,使用下面两种方式:
Describe how to verify it
Regular unit tests have been added to each of the four rules to ensure normal performance; if regular rules are turned on, current limiting rules that meet regular matching but have different resource names will take effect.
对四种规则分别增加了正则的单元测试,用于保证表现正常;如果开启了正则规则,满足正则匹配但资源名称不同的限流规则均会生效。
Special notes for reviews
None