Authored by FengRuwei

update

@@ -23,7 +23,7 @@ public class JavaApiStaticsMapper implements IJavaApiStaticsMapper { @@ -23,7 +23,7 @@ public class JavaApiStaticsMapper implements IJavaApiStaticsMapper {
23 23
24 24
25 BatchPoints batchPoints = BatchPoints 25 BatchPoints batchPoints = BatchPoints
26 - .database(InfluxDBContants.YOHO_ALARM).retentionPolicy("default") 26 + .database(InfluxDBContants.APP_ALARM).retentionPolicy("default")
27 .build(); 27 .build();
28 Point point = Point.measurement(InfluxDBContants.YOMO_TB_JAVAAPI) 28 Point point = Point.measurement(InfluxDBContants.YOMO_TB_JAVAAPI)
29 .addField("java_api_info", statics.get("javaApiInfo").toString()) 29 .addField("java_api_info", statics.get("javaApiInfo").toString())
@@ -31,10 +31,8 @@ public class JavaApiStaticsMapper implements IJavaApiStaticsMapper { @@ -31,10 +31,8 @@ public class JavaApiStaticsMapper implements IJavaApiStaticsMapper {
31 .addField("start", statics.getLongValue("start")) 31 .addField("start", statics.getLongValue("start"))
32 .addField("end", statics.getLongValue("end")).build(); 32 .addField("end", statics.getLongValue("end")).build();
33 batchPoints.point(point); 33 batchPoints.point(point);
34 - if (influxDBName == null) {  
35 - influxDBName = inluxDBSingle.getDBNames().get(0);  
36 - }  
37 - inluxDBSingle.getInfluxDBByName(influxDBName).getInfluxDB() 34 +
  35 + inluxDBSingle.getInfluxDBByName(InfluxDBContants.AWS).getInfluxDB()
38 .write(batchPoints); 36 .write(batchPoints);
39 37
40 38
@@ -46,15 +46,15 @@ public class JavaApiTask implements Callable<JavaApiStatics> { @@ -46,15 +46,15 @@ public class JavaApiTask implements Callable<JavaApiStatics> {
46 if (javaApiInfo.getApiReqMethod() == 0) { 46 if (javaApiInfo.getApiReqMethod() == 0) {
47 jsonRep = restTemplate.getForObject(url, JSONObject.class); 47 jsonRep = restTemplate.getForObject(url, JSONObject.class);
48 } else { 48 } else {
49 - JSONObject req = null; 49 + JSONObject req = JSONObject.parse(javaApiInfo.getApiData(),JSONObject.class);
50 jsonRep = restTemplate.postForObject(url, req, JSONObject.class); 50 jsonRep = restTemplate.postForObject(url, req, JSONObject.class);
51 51
52 } 52 }
53 } catch (Exception e) { 53 } catch (Exception e) {
54 - log.warn("exception {} ",url); 54 + log.warn("exception {} ", url);
55 apiStatics.setHasException(true); 55 apiStatics.setHasException(true);
56 apiStatics.setException(e); 56 apiStatics.setException(e);
57 - }finally { 57 + } finally {
58 apiStatics.setEndTime(System.currentTimeMillis()); 58 apiStatics.setEndTime(System.currentTimeMillis());
59 apiStatics.setResponse(jsonRep); 59 apiStatics.setResponse(jsonRep);
60 } 60 }
@@ -72,7 +72,14 @@ public class JavaApiTask implements Callable<JavaApiStatics> { @@ -72,7 +72,14 @@ public class JavaApiTask implements Callable<JavaApiStatics> {
72 log.warn("get url failed has null prop. "); 72 log.warn("get url failed has null prop. ");
73 return null; 73 return null;
74 } 74 }
75 - String url = "http://" + mObjectInfo.getMoHostIp() + ":" + mObjectInfo.getMoTags() + "/" + javaApiInfo.getApiUrl(); 75 +
  76 + String url = "http://" + mObjectInfo.getMoHostIp();
  77 + if (mObjectInfo.getMoTags() != null && !mObjectInfo.getMoTags().equals("")) {
  78 + url += ":" + mObjectInfo.getMoTags();
  79 + }
  80 +
  81 + url += "/" + javaApiInfo.getApiUrl();
  82 +
76 return url; 83 return url;
77 } 84 }
78 } 85 }