...
|
...
|
@@ -382,7 +382,7 @@ public class ServiceAccessMapperImpl extends InfluxDBQuery implements ServiceAcc |
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<Map> getAlarmData(Integer costThreshold){
|
|
|
public List<Map> getAlarmData(Integer costThreshold,Integer countThreshold){
|
|
|
DateTime endDateTime = DateTime.now(DateTimeZone.UTC).minusSeconds(10);
|
|
|
DateTime startDateTime = endDateTime.minusSeconds(10);
|
|
|
String startDateStr = startDateTime.toString(DATE_TIME_FORMAT);
|
...
|
...
|
@@ -392,12 +392,12 @@ public class ServiceAccessMapperImpl extends InfluxDBQuery implements ServiceAcc |
|
|
String sql = sql1 + sql2;
|
|
|
log.info("getAlarmData sql is " + sql);
|
|
|
List<Map> list = new ArrayList<>();
|
|
|
list.addAll(getAlarmData(InfluxDBContants.AWS,sql));
|
|
|
list.addAll(getAlarmData(InfluxDBContants.Q_CLOUD,sql));
|
|
|
list.addAll(getAlarmData(InfluxDBContants.AWS,sql,countThreshold));
|
|
|
list.addAll(getAlarmData(InfluxDBContants.Q_CLOUD,sql,countThreshold));
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
private List<Map> getAlarmData(String source,String sql){
|
|
|
private List<Map> getAlarmData(String source,String sql,Integer countThreshold){
|
|
|
|
|
|
List<Map> returnList = new ArrayList<>();
|
|
|
QueryResult queryResult = query(source, sql, InfluxDBContants.YOHO_EVENT);
|
...
|
...
|
@@ -425,7 +425,7 @@ public class ServiceAccessMapperImpl extends InfluxDBQuery implements ServiceAcc |
|
|
Double mean = (Double)series2.getValues().get(0).get(2);
|
|
|
Double ratio = timeoutCount / totalCount;
|
|
|
log.info("hostAddress:" + hostAddress + ",serviceName:" + serviceName + ",timeoutCount:" + timeoutCount + ",totalCount:" + totalCount + ",ratio:" + ratio + ",mean:" + mean);
|
|
|
if(ratio >= 0.95){
|
|
|
if((ratio >= 0.95) && (totalCount > countThreshold)){
|
|
|
Map map = new HashMap();
|
|
|
map.put("hostAddress",hostAddress);
|
|
|
map.put("serviceName",serviceName);
|
...
|
...
|
|