提交 f101ce90 编写于 作者: S shiziyuan9527 提交者: 刘瑞斌

refactor(性能测试): 修改图表

上级 1807ff35
......@@ -76,6 +76,7 @@ public class MetricQueryService {
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<String> timestamps = new ArrayList<>();
List<Double> 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();
}
......
......@@ -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,10 +105,13 @@ export default {
let option = {
title: {
left: 'center',
text: 'Disk',
text: '磁盘使用率',
textStyle: {
color: '#99743C'
color: '#8492a6'
},
},
tooltip: {
trigger: 'axis'
},
xAxis: {
type: 'category',
......@@ -133,10 +139,13 @@ export default {
let option = {
title: {
left: 'center',
text: 'NetIn',
text: '入口流量',
textStyle: {
color: '#99743C'
color: '#8492a6'
},
},
tooltip: {
trigger: 'axis'
},
xAxis: {
type: 'category',
......@@ -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,10 +207,13 @@ export default {
let option = {
title: {
left: 'center',
text: 'Memory',
text: '内存使用率',
textStyle: {
color: '#99743C'
color: '#8492a6'
},
},
tooltip: {
trigger: 'axis'
},
xAxis: {
type: 'category',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册