alibaba / alibaba/Sentinel

Support customized parameter parsing logic in parameter flow control

Open
#274 3 comments 0 reactions 0 assignees View on GitHub
area/flow-control kind/enhancement
Dominant language
Java
Stars
23.1k
Forks
8.1k
PR merge metrics
No merged PRs in 30d

Description

## Issue Description

看了这里关于热点参数限流的描述:
https://github.com/alibaba/Sentinel/wiki/%E7%83%AD%E7%82%B9%E5%8F%82%E6%95%B0%E9%99%90%E6%B5%81

只能指定接口的某个索引位置的参数,不能根据自定义函数解析某个参数的结果来限流,请问这个功能可以支持么?

热点参数限流按对象实体中的某几个具体参数进行限流

Type: *feature request*

### Describe what happened (or what feature you want)

根据热点参数来限流可以这么做:

```java
ParamFlowRule rule = new ParamFlowRule(resourceName)
.setParamIdx(0)
.setCount(5);
rule.setParamFlowItemList(Collections.singletonList(item));

ParamFlowRuleManager.loadRules(Collections.singletonList(rule));
```

只能指定参数的索引位置,而不能根据自定义函数解析参数的结果来限流。比如如果参数是订单号,后两位是分片位,我想取订单号后2位根据分片来限流。

### Describe what you expected to happen

热点参数限流按对象实体中的某几个具体参数进行限流,或者自定义逻辑判断。

Contributor guide

Open the contributing guide

Research direction

Start with the ParamFlowRule and ParamFlowRuleManager usage shown in the issue, then read the hotspot parameter flow-control documentation linked there. Determine how parameter indexes are currently handled and define how custom extraction or object-field selection should be configured; done means the requested custom parsing behavior is supported and covered by 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
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.