...
|
...
|
@@ -58,8 +58,8 @@ public class JavaApiStaticsMapper implements IJavaApiStaticsMapper { |
|
|
.addField("mobj_ip", statics.getString("mobj_ip"))
|
|
|
.addField("mobj_id", statics.getIntValue("mobj_id"))
|
|
|
.addField("mobj_port", statics.getString("mobj_port"))
|
|
|
.addField("start", statics.getLongValue("start"))
|
|
|
.addField("end", statics.getLongValue("end"))
|
|
|
.addField("start_time", statics.getLongValue("start"))
|
|
|
.addField("end_time", statics.getLongValue("end"))
|
|
|
.addField("is_exception", statics.getBooleanValue("is_exception"))
|
|
|
.time(System.currentTimeMillis() * 1000000 + random.nextInt(999999), TimeUnit.NANOSECONDS);
|
|
|
|
...
|
...
|
@@ -101,8 +101,8 @@ public class JavaApiStaticsMapper implements IJavaApiStaticsMapper { |
|
|
QueryResult.Series series = rel.getSeries().get(0);
|
|
|
|
|
|
Boolean is_exception = (Boolean) series.getValues().get(0).get(series.getColumns().indexOf("is_exception"));
|
|
|
long startTime = Math.round((Double) series.getValues().get(0).get(series.getColumns().indexOf("start")));
|
|
|
long endTime = Math.round((Double) series.getValues().get(0).get(series.getColumns().indexOf("end")));
|
|
|
long startTime = Math.round((Double) series.getValues().get(0).get(series.getColumns().indexOf("start_time")));
|
|
|
long endTime = Math.round((Double) series.getValues().get(0).get(series.getColumns().indexOf("end_time")));
|
|
|
long costTime = (endTime - startTime);
|
|
|
|
|
|
String exception = (String) series.getValues().get(0).get(series.getColumns().indexOf("exception"));
|
...
|
...
|
@@ -126,28 +126,26 @@ public class JavaApiStaticsMapper implements IJavaApiStaticsMapper { |
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 批量查询
|
|
|
*
|
|
|
* @param influxDBName
|
|
|
* @param paramList
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
public List<JavaApiStaticsModel> selectlatestJavaApiStaticsList(String influxDBName, List<JavaApiStatusReq> paramList) {
|
|
|
|
|
|
//TODO 后期改批量查询
|
|
|
|
|
|
List<JavaApiStaticsModel> javaApiStaticsModels = new ArrayList<JavaApiStaticsModel>();
|
|
|
|
|
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
|
for (JavaApiStatusReq param : paramList) {
|
|
|
|
|
|
int api_id = param.getServiceId();
|
|
|
int mobj_id = param.getMObjectId();
|
|
|
sb.append("select * from " + InfluxDBContants.YOMO_TB_JAVAAPI + " where time > now() - 1h ");
|
|
|
sb.append("select api_id,mobj_id,start_time,end_time,is_exception,exception from " + InfluxDBContants.YOMO_TB_JAVAAPI + " where time > now() - 1h ");
|
|
|
sb.append(" and api_id=" + api_id);
|
|
|
sb.append(" and mobj_id=" + mobj_id);
|
|
|
sb.append(" order by time desc limit 1;");
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
Query query = new Query(sb.toString(), InfluxDBContants.APP_ALARM);
|
|
|
|
|
|
QueryResult result = inluxDBSingle.getInfluxDBByName(InfluxDBContants.ALARM).getInfluxDB().query(query);
|
...
|
...
|
@@ -159,8 +157,8 @@ public class JavaApiStaticsMapper implements IJavaApiStaticsMapper { |
|
|
QueryResult.Series series = queryResult.getSeries().get(0);
|
|
|
|
|
|
Boolean is_exception = (Boolean) series.getValues().get(0).get(series.getColumns().indexOf("is_exception"));
|
|
|
long startTime = Math.round((Double) series.getValues().get(0).get(series.getColumns().indexOf("start")));
|
|
|
long endTime = Math.round((Double) series.getValues().get(0).get(series.getColumns().indexOf("end")));
|
|
|
long startTime = Math.round((Double) series.getValues().get(0).get(series.getColumns().indexOf("start_time")));
|
|
|
long endTime = Math.round((Double) series.getValues().get(0).get(series.getColumns().indexOf("end_time")));
|
|
|
long costTime = (endTime - startTime);
|
|
|
|
|
|
int api_id = ((Double) series.getValues().get(0).get(series.getColumns().indexOf("api_id"))).intValue();
|
...
|
...
|
@@ -242,8 +240,8 @@ public class JavaApiStaticsMapper implements IJavaApiStaticsMapper { |
|
|
for (int i = 0; i < size; i++) {
|
|
|
JavaApiStaticsModel javaApiStaticsModel = new JavaApiStaticsModel();
|
|
|
Boolean is_exception = (Boolean) series.getValues().get(i).get(series.getColumns().indexOf("is_exception"));
|
|
|
long startTime = Math.round((Double) series.getValues().get(i).get(series.getColumns().indexOf("start")));
|
|
|
long endTime = Math.round((Double) series.getValues().get(i).get(series.getColumns().indexOf("end")));
|
|
|
long startTime = Math.round((Double) series.getValues().get(i).get(series.getColumns().indexOf("start_time")));
|
|
|
long endTime = Math.round((Double) series.getValues().get(i).get(series.getColumns().indexOf("end_time")));
|
|
|
long costTime = (endTime - startTime);
|
|
|
|
|
|
|
...
|
...
|
|