alibaba / alibaba/Sentinel

Support for appending a single rule in the rule manager

Open
#1,614 3 comments 0 reactions 0 assignees View on GitHub
kind/discussion kind/feature
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)
FlowRuleManager & DegradeRuleManager provide `configUpdate()` method to update Rules by implements PropertyListener. But, `configUpdate()` like `configLoad()`, both of them `clear()` ConcurrentHashMap first, then `putAll()` Rules. Why dont provide a method to support add a new Rule into Map? This is necessary in the scenario where rule need to be added dynamically.

### Describe what you expected to happen
provide a method like: (eg. in DegradeRuleManager)
```
public static boolean addRule(DegradeRule rule) {
if (null ==rule ) {
return false;
}
return degradeRules.put(rule.getResource(), rule);
}
```

### How to reproduce it (as minimally and precisely as possible)

1.
2.
3.

### Tell us your environment

### Anything else we need to know?

Contributor guide

Open the contributing guide

Research direction

Start with FlowRuleManager and DegradeRuleManager, focusing on their configUpdate() and configLoad() entry points and how rules are stored. Check the existing manager tests, if present, before defining coverage for adding one rule dynamically. Done should demonstrate that a valid single rule can be added without clearing existing rules and that null input is handled as specified.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.