Sentinel core包里 提供了限流规则开关。控制台建议增加一键上下架限流功能
- Dominant language
- Java
- Stars
- 23.1k
- Forks
- 8.1k
- PR merge metrics
- No merged PRs in 30d
Description
场景:
比如要进行压测。一条条下架规则很麻烦。而sentinel-core包里又提供了一键关闭限流的方法:
* @author youji.zj
*/
@CommandMapping(name = "setSwitch", desc = "set sentinel switch, accept param: value={true|false}")
public class OnOffSetCommandHandler implements CommandHandler {
@Override
public CommandResponse handle(CommandRequest request) {
String value = request.getParam("value");
try {
Constants.ON = Boolean.valueOf(value);
} catch (Exception e) {
RecordLog.info("Bad value when setting global switch", e);
}
String info = "Sentinel set switch value: " + value;
RecordLog.info(info);
return CommandResponse.ofSuccess(info);
}
}
能否在senitinel-dashboard里。增加对这个接口的调用。实现压测期间 流控规则一键下架。结束后流控规则上架的功能。
Contributor guide
Research direction
Start with the sentinel-core OnOffSetCommandHandler and its setSwitch command, then trace how sentinel-dashboard currently manages flow-control rules. Define the dashboard actions for disabling and re-enabling the global switch during load testing, and verify that both transitions report the expected result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100