...
|
...
|
@@ -5,6 +5,7 @@ import com.monitor.common.contants.InfluxDBContants; |
|
|
import com.monitor.influxdb.InluxDBSingle;
|
|
|
import com.monitor.influxdb.mapper.IJavaApiStaticsMapper;
|
|
|
import com.monitor.model.domain.JavaApiStaticsModel;
|
|
|
import com.monitor.model.request.JavaApiStatusReq;
|
|
|
import org.influxdb.dto.BatchPoints;
|
|
|
import org.influxdb.dto.Point;
|
|
|
import org.influxdb.dto.Query;
|
...
|
...
|
@@ -68,12 +69,12 @@ public class JavaApiStaticsMapper implements IJavaApiStaticsMapper { |
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public JavaApiStaticsModel selectlatestJavaApiStatics(String influxDBName, Map<String, Integer> param) {
|
|
|
int api_id = param.get("api_id");
|
|
|
int mobj_id = param.get("mobj_id");
|
|
|
public JavaApiStaticsModel selectlatestJavaApiStatics(String influxDBName, JavaApiStatusReq param) {
|
|
|
int api_id = param.getServiceId();
|
|
|
int mobj_id = param.getMObjectId();
|
|
|
String sql = "select * from " + InfluxDBContants.YOMO_TB_JAVAAPI + " where time > now() - 1h ";
|
|
|
sql += " and api_id=" + param.get("api_id");
|
|
|
sql += " and mobj_id=" + param.get("mobj_id");
|
|
|
sql += " and api_id=" + api_id;
|
|
|
sql += " and mobj_id=" + mobj_id;
|
|
|
sql += " order by time desc limit 1";
|
|
|
Query query = new Query(sql, InfluxDBContants.APP_ALARM);
|
|
|
|
...
|
...
|
@@ -89,14 +90,14 @@ public class JavaApiStaticsMapper implements IJavaApiStaticsMapper { |
|
|
try {
|
|
|
QueryResult.Series series = rel.getSeries().get(0);
|
|
|
|
|
|
Boolean status = (Boolean) series.getValues().get(0).get(series.getColumns().indexOf("is_exception"));
|
|
|
Boolean is_exception = (Boolean) series.getValues().get(0).get(series.getColumns().indexOf("is_exception"));
|
|
|
|
|
|
if (status == true) {
|
|
|
javaApiStaticsModel.setStatus(1);
|
|
|
} else
|
|
|
if (is_exception == true) {
|
|
|
javaApiStaticsModel.setStatus(0);
|
|
|
} else
|
|
|
javaApiStaticsModel.setStatus(1);
|
|
|
|
|
|
}catch (Exception e){
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
return javaApiStaticsModel;
|
...
|
...
|
@@ -104,15 +105,14 @@ public class JavaApiStaticsMapper implements IJavaApiStaticsMapper { |
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
public List<JavaApiStaticsModel> selectlatestJavaApiStaticsList(String influxDBName, List<Map<String, Integer>> paramList) {
|
|
|
public List<JavaApiStaticsModel> selectlatestJavaApiStaticsList(String influxDBName, List<JavaApiStatusReq> paramList) {
|
|
|
|
|
|
//TODO 后期改批量查询
|
|
|
|
|
|
List<JavaApiStaticsModel> javaApiStaticsModels = new ArrayList<>();
|
|
|
|
|
|
for (Map<String, Integer> param : paramList) {
|
|
|
for (JavaApiStatusReq param : paramList) {
|
|
|
JavaApiStaticsModel model = selectlatestJavaApiStatics(influxDBName, param);
|
|
|
javaApiStaticsModels.add(model);
|
|
|
}
|
...
|
...
|
|