Authored by FengRuwei

update

... ... @@ -23,7 +23,7 @@ public class JavaApiStaticsMapper implements IJavaApiStaticsMapper {
BatchPoints batchPoints = BatchPoints
.database(InfluxDBContants.YOHO_ALARM).retentionPolicy("default")
.database(InfluxDBContants.APP_ALARM).retentionPolicy("default")
.build();
Point point = Point.measurement(InfluxDBContants.YOMO_TB_JAVAAPI)
.addField("java_api_info", statics.get("javaApiInfo").toString())
... ... @@ -31,10 +31,8 @@ public class JavaApiStaticsMapper implements IJavaApiStaticsMapper {
.addField("start", statics.getLongValue("start"))
.addField("end", statics.getLongValue("end")).build();
batchPoints.point(point);
if (influxDBName == null) {
influxDBName = inluxDBSingle.getDBNames().get(0);
}
inluxDBSingle.getInfluxDBByName(influxDBName).getInfluxDB()
inluxDBSingle.getInfluxDBByName(InfluxDBContants.AWS).getInfluxDB()
.write(batchPoints);
... ...
... ... @@ -46,15 +46,15 @@ public class JavaApiTask implements Callable<JavaApiStatics> {
if (javaApiInfo.getApiReqMethod() == 0) {
jsonRep = restTemplate.getForObject(url, JSONObject.class);
} else {
JSONObject req = null;
JSONObject req = JSONObject.parse(javaApiInfo.getApiData(),JSONObject.class);
jsonRep = restTemplate.postForObject(url, req, JSONObject.class);
}
} catch (Exception e) {
log.warn("exception {} ",url);
log.warn("exception {} ", url);
apiStatics.setHasException(true);
apiStatics.setException(e);
}finally {
} finally {
apiStatics.setEndTime(System.currentTimeMillis());
apiStatics.setResponse(jsonRep);
}
... ... @@ -72,7 +72,14 @@ public class JavaApiTask implements Callable<JavaApiStatics> {
log.warn("get url failed has null prop. ");
return null;
}
String url = "http://" + mObjectInfo.getMoHostIp() + ":" + mObjectInfo.getMoTags() + "/" + javaApiInfo.getApiUrl();
String url = "http://" + mObjectInfo.getMoHostIp();
if (mObjectInfo.getMoTags() != null && !mObjectInfo.getMoTags().equals("")) {
url += ":" + mObjectInfo.getMoTags();
}
url += "/" + javaApiInfo.getApiUrl();
return url;
}
}
... ...