Issue Description
Resource rules (flow, degrade, authority, hot param) support regex matching
Describe what feature you want
Traditional resource rules strictly follow the string matching mechanism to obtain all rules under the current resource. Now if you want to enhance this capability, you can use regular expressions for matching. When users add/delete hidden interfaces, there is no need to manually add/delete rules.
传统的资源规则严格按照字符串匹配的机制获取当前资源下的所有规则,现希望增强该能力,可以使用正则表达式进行匹配。当用户增加/删除埋点接口时,无需手动增加/删除规则。
Applicable scene:
- Flow/hotparam rules: allows configuration of unified backup rules;
- Authorization/degrade rules: Allow users to batch configure rules;
适用场景:
- 流控 / 热点规则:允许配置统一的 兜底规则;
- 授权 / 降级规则:允许用户 批量配置 规则;
Example:
Configure flow control rules (resource name: .*, regex: true, QPS threshold: 5), 2 buried points resA, resB. Effect: resA, resB respectively limit QPS threshold = 5
举例:
配置流控规则(资源名称:.*, 支持正则: true,QPS 阈值:5),2 个埋点 resA, resB。效果:resA, resB 分别限制 QPS 阈值 = 5
Describe your initial design (if present)
It has been initially implemented, and PR will be added in the future.
已经初步实现,后续会补充PR
Additional context
Risk point: Performance issues with regular expression matching.
风险点:担心正则表达式匹配的性能问题。
Solution:
- Cache the results of regular expression matching;
- When reloading rules, the cache is rebuilt instead of cache invalidated to avoid the performance impact of relying on request reconstruction in high concurrency situations due to cache invalidation;
解决方案:
- 缓存正则表达式匹配的结果;
- 当重新 load 规则时缓存重建,而非缓存失效,避免由于缓存失效后,依赖请求重建在高并发情况下的性能影响;
Issue Description
Resource rules (flow, degrade, authority, hot param) support regex matching
Describe what feature you want
Traditional resource rules strictly follow the string matching mechanism to obtain all rules under the current resource. Now if you want to enhance this capability, you can use regular expressions for matching. When users add/delete hidden interfaces, there is no need to manually add/delete rules.
传统的资源规则严格按照字符串匹配的机制获取当前资源下的所有规则,现希望增强该能力,可以使用正则表达式进行匹配。当用户增加/删除埋点接口时,无需手动增加/删除规则。
Applicable scene:
适用场景:
Example:
Configure flow control rules (resource name: .*, regex: true, QPS threshold: 5), 2 buried points resA, resB. Effect: resA, resB respectively limit QPS threshold = 5
举例:
配置流控规则(资源名称:.*, 支持正则: true,QPS 阈值:5),2 个埋点 resA, resB。效果:resA, resB 分别限制 QPS 阈值 = 5
Describe your initial design (if present)
It has been initially implemented, and PR will be added in the future.
已经初步实现,后续会补充PR
Additional context
Risk point: Performance issues with regular expression matching.
风险点:担心正则表达式匹配的性能问题。
Solution:
解决方案: