Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically de-duplicate rules when loading rules #571

Merged
merged 2 commits into from
Mar 14, 2019

Conversation

sczyh30
Copy link
Member

@sczyh30 sczyh30 commented Mar 13, 2019

Describe what this PR does / why we need it

Automatically de-duplicate rules when loading rules. When there are duplicate FlowRule or DegradeRule, it might not work as expected.

Does this pull request fix one issue?

NONE

Describe how you did it

This PR does not contain breaking changes for public methods or interfaces.

  • De-duplicate rules when resolving from new rule list. For compatibility, we did not modify the original loadRules and register2Property method. We only de-duplicate the rules internally.
  • Add setRulesForResource to support replace rules for a specific resource, while others remain unchanged.
  • Log enhancement

Describe how to verify it

Run the test cases.

Special notes for reviews

NONE

- also code refinement

Signed-off-by: Eric Zhao <[email protected]>
@sczyh30 sczyh30 added the to-review To review label Mar 13, 2019
Signed-off-by: Eric Zhao <[email protected]>
@codecov-io
Copy link

codecov-io commented Mar 14, 2019

Codecov Report

Merging #571 into master will increase coverage by 1.41%.
The diff coverage is 47.87%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #571      +/-   ##
============================================
+ Coverage     39.09%   40.51%   +1.41%     
- Complexity     1196     1314     +118     
============================================
  Files           271      276       +5     
  Lines          8494     8941     +447     
  Branches       1134     1212      +78     
============================================
+ Hits           3321     3622     +301     
- Misses         4754     4872     +118     
- Partials        419      447      +28
Impacted Files Coverage Δ Complexity Δ
...csp/sentinel/slots/block/flow/FlowRuleManager.java 60.86% <0%> (-1.36%) 7 <0> (ø)
.../sentinel/slots/block/authority/AuthoritySlot.java 88.23% <100%> (ø) 7 <4> (ø) ⬇️
...ntinel/slots/block/degrade/DegradeRuleManager.java 21.27% <14.58%> (-5.12%) 7 <2> (ø)
...el/slots/block/authority/AuthorityRuleManager.java 63.79% <72.22%> (-1.12%) 9 <3> (ø)
...ba/csp/sentinel/slots/block/flow/FlowRuleUtil.java 50% <90%> (+2.23%) 19 <7> (-1) ⬇️
...l/slots/block/flow/param/ParamFlowRuleManager.java 75% <93.33%> (-1.2%) 7 <6> (ø)
...a/com/alibaba/csp/sentinel/node/StatisticNode.java 63.1% <0%> (-17.54%) 34% <0%> (+6%)
.../csp/sentinel/slots/statistic/base/WindowWrap.java 66.66% <0%> (-10.26%) 6% <0%> (+1%)
...slots/block/flow/controller/DefaultController.java 54.54% <0%> (-7.96%) 12% <0%> (+6%)
...p/sentinel/slots/statistic/metric/ArrayMetric.java 73.03% <0%> (-5.92%) 44% <0%> (+16%)
... and 19 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4b1ccd9...379d17a. Read the comment docs.

@sczyh30 sczyh30 added this to the 1.5.0 milestone Mar 14, 2019
Copy link
Contributor

@CarpenterLee CarpenterLee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants