Skip to content

Refactor: Get the max allowed RT directly from SentinelConfig.statisticMaxRt() - #1173

Merged
sczyh30 merged 1 commit into
alibaba:masterfrom
sczyh30:improve-sentinel-config
Nov 21, 2019
Merged

Refactor: Get the max allowed RT directly from SentinelConfig.statisticMaxRt()#1173
sczyh30 merged 1 commit into
alibaba:masterfrom
sczyh30:improve-sentinel-config

Conversation

@sczyh30

@sczyh30 sczyh30 commented Nov 21, 2019

Copy link
Copy Markdown
Member

Describe what this PR does / why we need it

Get the max allowed RT directly from SentinelConfig.statisticMaxRt(), to avoid the class dependency chain: Constants -> SentinelConfig. The Constants class should not depend on any classes that could trigger static initialization.

Does this pull request fix one issue?

NONE

Describe how you did it

  • Remove the legacy TIME_DROP_VALUE in Constants class (which was resolved with SentinelConfig.statisticMaxRt())
  • Refactor related code to get the max allowed RT directly from SentinelConfig.statisticMaxRt()

Describe how to verify it

Run the test cases.

Special notes for reviews

NONE

- to avoid the dependency chain: Constants -> SentinelConfig

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
@sczyh30 sczyh30 added the kind/enhancement Category issues or prs related to enhancement. label Nov 21, 2019
@codecov-io

Copy link
Copy Markdown

Codecov Report

Merging #1173 into master will increase coverage by 0.01%.
The diff coverage is 50%.

Impacted file tree graph

@@             Coverage Diff             @@
##             master   #1173      +/-   ##
===========================================
+ Coverage     42.78%   42.8%   +0.01%     
  Complexity     1538    1538              
===========================================
  Files           330     330              
  Lines          9764    9767       +3     
  Branches       1318    1319       +1     
===========================================
+ Hits           4178    4181       +3     
+ Misses         5069    5068       -1     
- Partials        517     518       +1
Impacted Files Coverage Δ Complexity Δ
.../main/java/com/alibaba/csp/sentinel/Constants.java 100% <ø> (ø) 1 <0> (ø) ⬇️
...sp/sentinel/slots/statistic/data/MetricBucket.java 95.34% <100%> (ø) 23 <1> (ø) ⬇️
...ntinel/slots/block/degrade/DegradeRuleManager.java 21.87% <100%> (ø) 9 <0> (ø) ⬇️
...p/sentinel/slots/statistic/metric/ArrayMetric.java 68.62% <100%> (ø) 34 <0> (ø) ⬇️
...ba/csp/sentinel/slots/statistic/StatisticSlot.java 67.18% <33.33%> (+0.52%) 13 <0> (ø) ⬇️
...om/alibaba/csp/sentinel/config/SentinelConfig.java 56.75% <33.33%> (-0.99%) 14 <1> (ø)
.../slots/block/flow/controller/WarmUpController.java 78.84% <0%> (-3.85%) 10% <0%> (-1%)
...ava/com/alibaba/csp/sentinel/node/ClusterNode.java 96.55% <0%> (-3.45%) 10% <0%> (-1%)
...a/csp/sentinel/slots/statistic/base/LeapArray.java 72.27% <0%> (+4.95%) 35% <0%> (+2%) ⬆️

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 24f8d75...a26de6c. Read the comment docs.

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM

@sczyh30
sczyh30 merged commit c705651 into alibaba:master Nov 21, 2019
@sczyh30 sczyh30 added this to the 1.7.1 milestone Nov 21, 2019
hughpearse pushed a commit to hughpearse/Sentinel that referenced this pull request Jun 2, 2021
…icMaxRt() (alibaba#1173)

- to avoid the dependency chain: Constants -> SentinelConfig

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/enhancement Category issues or prs related to enhancement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants