Make the default max RT value TIME_DROP_VALVE configurable #292
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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方式。