-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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
Add basic interface and adaptations for Sentinel cluster flow control in sentinel-core
#257
Conversation
- Add a universal `TokenService` SPI interface for both local flow control and distributed flow control - Add TokenResult entity to represents result of acquiring token - Add `ClusterTokenClient` as the SPI interface for client of Sentinel cluster flow control Signed-off-by: Eric Zhao <sczyh16@gmail.com>
- Add new field `clusterMode` and `clusterConfig` for cluster mode - Add a `ClusterFlowConfig` class for specific items for cluster flow control - Update FlowRuleChecker to support cluster mode - Extract valid rule checking and rule map generating logic to FlowRuleUtil Signed-off-by: Eric Zhao <sczyh16@gmail.com>
55858cb
to
1010836
Compare
…util class - Update ParamFlowRule to support cluster mode - Add `ParamFlowClusterConfig` to provide cluster mode items for the rule - Update ParamFlowChecker to support cluster flow mode - Extract ParamFlowRuleUtil class - Change type of `flowId` from Integer to Long Signed-off-by: Eric Zhao <sczyh16@gmail.com>
11d07cc
to
f539b5b
Compare
Codecov Report
@@ Coverage Diff @@
## master #257 +/- ##
============================================
- Coverage 52.59% 50.65% -1.94%
- Complexity 913 923 +10
============================================
Files 150 158 +8
Lines 5037 5249 +212
Branches 720 754 +34
============================================
+ Hits 2649 2659 +10
- Misses 2065 2253 +188
- Partials 323 337 +14
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
sentinel-core/src/main/java/com/alibaba/csp/sentinel/cluster/TokenService.java
Outdated
Show resolved
Hide resolved
Add basic interface and adaptations for Sentinel cluster flow control in `sentinel-core` (alibaba#257)
Describe what this PR does / why we need it
Add basic interface for Sentinel cluster flow control in
sentinel-core
, and update rules and checkers forFlowRule
andParamFlowRule
to adapt to cluster flow control interface.Does this pull request fix one issue?
Related to #200 (a sub-task of it)
Describe how you did it
TokenService
SPI interface for both local flow control and distributed flow control serviceTokenResult
entity to represent result of acquiring tokenClusterTokenClient
as the SPI interface for client of Sentinel cluster flow controlclusterMode
andclusterConfig
for cluster modeClusterFlowConfig
andParamFlowClusterConfig
class for rule config in cluster modeFlowRuleChecker
andParamFlowChecker
to support cluster modeFlowRule
andParamFlowRule
Describe how to verify it
See test cases.
Special notes for reviews
NONE