look for a way to define custom rules for given param
- Dominant language
- Java
- Stars
- 23.1k
- Forks
- 8.1k
- PR merge metrics
- No merged PRs in 30d
Description
## Issue Description
Type: *feature request*
### Describe what happened (or what feature you want)
i using sentinel zuul adapter for my zuul ratelimit control
i hope this is a way to define custom rules for some given param
for example:
aiming at ip control rule ,the basic rule is 50 qps allowed per seconds, but in a group the extranet ip may be the same, or pressue test ,request send from the same ip address; this may cause BlockException
```
Set rules = new HashSet<>();
GatewayParamFlowItem paramFlowItem = new GatewayParamFlowItem();
paramFlowItem.setParseStrategy(SentinelGatewayConstants.PARAM_PARSE_STRATEGY_HEADER);
paramFlowItem.setFieldName("uip");
rules.add(new GatewayFlowRule("myrouteid")
.setCount(50)
.setIntervalSec(1)
.setControlBehavior(RuleConstant.CONTROL_BEHAVIOR_DEFAULT)
.setParamItem(paramFlowItem)
);
```
can GatewayFlowRule provide 'customParamItems' or someting else to set target rule threshold,
this 'customParamItems' List ,GatewayParamFlowItem may hold a 'count' filed as flow control threshold, if request param match some of the 'customParamItems' item ,using its count to achieve custom rules purpose ,if not ,using the default
### Describe what you expected to happen
### How to reproduce it (as minimally and precisely as possible)
1.
2.
3.
### Tell us your environment
```
sentinel-zuul-adapter 1.6.3
sentinel 1.6.3
```
### Anything else we need to know?
Contributor guide
Research direction
Start by reviewing GatewayFlowRule and GatewayParamFlowItem in the sentinel-zuul-adapter 1.6.3 integration, focusing on how the header field uip is parsed and how the default threshold is applied. Define how custom parameter matches and per-item count thresholds should interact with the existing default, then verify the behavior in the Sentinel gateway flow-control tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100