Showing
8 changed files
with
215 additions
and
40 deletions
@@ -11,13 +11,17 @@ import java.util.Map; | @@ -11,13 +11,17 @@ import java.util.Map; | ||
11 | * Created by yoho on 2016/10/20. | 11 | * Created by yoho on 2016/10/20. |
12 | */ | 12 | */ |
13 | public interface ServiceAccessMapper { | 13 | public interface ServiceAccessMapper { |
14 | - Map<String,NewJavaApiInfoRep> getBaseDataByContext(String context,String startDateStr,String endDateStr); | 14 | + Map<String,NewJavaApiInfoRep> getBaseDataByContext(NewJavaApiInfoReq req); |
15 | 15 | ||
16 | - Map<String,List<String>> getTimeoutInfo(String context, String startDateStr, String endDateStr); | 16 | + Map<String,List<String>> getTimeoutInfo(NewJavaApiInfoReq req); |
17 | 17 | ||
18 | Map<String,List> getGraphInfo(String context); | 18 | Map<String,List> getGraphInfo(String context); |
19 | 19 | ||
20 | List<NewJavaApiDetailInfoRep> getDataByContextAndIP(NewJavaApiInfoReq req); | 20 | List<NewJavaApiDetailInfoRep> getDataByContextAndIP(NewJavaApiInfoReq req); |
21 | 21 | ||
22 | Map<String,List<String>> getTimeoutInfoByContextAndIp(NewJavaApiInfoReq req); | 22 | Map<String,List<String>> getTimeoutInfoByContextAndIp(NewJavaApiInfoReq req); |
23 | + | ||
24 | + Map<String,NewJavaApiInfoRep> getDataByContextAndApiName(NewJavaApiInfoReq req); | ||
25 | + | ||
26 | + Map<String,List<String>> getTimeoutInfoByContextAndApiName(NewJavaApiInfoReq req); | ||
23 | } | 27 | } |
monitor-service-influxdb/src/main/java/com/monitor/influxdb/mapper/ServiceServerExceptionMapper.java
@@ -9,9 +9,12 @@ import java.util.Map; | @@ -9,9 +9,12 @@ import java.util.Map; | ||
9 | * Created by yoho on 2016/10/20. | 9 | * Created by yoho on 2016/10/20. |
10 | */ | 10 | */ |
11 | public interface ServiceServerExceptionMapper { | 11 | public interface ServiceServerExceptionMapper { |
12 | - Map<String,List<String>> getErrorDataByContext(String context,String startDateStr,String endDateStr); | 12 | + Map<String,List<String>> getErrorDataByContext(NewJavaApiInfoReq req); |
13 | 13 | ||
14 | Map<String,List> getGraphInfo(String context); | 14 | Map<String,List> getGraphInfo(String context); |
15 | 15 | ||
16 | Map<String,List<String>> getErrorDataByContextAndIp(NewJavaApiInfoReq req); | 16 | Map<String,List<String>> getErrorDataByContextAndIp(NewJavaApiInfoReq req); |
17 | + | ||
18 | + //根据context获取错误信息列表 | ||
19 | + Map<String,List<String>> getErrorDataByContextAndApiName(NewJavaApiInfoReq req); | ||
17 | } | 20 | } |
monitor-service-influxdb/src/main/java/com/monitor/influxdb/mapper/impl/ServiceAccessMapperImpl.java
@@ -22,16 +22,13 @@ import java.util.*; | @@ -22,16 +22,13 @@ import java.util.*; | ||
22 | */ | 22 | */ |
23 | @Component | 23 | @Component |
24 | public class ServiceAccessMapperImpl extends InfluxDBQuery implements ServiceAccessMapper { | 24 | public class ServiceAccessMapperImpl extends InfluxDBQuery implements ServiceAccessMapper { |
25 | - Logger log = LoggerFactory.getLogger(ServiceAccessMapperImpl.class); | ||
26 | - | ||
27 | 25 | ||
28 | //根据context获取总响应次数和平均耗时 | 26 | //根据context获取总响应次数和平均耗时 |
29 | @Override | 27 | @Override |
30 | - public Map<String,NewJavaApiInfoRep> getBaseDataByContext(String context,String startDateStr,String endDateStr) { | 28 | + public Map<String,NewJavaApiInfoRep> getBaseDataByContext(NewJavaApiInfoReq req) { |
31 | 29 | ||
32 | Map<String,NewJavaApiInfoRep> map = new HashMap<>(); | 30 | Map<String,NewJavaApiInfoRep> map = new HashMap<>(); |
33 | - String sql = String.format("select count(cost),mean(cost) from service_access where context = '%s' and time > '%s' and time < '%s' group by hostAddress",context,startDateStr,endDateStr); | ||
34 | -// String sql = "select count(cost),mean(cost) from service_access group by hostAddress"; | 31 | + String sql = String.format("select count(cost),mean(cost) from service_access where context = '%s' and time > '%s' and time < '%s' group by hostAddress",req.getServiceName(),req.getStartTime(),req.getEndTime()); |
35 | 32 | ||
36 | map.putAll(getDataByContext(InfluxDBContants.AWS,sql)); | 33 | map.putAll(getDataByContext(InfluxDBContants.AWS,sql)); |
37 | map.putAll(getDataByContext(InfluxDBContants.Q_CLOUD,sql)); | 34 | map.putAll(getDataByContext(InfluxDBContants.Q_CLOUD,sql)); |
@@ -61,10 +58,9 @@ public class ServiceAccessMapperImpl extends InfluxDBQuery implements ServiceAcc | @@ -61,10 +58,9 @@ public class ServiceAccessMapperImpl extends InfluxDBQuery implements ServiceAcc | ||
61 | 58 | ||
62 | 59 | ||
63 | @Override | 60 | @Override |
64 | - public Map<String,List<String>> getTimeoutInfo(String context, String startDateStr, String endDateStr) { | 61 | + public Map<String,List<String>> getTimeoutInfo(NewJavaApiInfoReq req) { |
65 | Map<String,List<String>> map = new HashMap(); | 62 | Map<String,List<String>> map = new HashMap(); |
66 | - String sql = String.format("select ip,stack from service_access where context='%s' and cost > 200 and time > '%s' and time < '%s'",context,startDateStr,endDateStr); | ||
67 | -// String sql = "select ip,stack from service_access where context='gateway' and cost > 200"; | 63 | + String sql = String.format("select ip,stack from service_access where context='%s' and cost > 200 and time > '%s' and time < '%s'",req.getServiceName(),req.getStartTime(),req.getEndTime()); |
68 | map.putAll(getTimeoutInfo(InfluxDBContants.AWS,sql)); | 64 | map.putAll(getTimeoutInfo(InfluxDBContants.AWS,sql)); |
69 | map.putAll(getTimeoutInfo(InfluxDBContants.Q_CLOUD,sql)); | 65 | map.putAll(getTimeoutInfo(InfluxDBContants.Q_CLOUD,sql)); |
70 | return map; | 66 | return map; |
@@ -103,7 +99,6 @@ public class ServiceAccessMapperImpl extends InfluxDBQuery implements ServiceAcc | @@ -103,7 +99,6 @@ public class ServiceAccessMapperImpl extends InfluxDBQuery implements ServiceAcc | ||
103 | public Map<String,List> getGraphInfo(String context){ | 99 | public Map<String,List> getGraphInfo(String context){ |
104 | Map<String,List> map = new HashMap(); | 100 | Map<String,List> map = new HashMap(); |
105 | 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); | 101 | 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); |
106 | -// String sql = "select mean(cost) from service_access where time > '2016-10-20 02:25:00' and time < '2016-10-20 02:51:00' and context = 'gateway' GROUP BY hostAddress,time(1m) fill(null)"; | ||
107 | map.putAll(getGraphInfo(InfluxDBContants.AWS,sql)); | 102 | map.putAll(getGraphInfo(InfluxDBContants.AWS,sql)); |
108 | map.putAll(getGraphInfo(InfluxDBContants.Q_CLOUD,sql)); | 103 | map.putAll(getGraphInfo(InfluxDBContants.Q_CLOUD,sql)); |
109 | return map; | 104 | return map; |
@@ -167,9 +162,9 @@ public class ServiceAccessMapperImpl extends InfluxDBQuery implements ServiceAcc | @@ -167,9 +162,9 @@ public class ServiceAccessMapperImpl extends InfluxDBQuery implements ServiceAcc | ||
167 | } | 162 | } |
168 | 163 | ||
169 | if(StringUtils.isNotBlank(req.getIp())){ | 164 | if(StringUtils.isNotBlank(req.getIp())){ |
170 | - sql = String.format("select count(cost),mean(cost) from service_access where context = '%s' and hostAddress = '%s' group by event",req.getServiceName(),req.getIp()); | 165 | + sql = String.format("select count(cost),mean(cost) from service_access where context = '%s' and hostAddress = '%s' and time > '%s' and time < '%s' group by event",req.getServiceName(),req.getIp(),req.getStartTime(),req.getEndTime()); |
171 | }else{ | 166 | }else{ |
172 | - sql = String.format("select count(cost),mean(cost) from service_access where context = '%s' group by event",req.getServiceName()); | 167 | + sql = String.format("select count(cost),mean(cost) from service_access where context = '%s' and time > '%s' and time < '%s' group by event",req.getServiceName(),req.getStartTime(),req.getEndTime()); |
173 | } | 168 | } |
174 | 169 | ||
175 | QueryResult queryResult = query(source, sql, InfluxDBContants.YOHO_EVENT); | 170 | QueryResult queryResult = query(source, sql, InfluxDBContants.YOHO_EVENT); |
@@ -203,9 +198,9 @@ public class ServiceAccessMapperImpl extends InfluxDBQuery implements ServiceAcc | @@ -203,9 +198,9 @@ public class ServiceAccessMapperImpl extends InfluxDBQuery implements ServiceAcc | ||
203 | } | 198 | } |
204 | 199 | ||
205 | if(StringUtils.isNotBlank(req.getIp())){ | 200 | if(StringUtils.isNotBlank(req.getIp())){ |
206 | - sql = String.format("select event,stack from service_access where context='%s' and cost > 200 and ip = '%s'",req.getServiceName(),req.getIp()); | 201 | + sql = String.format("select event,stack from service_access where context='%s' and cost > 200 and time > '%s' and time < '%s' and ip = '%s' ",req.getServiceName(),req.getStartTime(),req.getEndTime(),req.getIp()); |
207 | }else{ | 202 | }else{ |
208 | - sql = String.format("select event,stack from service_access where context='%s' and cost > 200 ",req.getServiceName()); | 203 | + sql = String.format("select event,stack from service_access where context='%s' and cost > 200 and time > '%s' and time < '%s'",req.getServiceName(),req.getStartTime(),req.getEndTime()); |
209 | } | 204 | } |
210 | 205 | ||
211 | 206 | ||
@@ -236,4 +231,75 @@ public class ServiceAccessMapperImpl extends InfluxDBQuery implements ServiceAcc | @@ -236,4 +231,75 @@ public class ServiceAccessMapperImpl extends InfluxDBQuery implements ServiceAcc | ||
236 | return map; | 231 | return map; |
237 | } | 232 | } |
238 | 233 | ||
234 | + | ||
235 | + @Override | ||
236 | + public Map<String,NewJavaApiInfoRep> getDataByContextAndApiName(NewJavaApiInfoReq req) { | ||
237 | + | ||
238 | + Map<String,NewJavaApiInfoRep> map = new HashMap<>(); | ||
239 | + String sql = String.format("select count(cost),mean(cost) 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()); | ||
240 | + | ||
241 | + map.putAll(getDataByContext(InfluxDBContants.AWS,sql)); | ||
242 | + map.putAll(getDataByContext(InfluxDBContants.Q_CLOUD,sql)); | ||
243 | + return map; | ||
244 | + } | ||
245 | + | ||
246 | + | ||
247 | + private Map<String,NewJavaApiInfoRep> getDataByContextAndApiName(String source,String sql) { | ||
248 | + Map<String,NewJavaApiInfoRep> map = new HashMap<>(); | ||
249 | + QueryResult queryResult = query(source, sql, InfluxDBContants.YOHO_EVENT); | ||
250 | + QueryResult.Result rel = queryResult.getResults().get(0); | ||
251 | + List<QueryResult.Series> listSeries = rel.getSeries(); | ||
252 | + if(listSeries == null) | ||
253 | + return map; | ||
254 | + for(QueryResult.Series series : listSeries){ | ||
255 | + String hostAddress = series.getTags().get("hostAddress"); | ||
256 | + Double count = (Double)series.getValues().get(0).get(1); | ||
257 | + Double mean = (Double)series.getValues().get(0).get(2); | ||
258 | + NewJavaApiInfoRep newJavaApiInfoRep = new NewJavaApiInfoRep(); | ||
259 | + newJavaApiInfoRep.setTotalCount(count.intValue()); | ||
260 | + newJavaApiInfoRep.setAvgCost(mean.intValue()); | ||
261 | + map.put(hostAddress,newJavaApiInfoRep); | ||
262 | + } | ||
263 | + | ||
264 | + return map; | ||
265 | + } | ||
266 | + | ||
267 | + | ||
268 | + @Override | ||
269 | + public Map<String,List<String>> getTimeoutInfoByContextAndApiName(NewJavaApiInfoReq req) { | ||
270 | + Map<String,List<String>> map = new HashMap(); | ||
271 | + String sql = String.format("select ip,stack from service_access where context='%s' and event = '%s' and cost > 200 and time > '%s' and time < '%s'",req.getServiceName(),req.getApiName(),req.getStartTime(),req.getEndTime()); | ||
272 | + map.putAll(getTimeoutInfoByContextAndApiName(InfluxDBContants.AWS,sql)); | ||
273 | + map.putAll(getTimeoutInfoByContextAndApiName(InfluxDBContants.Q_CLOUD,sql)); | ||
274 | + return map; | ||
275 | + } | ||
276 | + | ||
277 | + private Map<String,List<String>> getTimeoutInfoByContextAndApiName(String source,String sql) { | ||
278 | + Map<String,List<String>> map = new HashMap(); | ||
279 | + QueryResult queryResult = query(source, sql, InfluxDBContants.YOHO_EVENT); | ||
280 | + QueryResult.Result rel = queryResult.getResults().get(0); | ||
281 | + List<QueryResult.Series> listSeries = rel.getSeries(); | ||
282 | + if(listSeries == null) | ||
283 | + return map; | ||
284 | + QueryResult.Series series = listSeries.get(0); | ||
285 | + List<List<Object>> values = series.getValues(); | ||
286 | + | ||
287 | + for (List<Object> objects : values){ | ||
288 | + if(objects.get(1) == null || objects.get(2) == null) | ||
289 | + continue; | ||
290 | + String ip = (String)objects.get(1); | ||
291 | + String stack = (String)objects.get(2); | ||
292 | + List<String> stackList = map.get(ip); | ||
293 | + if(stackList == null){ | ||
294 | + stackList = new ArrayList<>(); | ||
295 | + stackList.add(stack); | ||
296 | + map.put(ip,stackList); | ||
297 | + }else{ | ||
298 | + stackList.add(stack); | ||
299 | + } | ||
300 | + } | ||
301 | + | ||
302 | + return map; | ||
303 | + } | ||
304 | + | ||
239 | } | 305 | } |
@@ -21,9 +21,9 @@ public class ServiceServerExceptionMapperImpl extends InfluxDBQuery implements S | @@ -21,9 +21,9 @@ public class ServiceServerExceptionMapperImpl extends InfluxDBQuery implements S | ||
21 | 21 | ||
22 | //根据context获取错误信息列表 | 22 | //根据context获取错误信息列表 |
23 | @Override | 23 | @Override |
24 | - public Map<String,List<String>> getErrorDataByContext(String context,String startDateStr,String endDateStr) { | 24 | + public Map<String,List<String>> getErrorDataByContext(NewJavaApiInfoReq req) { |
25 | Map<String,List<String>> map = new HashMap(); | 25 | Map<String,List<String>> map = new HashMap(); |
26 | - String sql = String.format("select ip,stack from service_server_exception where context='%s' and time > '%s' and time < '%s'",context,startDateStr,endDateStr); | 26 | + String sql = String.format("select ip,stack from service_server_exception where context='%s' and time > '%s' and time < '%s'",req.getServiceName(),req.getStartTime(),req.getEndTime()); |
27 | // String sql = "select ip,stack from service_server_exception"; | 27 | // String sql = "select ip,stack from service_server_exception"; |
28 | map.putAll(getDataByContext(InfluxDBContants.AWS,sql)); | 28 | map.putAll(getDataByContext(InfluxDBContants.AWS,sql)); |
29 | map.putAll(getDataByContext(InfluxDBContants.Q_CLOUD,sql)); | 29 | map.putAll(getDataByContext(InfluxDBContants.Q_CLOUD,sql)); |
@@ -68,7 +68,6 @@ public class ServiceServerExceptionMapperImpl extends InfluxDBQuery implements S | @@ -68,7 +68,6 @@ public class ServiceServerExceptionMapperImpl extends InfluxDBQuery implements S | ||
68 | public Map<String,List> getGraphInfo(String context){ | 68 | public Map<String,List> getGraphInfo(String context){ |
69 | Map<String,List> map = new HashMap(); | 69 | Map<String,List> map = new HashMap(); |
70 | String sql = String.format("select count(stack) from service_server_exception where context = '%s' and time > now() - 10m GROUP BY hostAddress,time(1m) fill(null)",context); | 70 | String sql = String.format("select count(stack) from service_server_exception where context = '%s' and time > now() - 10m GROUP BY hostAddress,time(1m) fill(null)",context); |
71 | -// String sql = "select count(stack) from service_server_exception where time > '2016-10-20 12:04:00' and time < '2016-10-20 12:14:00' GROUP BY hostAddress,time(1m) fill(null)"; | ||
72 | map.putAll(getGraphInfo(InfluxDBContants.AWS,sql)); | 71 | map.putAll(getGraphInfo(InfluxDBContants.AWS,sql)); |
73 | map.putAll(getGraphInfo(InfluxDBContants.Q_CLOUD,sql)); | 72 | map.putAll(getGraphInfo(InfluxDBContants.Q_CLOUD,sql)); |
74 | return map; | 73 | return map; |
@@ -128,9 +127,9 @@ public class ServiceServerExceptionMapperImpl extends InfluxDBQuery implements S | @@ -128,9 +127,9 @@ public class ServiceServerExceptionMapperImpl extends InfluxDBQuery implements S | ||
128 | } | 127 | } |
129 | 128 | ||
130 | if(StringUtils.isNotBlank(req.getIp())){ | 129 | if(StringUtils.isNotBlank(req.getIp())){ |
131 | - sql = String.format("select event,stack from service_server_exception where context='%s' and hostAddress = '%s'",req.getServiceName(),req.getIp()); | 130 | + sql = String.format("select event,stack from service_server_exception where context='%s' and time > '%s' and time < '%s' and hostAddress = '%s'",req.getServiceName(),req.getStartTime(),req.getEndTime(),req.getIp()); |
132 | }else{ | 131 | }else{ |
133 | - sql = String.format("select event,stack from service_server_exception where context='%s'",req.getServiceName()); | 132 | + sql = String.format("select event,stack from service_server_exception where context='%s' and time > '%s' and time < '%s'",req.getServiceName(),req.getStartTime(),req.getEndTime()); |
134 | } | 133 | } |
135 | 134 | ||
136 | QueryResult queryResult = query(source, sql, InfluxDBContants.YOMO_MONITOR); | 135 | QueryResult queryResult = query(source, sql, InfluxDBContants.YOMO_MONITOR); |
@@ -159,4 +158,45 @@ public class ServiceServerExceptionMapperImpl extends InfluxDBQuery implements S | @@ -159,4 +158,45 @@ public class ServiceServerExceptionMapperImpl extends InfluxDBQuery implements S | ||
159 | 158 | ||
160 | return map; | 159 | return map; |
161 | } | 160 | } |
161 | + | ||
162 | + //根据context获取错误信息列表 | ||
163 | + @Override | ||
164 | + public Map<String,List<String>> getErrorDataByContextAndApiName(NewJavaApiInfoReq req) { | ||
165 | + Map<String,List<String>> map = new HashMap(); | ||
166 | + String sql = String.format("select ip,stack from service_server_exception where context='%s' and event = '%s' and time > '%s' and time < '%s'",req.getServiceName(),req.getApiName(),req.getStartTime(),req.getEndTime()); | ||
167 | + map.putAll(getDataByContext(InfluxDBContants.AWS,sql)); | ||
168 | + map.putAll(getDataByContext(InfluxDBContants.Q_CLOUD,sql)); | ||
169 | + return map; | ||
170 | + } | ||
171 | + | ||
172 | + | ||
173 | + private Map<String,List<String>> getDataByContextAndApiName(String source,String sql) { | ||
174 | + Map<String,List<String>> map = new HashMap(); | ||
175 | + QueryResult queryResult = query(source, sql, InfluxDBContants.YOMO_MONITOR); | ||
176 | + QueryResult.Result rel = queryResult.getResults().get(0); | ||
177 | + List<QueryResult.Series> listSeries = rel.getSeries(); | ||
178 | + if(listSeries == null) | ||
179 | + return map; | ||
180 | + QueryResult.Series series = listSeries.get(0); | ||
181 | + List<List<Object>> values = series.getValues(); | ||
182 | + | ||
183 | + for (List<Object> objects : values){ | ||
184 | + if(objects.get(1) == null || objects.get(2) == null) | ||
185 | + continue; | ||
186 | + String ip = objects.get(1).toString(); | ||
187 | + String stack = objects.get(2).toString(); | ||
188 | + List<String> stackList = map.get(ip); | ||
189 | + if(stackList == null){ | ||
190 | + stackList = new ArrayList<>(); | ||
191 | + stackList.add(stack); | ||
192 | + map.put(ip,stackList); | ||
193 | + }else{ | ||
194 | + stackList.add(stack); | ||
195 | + } | ||
196 | + | ||
197 | + } | ||
198 | + | ||
199 | + return map; | ||
200 | + | ||
201 | + } | ||
162 | } | 202 | } |
1 | package com.monitor.javaserver.ctrl; | 1 | package com.monitor.javaserver.ctrl; |
2 | 2 | ||
3 | -import com.monitor.common.util.HttpRestClient; | ||
4 | import com.monitor.influxdb.InluxDBSingle; | 3 | import com.monitor.influxdb.InluxDBSingle; |
5 | import com.monitor.influxdb.contants.InfluxDBContants; | 4 | import com.monitor.influxdb.contants.InfluxDBContants; |
6 | import com.monitor.javaserver.service.NewJavaApiInfoService; | 5 | import com.monitor.javaserver.service.NewJavaApiInfoService; |
@@ -39,27 +38,23 @@ public class NewJavaApiInfoCtrl { | @@ -39,27 +38,23 @@ public class NewJavaApiInfoCtrl { | ||
39 | @Autowired | 38 | @Autowired |
40 | private InluxDBSingle inluxDBSingle; | 39 | private InluxDBSingle inluxDBSingle; |
41 | 40 | ||
42 | - @Autowired | ||
43 | - HttpRestClient httpRestClient; | ||
44 | - | ||
45 | private static final String DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss"; | 41 | private static final String DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss"; |
46 | 42 | ||
47 | //根据serviceName和timeInterval查询每台ip的监控信息 | 43 | //根据serviceName和timeInterval查询每台ip的监控信息 |
48 | @RequestMapping("/queryByServiceType") | 44 | @RequestMapping("/queryByServiceType") |
49 | @ResponseBody | 45 | @ResponseBody |
50 | public BaseResponse getJavaApiStatus(@RequestBody NewJavaApiInfoReq req) { | 46 | public BaseResponse getJavaApiStatus(@RequestBody NewJavaApiInfoReq req) { |
51 | - | ||
52 | log.info("queryByServiceType accept pram : {},{},{}",req.getServiceType(),req.getServiceName(),req.getTimeInterval()); | 47 | log.info("queryByServiceType accept pram : {},{},{}",req.getServiceType(),req.getServiceName(),req.getTimeInterval()); |
53 | //influxdb使用的是utc时间 | 48 | //influxdb使用的是utc时间 |
54 | DateTime endDateTime = DateTime.now(DateTimeZone.UTC); | 49 | DateTime endDateTime = DateTime.now(DateTimeZone.UTC); |
55 | DateTime startDateTime = endDateTime.minusMinutes(req.getTimeInterval()); | 50 | DateTime startDateTime = endDateTime.minusMinutes(req.getTimeInterval()); |
56 | - String startDateStr = startDateTime.toString(DATE_TIME_FORMAT); | ||
57 | - String endDateStr = endDateTime.toString(DATE_TIME_FORMAT); | 51 | + req.setStartTime(startDateTime.toString(DATE_TIME_FORMAT)); |
52 | + req.setEndTime(endDateTime.toString(DATE_TIME_FORMAT)); | ||
58 | 53 | ||
59 | - List<NewJavaApiInfoRep> list = newJavaApiInfoService.getJavaApiStatus(req,startDateStr,endDateStr); | 54 | + List<NewJavaApiInfoRep> list = newJavaApiInfoService.getJavaApiStatus(req); |
60 | Map returnMap = new HashMap(); | 55 | Map returnMap = new HashMap(); |
61 | - returnMap.put("startTime",startDateStr); | ||
62 | - returnMap.put("endTime",endDateStr); | 56 | + returnMap.put("startTime",req.getStartTime()); |
57 | + returnMap.put("endTime",req.getEndTime()); | ||
63 | returnMap.put("content",list); | 58 | returnMap.put("content",list); |
64 | BaseResponse rep = new BaseResponse(); | 59 | BaseResponse rep = new BaseResponse(); |
65 | rep.setData(returnMap); | 60 | rep.setData(returnMap); |
@@ -93,7 +88,7 @@ public class NewJavaApiInfoCtrl { | @@ -93,7 +88,7 @@ public class NewJavaApiInfoCtrl { | ||
93 | @RequestMapping("/queryByServiceTypeAndIP") | 88 | @RequestMapping("/queryByServiceTypeAndIP") |
94 | @ResponseBody | 89 | @ResponseBody |
95 | public BaseResponse queryByServiceTypeAndIP(@RequestBody NewJavaApiInfoReq req) { | 90 | public BaseResponse queryByServiceTypeAndIP(@RequestBody NewJavaApiInfoReq req) { |
96 | - log.info("getIPList accept pram : {},{},{}",req.getCloudType(),req.getServiceType(),req.getServiceName(),req.getIp(),req.getStartTime(),req.getEndTime()); | 91 | + log.info("getIPList accept pram : {},{},{},{},{},{}",req.getCloudType(),req.getServiceType(),req.getServiceName(),req.getIp(),req.getStartTime(),req.getEndTime()); |
97 | List<NewJavaApiDetailInfoRep> list = newJavaApiInfoService.queryByServiceTypeAndIP(req); | 92 | List<NewJavaApiDetailInfoRep> list = newJavaApiInfoService.queryByServiceTypeAndIP(req); |
98 | BaseResponse rep = new BaseResponse(); | 93 | BaseResponse rep = new BaseResponse(); |
99 | rep.setData(list); | 94 | rep.setData(list); |
@@ -101,6 +96,25 @@ public class NewJavaApiInfoCtrl { | @@ -101,6 +96,25 @@ public class NewJavaApiInfoCtrl { | ||
101 | } | 96 | } |
102 | 97 | ||
103 | 98 | ||
99 | + //根据context和apiName接口名查询该apiName详细信息 | ||
100 | + @RequestMapping("/queryByServiceTypeAndApiName") | ||
101 | + @ResponseBody | ||
102 | + public BaseResponse queryByServiceTypeAndApiName(@RequestBody NewJavaApiInfoReq req) { | ||
103 | + log.info("getIPList accept pram : {},{},{},{},{}",req.getServiceType(),req.getServiceName(),req.getStartTime(),req.getEndTime(),req.getApiName()); | ||
104 | + List<NewJavaApiInfoRep> list = newJavaApiInfoService.queryByServiceTypeAndApiName(req); | ||
105 | + BaseResponse rep = new BaseResponse(); | ||
106 | + rep.setData(list); | ||
107 | + return rep; | ||
108 | + } | ||
109 | + | ||
110 | + | ||
111 | + | ||
112 | + | ||
113 | + | ||
114 | + | ||
115 | + | ||
116 | + | ||
117 | + | ||
104 | @RequestMapping("/test") | 118 | @RequestMapping("/test") |
105 | @ResponseBody | 119 | @ResponseBody |
106 | public BaseResponse test() { | 120 | public BaseResponse test() { |
@@ -136,9 +150,9 @@ public class NewJavaApiInfoCtrl { | @@ -136,9 +150,9 @@ public class NewJavaApiInfoCtrl { | ||
136 | for(int i = 0;i<strs.length;i++){ | 150 | for(int i = 0;i<strs.length;i++){ |
137 | String ip = strs[i]; | 151 | String ip = strs[i]; |
138 | Point point = Point.measurement("service_access") | 152 | Point point = Point.measurement("service_access") |
139 | - .tag("context","gateway").tag("event","/gateway").tag("host","/gateway") | 153 | + .tag("context","gateway").tag("event","/gateway3").tag("host","/gateway") |
140 | .tag("hostAddress",ip).tag("src_service","app.product.promotion").tag("status_code","200") | 154 | .tag("hostAddress",ip).tag("src_service","app.product.promotion").tag("status_code","200") |
141 | - .addField("cost", RandomUtils.nextInt(199) + 2000).addField("ip",ip) | 155 | + .addField("cost", RandomUtils.nextInt(199) + 3000).addField("ip",ip) |
142 | .addField("stack","Total Delay [15004ms] /gateway +---[15004ms] - com.yoho.core.common.monitor.ThreadProfileInterceptor.preHandle - [enter:1476930300814,exit:1476930315818] +---[15004ms] - app.product.data. - [enter:1476930300814,exit:1476930315818]") | 156 | .addField("stack","Total Delay [15004ms] /gateway +---[15004ms] - com.yoho.core.common.monitor.ThreadProfileInterceptor.preHandle - [enter:1476930300814,exit:1476930315818] +---[15004ms] - app.product.data. - [enter:1476930300814,exit:1476930315818]") |
143 | .build(); | 157 | .build(); |
144 | inluxDBSingle.getInfluxDBByName(InfluxDBContants.AWS).getInfluxDB() | 158 | inluxDBSingle.getInfluxDBByName(InfluxDBContants.AWS).getInfluxDB() |
@@ -156,7 +170,7 @@ public class NewJavaApiInfoCtrl { | @@ -156,7 +170,7 @@ public class NewJavaApiInfoCtrl { | ||
156 | for(int i = 0;i<strs.length;i++){ | 170 | for(int i = 0;i<strs.length;i++){ |
157 | String ip = strs[i]; | 171 | String ip = strs[i]; |
158 | Point point = Point.measurement("service_server_exception") | 172 | Point point = Point.measurement("service_server_exception") |
159 | - .tag("context","gateway").tag("event","/gateway").tag("host","/brower/favorite/isFavorite") | 173 | + .tag("context","gateway").tag("event","/gateway1").tag("host","/brower/favorite/isFavorite") |
160 | .tag("hostAddress",ip).tag("service_name","brower/favorite/isFavorite") | 174 | .tag("hostAddress",ip).tag("service_name","brower/favorite/isFavorite") |
161 | .addField("ip",ip) | 175 | .addField("ip",ip) |
162 | .addField("stack","org.apache.catalina\\n.connector.ClientAbortException: java.io.IOException: 断开的管道\\n\\tat org.apache.catalina.connector.OutputBuffer\\n.realWriteBytes(OutputBuffer.java:393)\\n\\tat org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk\\n.java:426)\\n\\tat org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:342)\\n\\tat org\\n.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:317)\\n\\tat org.apache.catalina.connector\\n.CoyoteOutputStream.flush(CoyoteOutputStream.java:110)\\n\\tat com.fasterxml.jackson.core.json.UTF8JsonGenerator\\n.flush(UTF8JsonGenerator.java:1022)\\n\\tat com.fasterxml.jackson.databind.ObjectWriter.writeValue(ObjectWriter\\n.java:891)\\n\\tat org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.writeInternal\\n(AbstractJackson2HttpMessageConverter.java:264)\\n\\tat org.springframework.http.converter.AbstractGenericHttpMessageConverter\\n.write(AbstractGenericHttpMessageConverter.java:100)\\n\\tat org.springframework.web.servlet.mvc.method\\n.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters(AbstractMessageConverterMethodProcessor\\n.java:202)\\n\\tat org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor\\n.writeWithMessageConverters(AbstractMessageConverterMethodProcessor.java:133)\\n\\tat org.springframework\\n.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.handleReturnValue(RequestResponseBodyMethodProcessor\\n.java:165)\\n\\tat org.springframework.web.method.support.HandlerMethodReturnValueHandlerComposite.handleReturnValue\\n(HandlerMethodReturnValueHandlerComposite.java:80)\\n\\tat org.springframework.web.servlet.mvc.method.annotation\\n.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:126)\\n\\tat org.springframework\\n.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter\\n.java:806)\\n\\tat org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal\\n(RequestMappingHandlerAdapter.java:729)\\n\\tat org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter\\n.handle(AbstractHandlerMethodAdapter.java:85)\\n\\tat org.springframework.web.servlet.DispatcherServlet\\n.doDispatch(DispatcherServlet.java:959)\\n\\tat org.springframework.web.servlet.DispatcherServlet.doService\\n(DispatcherServlet.java:893)\\n\\tat org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet\\n.java:970)\\n\\tat org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)\\n\\n\\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:648)\\n\\tat org.springframework.web.servlet\\n.FrameworkServlet.service(FrameworkServlet.java:846)\\n\\tat javax.servlet.http.HttpServlet.service(HttpServlet\\n.java:729)\\n\\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain\\n.java:291)\\n\\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java\\n:206)\\n\\tat org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)\\n\\tat org.apache.catalina\\n.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)\\n\\tat org.apache.catalina\\n.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)\\n\\tat org.springframework.web\\n.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:85)\\n\\tat org.springframework\\n.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)\\n\\tat org.apache.catalina.core\\n.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)\\n\\tat org.apache.catalina.core\\n.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)\\n\\tat org.apache.catalina.core.StandardWrapperValve\\n.invoke(StandardWrapperValve.java:217)\\n\\tat org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve\\n.java:106)\\n\\tat org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502\\n)\\n\\tat org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)\\n\\tat org.apache\\n.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)\\n\\tat org.apache.catalina.core.StandardEngineValve\\n.invoke(StandardEngineValve.java:88)\\n\\tat org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter\\n.java:518)\\n\\tat org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java\\n:1091)\\n\\tat org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java\\n:673)\\n\\tat org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)\\n\\tat\\n org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)\\n\\tat java.util.concurrent\\n.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)\\n\\tat java.util.concurrent.ThreadPoolExecutor$Worker\\n.run(ThreadPoolExecutor.java:617)\\n\\tat org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run\\n(TaskThread.java:61)\\n\\tat java.lang.Thread.run(Thread.java:745)\\nCaused by: java.io.IOException: 断开\\n的管道\\n\\tat sun.nio.ch.FileDispatcherImpl.write0(Native Method)\\n\\tat sun.nio.ch.SocketDispatcher.write\\n(SocketDispatcher.java:47)\\n\\tat sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93)\\n\\tat sun.nio\\n.ch.IOUtil.write(IOUtil.java:65)\\n\\tat sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:471\\n)\\n\\tat org.apache.tomcat.util.net.NioChannel.write(NioChannel.java:124)\\n\\tat org.apache.tomcat.util\\n.net.NioBlockingSelector.write(NioBlockingSelector.java:101)\\n\\tat org.apache.tomcat.util.net.NioSelectorPool\\n.write(NioSelectorPool.java:172)\\n\\tat org.apache.coyote.http11.InternalNioOutputBuffer.writeToSocket\\n(InternalNioOutputBuffer.java:139)\\n\\tat org.apache.coyote.http11.InternalNioOutputBuffer.addToBB(InternalNioOutputBuffer\\n.java:197)\\n\\tat org.apache.coyote.http11.InternalNioOutputBuffer.access$000(InternalNioOutputBuffer\\n.java:41)\\n\\tat org.apache.coyote.http11.InternalNioOutputBuffer$SocketOutputBuffer.doWrite(InternalNioOutputBuffer\\n.java:320)\\n\\tat org.apache.coyote.http11.filters.ChunkedOutputFilter.doWrite(ChunkedOutputFilter.java\\n:118)\\n\\tat org.apache.coyote.http11.AbstractOutputBuffer.doWrite(AbstractOutputBuffer.java:256)\\n\\tat\\n org.apache.coyote.Response.doWrite(Response.java:501)\\n\\tat org.apache.catalina.connector.OutputBuffer\\n.realWriteBytes(OutputBuffer.java:388)\\n\\t... 47 more\\n") | 176 | .addField("stack","org.apache.catalina\\n.connector.ClientAbortException: java.io.IOException: 断开的管道\\n\\tat org.apache.catalina.connector.OutputBuffer\\n.realWriteBytes(OutputBuffer.java:393)\\n\\tat org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk\\n.java:426)\\n\\tat org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:342)\\n\\tat org\\n.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:317)\\n\\tat org.apache.catalina.connector\\n.CoyoteOutputStream.flush(CoyoteOutputStream.java:110)\\n\\tat com.fasterxml.jackson.core.json.UTF8JsonGenerator\\n.flush(UTF8JsonGenerator.java:1022)\\n\\tat com.fasterxml.jackson.databind.ObjectWriter.writeValue(ObjectWriter\\n.java:891)\\n\\tat org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.writeInternal\\n(AbstractJackson2HttpMessageConverter.java:264)\\n\\tat org.springframework.http.converter.AbstractGenericHttpMessageConverter\\n.write(AbstractGenericHttpMessageConverter.java:100)\\n\\tat org.springframework.web.servlet.mvc.method\\n.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters(AbstractMessageConverterMethodProcessor\\n.java:202)\\n\\tat org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor\\n.writeWithMessageConverters(AbstractMessageConverterMethodProcessor.java:133)\\n\\tat org.springframework\\n.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.handleReturnValue(RequestResponseBodyMethodProcessor\\n.java:165)\\n\\tat org.springframework.web.method.support.HandlerMethodReturnValueHandlerComposite.handleReturnValue\\n(HandlerMethodReturnValueHandlerComposite.java:80)\\n\\tat org.springframework.web.servlet.mvc.method.annotation\\n.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:126)\\n\\tat org.springframework\\n.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter\\n.java:806)\\n\\tat org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal\\n(RequestMappingHandlerAdapter.java:729)\\n\\tat org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter\\n.handle(AbstractHandlerMethodAdapter.java:85)\\n\\tat org.springframework.web.servlet.DispatcherServlet\\n.doDispatch(DispatcherServlet.java:959)\\n\\tat org.springframework.web.servlet.DispatcherServlet.doService\\n(DispatcherServlet.java:893)\\n\\tat org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet\\n.java:970)\\n\\tat org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)\\n\\n\\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:648)\\n\\tat org.springframework.web.servlet\\n.FrameworkServlet.service(FrameworkServlet.java:846)\\n\\tat javax.servlet.http.HttpServlet.service(HttpServlet\\n.java:729)\\n\\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain\\n.java:291)\\n\\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java\\n:206)\\n\\tat org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)\\n\\tat org.apache.catalina\\n.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)\\n\\tat org.apache.catalina\\n.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)\\n\\tat org.springframework.web\\n.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:85)\\n\\tat org.springframework\\n.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)\\n\\tat org.apache.catalina.core\\n.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)\\n\\tat org.apache.catalina.core\\n.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)\\n\\tat org.apache.catalina.core.StandardWrapperValve\\n.invoke(StandardWrapperValve.java:217)\\n\\tat org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve\\n.java:106)\\n\\tat org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502\\n)\\n\\tat org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)\\n\\tat org.apache\\n.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)\\n\\tat org.apache.catalina.core.StandardEngineValve\\n.invoke(StandardEngineValve.java:88)\\n\\tat org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter\\n.java:518)\\n\\tat org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java\\n:1091)\\n\\tat org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java\\n:673)\\n\\tat org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)\\n\\tat\\n org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)\\n\\tat java.util.concurrent\\n.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)\\n\\tat java.util.concurrent.ThreadPoolExecutor$Worker\\n.run(ThreadPoolExecutor.java:617)\\n\\tat org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run\\n(TaskThread.java:61)\\n\\tat java.lang.Thread.run(Thread.java:745)\\nCaused by: java.io.IOException: 断开\\n的管道\\n\\tat sun.nio.ch.FileDispatcherImpl.write0(Native Method)\\n\\tat sun.nio.ch.SocketDispatcher.write\\n(SocketDispatcher.java:47)\\n\\tat sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93)\\n\\tat sun.nio\\n.ch.IOUtil.write(IOUtil.java:65)\\n\\tat sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:471\\n)\\n\\tat org.apache.tomcat.util.net.NioChannel.write(NioChannel.java:124)\\n\\tat org.apache.tomcat.util\\n.net.NioBlockingSelector.write(NioBlockingSelector.java:101)\\n\\tat org.apache.tomcat.util.net.NioSelectorPool\\n.write(NioSelectorPool.java:172)\\n\\tat org.apache.coyote.http11.InternalNioOutputBuffer.writeToSocket\\n(InternalNioOutputBuffer.java:139)\\n\\tat org.apache.coyote.http11.InternalNioOutputBuffer.addToBB(InternalNioOutputBuffer\\n.java:197)\\n\\tat org.apache.coyote.http11.InternalNioOutputBuffer.access$000(InternalNioOutputBuffer\\n.java:41)\\n\\tat org.apache.coyote.http11.InternalNioOutputBuffer$SocketOutputBuffer.doWrite(InternalNioOutputBuffer\\n.java:320)\\n\\tat org.apache.coyote.http11.filters.ChunkedOutputFilter.doWrite(ChunkedOutputFilter.java\\n:118)\\n\\tat org.apache.coyote.http11.AbstractOutputBuffer.doWrite(AbstractOutputBuffer.java:256)\\n\\tat\\n org.apache.coyote.Response.doWrite(Response.java:501)\\n\\tat org.apache.catalina.connector.OutputBuffer\\n.realWriteBytes(OutputBuffer.java:388)\\n\\t... 47 more\\n") |
@@ -11,11 +11,13 @@ import java.util.Map; | @@ -11,11 +11,13 @@ import java.util.Map; | ||
11 | * Created by yoho on 2016/10/20. | 11 | * Created by yoho on 2016/10/20. |
12 | */ | 12 | */ |
13 | public interface NewJavaApiInfoService { | 13 | public interface NewJavaApiInfoService { |
14 | - List<NewJavaApiInfoRep> getJavaApiStatus(NewJavaApiInfoReq req,String startDateStr,String endDateStr); | 14 | + List<NewJavaApiInfoRep> getJavaApiStatus(NewJavaApiInfoReq req); |
15 | 15 | ||
16 | Map getJavaApiGraph(NewJavaApiInfoReq req); | 16 | Map getJavaApiGraph(NewJavaApiInfoReq req); |
17 | 17 | ||
18 | List<String> getIPList(NewJavaApiInfoReq req); | 18 | List<String> getIPList(NewJavaApiInfoReq req); |
19 | 19 | ||
20 | List<NewJavaApiDetailInfoRep> queryByServiceTypeAndIP(NewJavaApiInfoReq req); | 20 | List<NewJavaApiDetailInfoRep> queryByServiceTypeAndIP(NewJavaApiInfoReq req); |
21 | + | ||
22 | + List<NewJavaApiInfoRep> queryByServiceTypeAndApiName(NewJavaApiInfoReq req); | ||
21 | } | 23 | } |
@@ -42,18 +42,18 @@ public class NewJavaApiInfoServiceImpl implements NewJavaApiInfoService { | @@ -42,18 +42,18 @@ public class NewJavaApiInfoServiceImpl implements NewJavaApiInfoService { | ||
42 | 42 | ||
43 | 43 | ||
44 | @Override | 44 | @Override |
45 | - public List<NewJavaApiInfoRep> getJavaApiStatus(NewJavaApiInfoReq req,String startDateStr,String endDateStr) { | 45 | + public List<NewJavaApiInfoRep> getJavaApiStatus(NewJavaApiInfoReq req) { |
46 | List<MObjectInfo> objectInfoList = getMObjectInfoList(req); | 46 | List<MObjectInfo> objectInfoList = getMObjectInfoList(req); |
47 | if(CollectionUtils.isEmpty(objectInfoList)){ | 47 | if(CollectionUtils.isEmpty(objectInfoList)){ |
48 | return null; | 48 | return null; |
49 | } | 49 | } |
50 | 50 | ||
51 | //获取总请求次数和平均耗时 | 51 | //获取总请求次数和平均耗时 |
52 | - Map<String,NewJavaApiInfoRep> infoMap = serviceAccessMapper.getBaseDataByContext(req.getServiceName(),startDateStr,endDateStr); | 52 | + Map<String,NewJavaApiInfoRep> infoMap = serviceAccessMapper.getBaseDataByContext(req); |
53 | //获取超时数据 | 53 | //获取超时数据 |
54 | - Map<String,List<String>> timeoutInfoMap = serviceAccessMapper.getTimeoutInfo(req.getServiceName(),startDateStr,endDateStr); | 54 | + Map<String,List<String>> timeoutInfoMap = serviceAccessMapper.getTimeoutInfo(req); |
55 | //获取异常数据 | 55 | //获取异常数据 |
56 | - Map<String,List<String>> errorInfoMap = serviceServerExceptionMapper.getErrorDataByContext(req.getServiceName(),startDateStr,endDateStr); | 56 | + Map<String,List<String>> errorInfoMap = serviceServerExceptionMapper.getErrorDataByContext(req); |
57 | //获取cpu、内存、带宽使用情况 | 57 | //获取cpu、内存、带宽使用情况 |
58 | Map vmInfoMap = vmInfoMapper.getVMInfo(); | 58 | Map vmInfoMap = vmInfoMapper.getVMInfo(); |
59 | 59 | ||
@@ -191,6 +191,42 @@ public class NewJavaApiInfoServiceImpl implements NewJavaApiInfoService { | @@ -191,6 +191,42 @@ public class NewJavaApiInfoServiceImpl implements NewJavaApiInfoService { | ||
191 | } | 191 | } |
192 | 192 | ||
193 | 193 | ||
194 | + @Override | ||
195 | + public List<NewJavaApiInfoRep> queryByServiceTypeAndApiName(NewJavaApiInfoReq req) { | ||
196 | + List<MObjectInfo> objectInfoList = getMObjectInfoList(req); | ||
197 | + if(CollectionUtils.isEmpty(objectInfoList)){ | ||
198 | + return null; | ||
199 | + } | ||
194 | 200 | ||
201 | + //获取总请求次数和平均耗时 | ||
202 | + Map<String,NewJavaApiInfoRep> infoMap = serviceAccessMapper.getDataByContextAndApiName(req); | ||
203 | + //获取超时数据 | ||
204 | + Map<String,List<String>> timeoutInfoMap = serviceAccessMapper.getTimeoutInfoByContextAndIp(req); | ||
205 | + //获取异常数据 | ||
206 | + Map<String,List<String>> errorInfoMap = serviceServerExceptionMapper.getErrorDataByContextAndApiName(req); | ||
207 | + | ||
208 | + List<NewJavaApiInfoRep> returnList = new ArrayList<>(); | ||
209 | + for(MObjectInfo mObjectInfo :objectInfoList){ | ||
210 | + NewJavaApiInfoRep resp = new NewJavaApiInfoRep(); | ||
211 | + String ip = mObjectInfo.getMoHostIp(); | ||
212 | + resp.setIp(ip); | ||
213 | + if(ip.startsWith("172")){ | ||
214 | + resp.setType("AWS"); | ||
215 | + }else{ | ||
216 | + resp.setType("QCloud"); | ||
217 | + } | ||
218 | + | ||
219 | + resp.setTotalCount(infoMap.get(ip) == null ? 0 : infoMap.get(ip).getTotalCount()); | ||
220 | + resp.setAvgCost(infoMap.get(ip) == null ? 0 : infoMap.get(ip).getAvgCost()); | ||
221 | + resp.setErrorCount(errorInfoMap.get(ip) == null ? 0 : errorInfoMap.get(ip).size()); | ||
222 | + resp.setErrorInfo(errorInfoMap.get(ip)); | ||
223 | + resp.setTimeoutInfo(timeoutInfoMap.get(ip)); | ||
224 | + | ||
225 | + | ||
226 | + returnList.add(resp); | ||
227 | + } | ||
228 | + | ||
229 | + return returnList; | ||
230 | + } | ||
195 | 231 | ||
196 | } | 232 | } |
@@ -22,6 +22,8 @@ public class NewJavaApiInfoReq { | @@ -22,6 +22,8 @@ public class NewJavaApiInfoReq { | ||
22 | //1:aws 2:qcloud | 22 | //1:aws 2:qcloud |
23 | private int cloudType; | 23 | private int cloudType; |
24 | 24 | ||
25 | + private String apiName; | ||
26 | + | ||
25 | public int getServiceType() { | 27 | public int getServiceType() { |
26 | return serviceType; | 28 | return serviceType; |
27 | } | 29 | } |
@@ -85,4 +87,12 @@ public class NewJavaApiInfoReq { | @@ -85,4 +87,12 @@ public class NewJavaApiInfoReq { | ||
85 | public void setCloudType(int cloudType) { | 87 | public void setCloudType(int cloudType) { |
86 | this.cloudType = cloudType; | 88 | this.cloudType = cloudType; |
87 | } | 89 | } |
90 | + | ||
91 | + public String getApiName() { | ||
92 | + return apiName; | ||
93 | + } | ||
94 | + | ||
95 | + public void setApiName(String apiName) { | ||
96 | + this.apiName = apiName; | ||
97 | + } | ||
88 | } | 98 | } |
-
Please register or login to post a comment