Sentinel icon indicating copy to clipboard operation
Sentinel copied to clipboard

some questions while using Sentinel-Zuul-Adapter

Open WilliamChen-luckbob opened this issue 2 years ago • 0 comments

Issue Description

feature request

Describe what happened (or what feature you want)

When using Sentinel to protect my zuul gateway, here comes to me some questions.

First of all, I've noticed that GatewayFlowRule is just an independent class which is not implement the Rule interface while it should be to do so according to our common understood.

Secondlly, when I'm trying to configure the register2Property method for each of the 'RuleManagers' such as GatewayRuleManager,DegradeRuleManager,and SystemRuleManager, I found those managers sharing almost the same methods are not extend from any superclasses nor implement any interfaces. So I think common methods should be extracted to make an abstract class or interface then we can get a rather clear view to the family of 'RuleManagers'.

The last thing is, when using Nacos as data persisting tool, I don't know why GatewayFlowManager is using Set<GatewayFlowRule> as it's property while other 'Managers' are using List<Rule>, and I have to set an independent method to grab ReadableDataSource for GatewayFlowManager only. However, they share exactly the same code but I have to write it twice to meet both Set and List results.

第一,感觉GatewayFlowRule方法应该实现一下Rule接口 第二,各种RuleManager类是否可以提一个抽象类出来,这样子可能看起来会更清晰一些 第三,在使用nacos持久化流控配置时,为啥唯独GatewayFlowRule的property要用Set类型,如此一来当设定网关api的限流,熔断,降级等操作的时候,要为GatewayFlowRule单独写一个冗余代码块,这里不知道是否可以优化一下...

Describe what you expected to happen

  1. All the related Rules should be at least an implementation of Rule
  2. Managers should have a superclass or interface to extract their sharing methods.
  3. Make the property type of managers not using different collection type if it is nessessary.

Tell us your environment

JDK 1.8 latest master branch

Anything else we need to know?

WilliamChen-luckbob avatar Jun 17 '22 10:06 WilliamChen-luckbob