...
|
...
|
@@ -40,6 +40,7 @@ public class ServiceAccessMapperImpl extends InfluxDBQuery implements ServiceAcc |
|
|
}else{
|
|
|
sql = String.format("select count(cost),mean(cost),sum(cost) from service_access where context = '%s' and time > '%s' and time < '%s' group by hostAddress",req.getServiceName(),req.getStartTime(),req.getEndTime());
|
|
|
}
|
|
|
log.info("getBaseDataByContext sql:" + sql);
|
|
|
|
|
|
map.putAll(getDataByContext(InfluxDBContants.AWS,sql));
|
|
|
map.putAll(getDataByContext(InfluxDBContants.Q_CLOUD,sql));
|
...
|
...
|
@@ -77,6 +78,7 @@ public class ServiceAccessMapperImpl extends InfluxDBQuery implements ServiceAcc |
|
|
}else{
|
|
|
sql = String.format("select count(cost) from service_access where context='%s' and cost > 200 and time > '%s' and time < '%s' group by hostAddress",req.getServiceName(),req.getStartTime(),req.getEndTime());
|
|
|
}
|
|
|
log.info("getTimeoutCount sql:" + sql);
|
|
|
|
|
|
map.putAll(getTimeoutCount(InfluxDBContants.AWS,sql));
|
|
|
map.putAll(getTimeoutCount(InfluxDBContants.Q_CLOUD,sql));
|
...
|
...
|
@@ -106,6 +108,7 @@ public class ServiceAccessMapperImpl extends InfluxDBQuery implements ServiceAcc |
|
|
public Map<String,List> getJavaApiGraphByServiceType(String context){
|
|
|
Map<String,List> map = new HashMap();
|
|
|
String sql = String.format("SELECT mean(cost) FROM service_access WHERE time > now() - 10m and context = '%s' GROUP BY hostAddress,time(1m) fill(null)",context);
|
|
|
log.info("getJavaApiGraphByServiceType sql:" + sql);
|
|
|
map.putAll(getJavaApiGraphByServiceType(InfluxDBContants.AWS,sql));
|
|
|
map.putAll(getJavaApiGraphByServiceType(InfluxDBContants.Q_CLOUD,sql));
|
|
|
return map;
|
...
|
...
|
@@ -158,6 +161,7 @@ public class ServiceAccessMapperImpl extends InfluxDBQuery implements ServiceAcc |
|
|
@Override
|
|
|
public Map<String,List> getServiceNameJavaApiGraph(String source){
|
|
|
String sql = String.format("SELECT mean(cost) FROM service_access WHERE %s and time > now() - 10m GROUP BY context,time(1m) fill(null)",contextFilter);
|
|
|
log.info("getServiceNameJavaApiGraph sql:" + sql);
|
|
|
Map<String,List> resultMap = new HashMap<>();
|
|
|
|
|
|
QueryResult queryResult = query(source, sql, InfluxDBContants.YOHO_EVENT);
|
...
|
...
|
@@ -221,7 +225,7 @@ public class ServiceAccessMapperImpl extends InfluxDBQuery implements ServiceAcc |
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
log.info("getDataByContextAndIP sql:" + sql);
|
|
|
QueryResult queryResult = query(source, sql, InfluxDBContants.YOHO_EVENT);
|
|
|
QueryResult.Result rel = queryResult.getResults().get(0);
|
|
|
List<QueryResult.Series> listSeries = rel.getSeries();
|
...
|
...
|
@@ -268,6 +272,7 @@ public class ServiceAccessMapperImpl extends InfluxDBQuery implements ServiceAcc |
|
|
sql = String.format("select count(cost) from service_access where context='%s' and cost > 200 and time > '%s' and time < '%s' group by event", req.getServiceName(), req.getStartTime(), req.getEndTime());
|
|
|
}
|
|
|
}
|
|
|
log.info("getTimeoutCountByContextAndIp sql:" + sql);
|
|
|
|
|
|
return getTimeoutCountByContextAndIp(source,sql);
|
|
|
}
|
...
|
...
|
@@ -295,7 +300,7 @@ public class ServiceAccessMapperImpl extends InfluxDBQuery implements ServiceAcc |
|
|
|
|
|
Map<String,NewJavaApiInfoRep> map = new HashMap<>();
|
|
|
String sql = String.format("select count(cost),mean(cost),sum(cost) as sum from service_access where context = '%s' and event = '%s' and time > '%s' and time < '%s' group by hostAddress",req.getServiceName(),req.getApiName(),req.getStartTime(),req.getEndTime());
|
|
|
|
|
|
log.info("getDataByContextAndApiName sql:" + sql);
|
|
|
map.putAll(getDataByContext(InfluxDBContants.AWS,sql));
|
|
|
map.putAll(getDataByContext(InfluxDBContants.Q_CLOUD,sql));
|
|
|
return map;
|
...
|
...
|
@@ -309,6 +314,7 @@ public class ServiceAccessMapperImpl extends InfluxDBQuery implements ServiceAcc |
|
|
public Map<String,Integer> getTimeoutCountByContextAndApiName(NewJavaApiInfoReq req) {
|
|
|
Map<String,Integer> map = new HashMap();
|
|
|
String sql = String.format("select count(cost) from service_access where context='%s' and event = '%s' and cost > 200 and time > '%s' and time < '%s' group by hostAddress",req.getServiceName(),req.getApiName(),req.getStartTime(),req.getEndTime());
|
|
|
log.info("getTimeoutCountByContextAndApiName sql:" + sql);
|
|
|
map.putAll(getTimeoutCount(InfluxDBContants.AWS,sql));
|
|
|
map.putAll(getTimeoutCount(InfluxDBContants.Q_CLOUD,sql));
|
|
|
return map;
|
...
|
...
|
@@ -324,6 +330,7 @@ public class ServiceAccessMapperImpl extends InfluxDBQuery implements ServiceAcc |
|
|
sql = String.format("select stack from service_access where context='%s' and hostAddress = '%s' and cost > 200 and time > '%s' and time < '%s' order by time desc limit 50",req.getServiceName(),req.getIp(),req.getStartTime(),req.getEndTime());
|
|
|
|
|
|
}
|
|
|
log.info("queryTimeoutInfoListByIp sql:" + sql);
|
|
|
String source = "";
|
|
|
if(req.getCloudType()==2){
|
|
|
source = InfluxDBContants.Q_CLOUD;
|
...
|
...
|
@@ -350,6 +357,8 @@ public class ServiceAccessMapperImpl extends InfluxDBQuery implements ServiceAcc |
|
|
sql = String.format("select stack from service_access where context='%s' and cost > 200 and time > '%s' and time < '%s' and event = '%s' order by time desc limit 50", req.getServiceName(), req.getStartTime(), req.getEndTime(),req.getApiName());
|
|
|
}
|
|
|
|
|
|
log.info("queryTimeoutInfoListByApiName sql:" + sql);
|
|
|
|
|
|
return getTimeoutInfo(source,sql);
|
|
|
}
|
|
|
|
...
|
...
|
|