alibaba / alibaba/Sentinel

some questions while using Sentinel-Zuul-Adapter

Open
#2,749 1 comment 0 reactions 0 assignees View on GitHub
kind/discussion
Dominant language
Java
Stars
23.1k
Forks
8.1k
PR merge metrics
No merged PRs in 30d

Description

## 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` as it's property while other 'Managers' are using `List`, 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?

Contributor guide

Open the contributing guide

Research direction

Start by reading GatewayFlowRule, Rule, GatewayRuleManager, DegradeRuleManager, and SystemRuleManager, including their register2Property methods. Compare the managers' Nacos ReadableDataSource handling and collection types; done means the requested Rule relationship, shared manager design, and collection behavior have a decided, consistent implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend, backend-api-design
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.