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

Make the default max RT value TIME_DROP_VALVE configurable #292

Merged

Conversation

cdfive
Copy link
Collaborator

@cdfive cdfive commented Dec 9, 2018

Describe what this PR does / why we need it

根据应用实际RT情况以及监控数据准确性需求,让MAX RT(即TIME_DROP_VALUE)可配置。

Does this pull request fix one issue?

Fixes #276

Describe how you did it

在SentinelConfig中增加了1个参数配置项csp.sentinel.statistic.max.rt,增加默认值和读取方法

Describe how to verify it

add unit test

Special notes for reviews

1.把CHARSET、COLD_FACTOR的默认值也修改为用常量定义(感觉这样看着一致些);
2.读取某个特定参数值方法catch里RecordLog.info改为了warn(因为在catch里打印);
3.cold_factor之前在ColdFactorProperty类读取的,因为默认值在SentinelConfig定义,
改为了用SentinelConfig.coldFactor()读取,其中:
if (coldFactor <= 1) {
coldFactor = 3;
RecordLog.info("cold factor should be larger than 3");
}
判断的是<=1,打印的却是大于3,信息不一致;
这段放到了SentinelConfig.coldFactor()方法里,
判断<=1没变,把信息内容改了下;
4.Constants中的TIME_DROP_VALVE,final修饰去掉了
跟下面那个ON开关一样,便于运行时可以修改,比如以后考虑通过CommandHandler方式。

@codecov-io
Copy link

codecov-io commented Dec 9, 2018

Codecov Report

Merging #292 into master will increase coverage by 7.59%.
The diff coverage is 68.42%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #292      +/-   ##
============================================
+ Coverage     38.25%   45.85%   +7.59%     
+ Complexity      937      921      -16     
============================================
  Files           218      181      -37     
  Lines          6966     5749    -1217     
  Branches        948      829     -119     
============================================
- Hits           2665     2636      -29     
+ Misses         3964     2780    -1184     
+ Partials        337      333       -4
Impacted Files Coverage Δ Complexity Δ
.../sentinel/slots/block/flow/ColdFactorProperty.java 0% <0%> (ø) 0 <0> (ø) ⬇️
.../main/java/com/alibaba/csp/sentinel/Constants.java 85.71% <100%> (+2.38%) 1 <0> (ø) ⬇️
...om/alibaba/csp/sentinel/config/SentinelConfig.java 56.71% <70.58%> (+5.89%) 13 <4> (+3) ⬆️
...aba/csp/sentinel/adapter/servlet/CommonFilter.java 66.66% <0%> (-7.76%) 6% <0%> (-3%)
...a/csp/sentinel/slots/statistic/base/LeapArray.java 61.42% <0%> (-6.93%) 18% <0%> (-6%)
...java/com/alibaba/csp/sentinel/util/AssertUtil.java 8.33% <0%> (-5%) 1% <0%> (-1%)
...ntinel/slots/block/flow/param/ParameterMetric.java 23.33% <0%> (-4.61%) 7% <0%> (-1%)
...alibaba/csp/sentinel/node/metric/MetricWriter.java 56.79% <0%> (-1.79%) 19% <0%> (-2%)
.../slots/statistic/metric/HotParameterLeapArray.java 81.39% <0%> (-1.54%) 11% <0%> (ø)
...k/flow/controller/WarmUpRateLimiterController.java 68.75% <0%> (-0.95%) 4% <0%> (-1%)
... and 105 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 f046194...d339049. Read the comment docs.

@sczyh30 sczyh30 added the to-review To review label Dec 9, 2018
@cdfive cdfive force-pushed the enhancement/time-drop-value-configurable branch from 42b48ce to d339049 Compare December 25, 2018 05:48
Copy link
Member

@sczyh30 sczyh30 left a comment

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 4440918 into alibaba:master Dec 29, 2018
@sczyh30
Copy link
Member

sczyh30 commented Dec 29, 2018

Cool! Thanks for contributing!

@sczyh30 sczyh30 added this to the 1.4.1 milestone Dec 29, 2018
@sczyh30 sczyh30 removed the to-review To review label Jan 4, 2019
CST11021 pushed a commit to CST11021/Sentinel that referenced this pull request Nov 3, 2021
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.

Make the default max RT value TIME_DROP_VALVE configurable
3 participants