mirror of
https://github.com/didi/KnowStreaming.git
synced 2025-12-24 03:42:07 +08:00
[Optimize] optimize zk OutstandingRequests checker’s exception log (#738)
This commit is contained in:
@@ -103,11 +103,12 @@ public class HealthCheckZookeeperService extends AbstractHealthCheckService {
|
|||||||
|
|
||||||
private HealthCheckResult checkOutstandingRequests(Tuple<ClusterParam, BaseClusterHealthConfig> singleConfigSimpleTuple) {
|
private HealthCheckResult checkOutstandingRequests(Tuple<ClusterParam, BaseClusterHealthConfig> singleConfigSimpleTuple) {
|
||||||
ZookeeperParam param = (ZookeeperParam) singleConfigSimpleTuple.getV1();
|
ZookeeperParam param = (ZookeeperParam) singleConfigSimpleTuple.getV1();
|
||||||
|
Long clusterPhyId = param.getClusterPhyId();
|
||||||
HealthAmountRatioConfig valueConfig = (HealthAmountRatioConfig) singleConfigSimpleTuple.getV2();
|
HealthAmountRatioConfig valueConfig = (HealthAmountRatioConfig) singleConfigSimpleTuple.getV2();
|
||||||
|
|
||||||
Result<ZookeeperMetrics> metricsResult = zookeeperMetricService.collectMetricsFromZookeeper(
|
Result<ZookeeperMetrics> metricsResult = zookeeperMetricService.collectMetricsFromZookeeper(
|
||||||
new ZookeeperMetricParam(
|
new ZookeeperMetricParam(
|
||||||
param.getClusterPhyId(),
|
clusterPhyId,
|
||||||
param.getZkAddressList(),
|
param.getZkAddressList(),
|
||||||
param.getZkConfig(),
|
param.getZkConfig(),
|
||||||
ZookeeperMetricVersionItems.ZOOKEEPER_METRIC_OUTSTANDING_REQUESTS
|
ZookeeperMetricVersionItems.ZOOKEEPER_METRIC_OUTSTANDING_REQUESTS
|
||||||
@@ -115,8 +116,7 @@ public class HealthCheckZookeeperService extends AbstractHealthCheckService {
|
|||||||
);
|
);
|
||||||
if (metricsResult.failed() || !metricsResult.hasData()) {
|
if (metricsResult.failed() || !metricsResult.hasData()) {
|
||||||
log.error(
|
log.error(
|
||||||
"class=HealthCheckZookeeperService||method=checkOutstandingRequests||param={}||config={}||result={}||errMsg=get metrics failed",
|
"class=HealthCheckZookeeperService||method=checkOutstandingRequests||clusterPhyId={}||param={}||config={}||result={}||errMsg=get metrics failed",clusterPhyId ,param, valueConfig, metricsResult
|
||||||
param, valueConfig, metricsResult
|
|
||||||
);
|
);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -129,9 +129,21 @@ public class HealthCheckZookeeperService extends AbstractHealthCheckService {
|
|||||||
);
|
);
|
||||||
|
|
||||||
Float value = metricsResult.getData().getMetric(ZookeeperMetricVersionItems.ZOOKEEPER_METRIC_OUTSTANDING_REQUESTS);
|
Float value = metricsResult.getData().getMetric(ZookeeperMetricVersionItems.ZOOKEEPER_METRIC_OUTSTANDING_REQUESTS);
|
||||||
|
if(null == value){
|
||||||
|
log.error("class=HealthCheckZookeeperService||method=checkOutstandingRequests||clusterPhyId={}|| errMsg=get OutstandingRequests metric failed, may be collect failed or zk mntr command not in whitelist.", clusterPhyId);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Integer amount = valueConfig.getAmount();
|
||||||
|
Double ratio = valueConfig.getRatio();
|
||||||
|
if (null == amount || null == ratio) {
|
||||||
|
log.error("class=HealthCheckZookeeperService||method=checkOutstandingRequests||clusterPhyId={}||result={}||errMsg=get valueConfig amount/ratio config failed", clusterPhyId,valueConfig);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
double configValue = amount.doubleValue() * ratio;
|
||||||
|
|
||||||
checkResult.setPassed(value.intValue() <= valueConfig.getAmount().doubleValue() * valueConfig.getRatio().doubleValue() ? Constant.YES : Constant.NO);
|
checkResult.setPassed(value.doubleValue() <= configValue ? Constant.YES : Constant.NO);
|
||||||
|
|
||||||
return checkResult;
|
return checkResult;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user