use of com.sohu.cache.web.vo.AppDetailVO in project cachecloud by sohutv.
the class AppClientConnInspector method inspect.
@Override
public boolean inspect(Map<InspectParamEnum, Object> paramMap) {
Long appId = MapUtils.getLong(paramMap, InspectParamEnum.SPLIT_KEY);
AppDetailVO appDetailVO = appStatsCenter.getAppDetail(appId);
if (appDetailVO == null) {
logger.warn("appId {} appDetailVO is empty", appId);
return true;
}
List<InstanceInfo> appInstanceInfoList = (List<InstanceInfo>) paramMap.get(InspectParamEnum.INSTANCE_LIST);
if (CollectionUtils.isEmpty(appInstanceInfoList)) {
logger.warn("appId {} instanceList is empty", appId);
return true;
}
// 报警阀值
int appClientConnThreshold = getClientConnThreshold(appDetailVO.getAppDesc());
int appClientConnNum = appDetailVO.getConn();
// 阀值乘以分片个数
int instanceCount = appInstanceInfoList.size();
if (appClientConnNum > appClientConnThreshold * instanceCount) {
alertAppClientConn(appDetailVO, appClientConnThreshold, instanceCount);
} else {
for (InstanceInfo instanceInfo : appInstanceInfoList) {
if (instanceInfo == null) {
continue;
}
if (instanceInfo.isOffline()) {
continue;
}
if (!TypeUtil.isRedisType(instanceInfo.getType())) {
continue;
}
// 忽略sentinel观察者
if (TypeUtil.isRedisSentinel(instanceInfo.getType())) {
continue;
}
long instanceId = instanceInfo.getId();
InstanceStats instanceStats = instanceStatsCenter.getInstanceStats(instanceId);
if (instanceStats == null) {
continue;
}
double instanceClientConnNum = instanceStats.getCurrConnections();
// 大于标准值
if (instanceClientConnNum > appClientConnThreshold) {
alertInstanceClientConn(instanceStats, appDetailVO, appClientConnThreshold);
}
}
}
return true;
}
use of com.sohu.cache.web.vo.AppDetailVO in project cachecloud by sohutv.
the class AppStatsCenterImplTest method getAppDetail.
@Test
public void getAppDetail() {
long appId = 10015L;
long begin = System.currentTimeMillis();
AppDetailVO resultVO = appStatsCenter.getAppDetail(appId);
logger.info("cost=" + (System.currentTimeMillis() - begin));
logger.info("result={}", resultVO);
}
Aggregations