diff --git a/backend/src/main/java/io/metersphere/performance/service/MetricQueryService.java b/backend/src/main/java/io/metersphere/performance/service/MetricQueryService.java index 514f2f9673..536329d102 100644 --- a/backend/src/main/java/io/metersphere/performance/service/MetricQueryService.java +++ b/backend/src/main/java/io/metersphere/performance/service/MetricQueryService.java @@ -69,13 +69,14 @@ public class MetricQueryService { return metricDataList; } - + private List queryPrometheusMetric(String promQL, String seriesName, long startTime, long endTime, int step, String instance) { DecimalFormat df = new DecimalFormat("#.###"); String start = df.format(startTime / 1000.0); String end = df.format(endTime / 1000.0); JSONObject response = restTemplate.getForObject(prometheusHost + "/api/v1/query_range?query={promQL}&start={start}&end={end}&step={step}", JSONObject.class, promQL, start, end, step); + LogUtil.info(prometheusHost + "/api/v1/query_range?query={" + promQL + "}&start={" + start + "}&end{" + end + "}&step={" + step + "}"); return handleResult(seriesName, response, instance); } @@ -90,8 +91,7 @@ public class MetricQueryService { if (result.size() > 1) { result.forEach(rObject -> { - JSONObject resultObject = new JSONObject((Map)rObject); -// JSONObject resultObject = JSONObject.parseObject(rObject.toString()); + JSONObject resultObject = new JSONObject((Map) rObject); JSONObject metrics = resultObject.getJSONObject("metric"); if (metrics != null && metrics.size() > 0) { @@ -108,7 +108,7 @@ public class MetricQueryService { List timestamps = new ArrayList<>(); List values = new ArrayList<>(); - JSONObject resultObject = new JSONObject((Map)rObject); + JSONObject resultObject = new JSONObject((Map) rObject); JSONObject metrics = resultObject.getJSONObject("metric"); JSONArray jsonArray = resultObject.getJSONArray("values"); jsonArray.forEach(value -> { @@ -117,6 +117,7 @@ public class MetricQueryService { try { timestamps.add(DateUtils.getTimeString((long) (timestamp * 1000))); } catch (Exception e) { + LogUtil.error(e.getMessage(), e); e.printStackTrace(); } values.add(ja.getDouble(1)); @@ -165,7 +166,7 @@ public class MetricQueryService { metricRequest.setStartTime(startTime.getTime()); metricRequest.setEndTime(endTime.getTime()); } catch (Exception e) { - LogUtil.error(e, e.getMessage()); + LogUtil.error(e.getMessage(), e); e.printStackTrace(); } diff --git a/frontend/src/business/components/performance/report/components/MonitorCard.vue b/frontend/src/business/components/performance/report/components/MonitorCard.vue index 1802cd262f..5536b95dd6 100644 --- a/frontend/src/business/components/performance/report/components/MonitorCard.vue +++ b/frontend/src/business/components/performance/report/components/MonitorCard.vue @@ -71,11 +71,14 @@ export default { let option = { title: { left: 'center', - text: 'CPU', + text: 'CPU使用率', textStyle: { - color: '#99743C' + color: '#8492a6' }, }, + tooltip: { + trigger: 'axis' + }, xAxis: { type: 'category', data: xAxis @@ -102,11 +105,14 @@ export default { let option = { title: { left: 'center', - text: 'Disk', + text: '磁盘使用率', textStyle: { - color: '#99743C' + color: '#8492a6' }, }, + tooltip: { + trigger: 'axis' + }, xAxis: { type: 'category', data: xAxis @@ -133,11 +139,14 @@ export default { let option = { title: { left: 'center', - text: 'NetIn', + text: '入口流量', textStyle: { - color: '#99743C' + color: '#8492a6' }, }, + tooltip: { + trigger: 'axis' + }, xAxis: { type: 'category', data: xAxis @@ -164,11 +173,14 @@ export default { let option = { title: { left: 'center', - text: 'NetOut', + text: '出口流量', textStyle: { - color: '#99743C' + color: '#8492a6' }, }, + tooltip: { + trigger: 'axis' + }, xAxis: { type: 'category', data: xAxis @@ -195,11 +207,14 @@ export default { let option = { title: { left: 'center', - text: 'Memory', + text: '内存使用率', textStyle: { - color: '#99743C' + color: '#8492a6' }, }, + tooltip: { + trigger: 'axis' + }, xAxis: { type: 'category', data: xAxis