...
|
...
|
@@ -34,19 +34,6 @@ |
|
|
</div>
|
|
|
<div class="widget-content nopadding">
|
|
|
<div class="widget-title" style="height: 300px;">
|
|
|
<div class="form-inline" role="form" id="timeDiv"
|
|
|
style=" margin-top: 12px;margin-left: 15px;float: left;">
|
|
|
<select id="timePeriod" name="timePeriod" class="form-control" >
|
|
|
<option value="1">1 minute</option>
|
|
|
<option value="2">10 minutes</option>
|
|
|
<option value="3">30 minutes</option>
|
|
|
<option value="4">1 hour</option>
|
|
|
<option value="4">5 hours</option>
|
|
|
<option value="4">15 hours</option>
|
|
|
<option value="4">1 day</option>
|
|
|
<option value="4">7 days</option>
|
|
|
</select>
|
|
|
</div>
|
|
|
<div class="col-sm-5 control-label" role="form" id="chartterDiv"
|
|
|
style=" margin-top: 12px;margin-left: 10px;float: left;">
|
|
|
<div id="costCharts" class="input-group" style="float: left;height: 280px;width: 720px">
|
...
|
...
|
@@ -68,9 +55,16 @@ |
|
|
<div class="widget-title" style="height: 53px;">
|
|
|
<div class="form-inline" role="form" id="inBoxQueryDiv"
|
|
|
style=" margin-top: 12px;margin-left: 25px;float: left;">
|
|
|
<div class="input-group" style="float: left;">
|
|
|
<span class="input-group-addon">服务名:</span>
|
|
|
<select id="searchApiName" name="searchApiName" class="form-control" onchange="getOnchange()">
|
|
|
<div class="input-group" id="timeDiv" style="float: left;">
|
|
|
<select id="timeInterval" name="timeInterval" class="form-control" onchange="getOnchange(2)">
|
|
|
<option value="1">1 minute</option>
|
|
|
<option value="5">5 minutes</option>
|
|
|
<option value="10">10 minutes</option>
|
|
|
</select>
|
|
|
</div>
|
|
|
<div class="input-group" style="margin-left: 10px">
|
|
|
<span class="input-group-addon" >服务名:</span>
|
|
|
<select id="searchApiName" name="searchApiName" class="form-control" onchange="getOnchange(1)">
|
|
|
</select>
|
|
|
</div>
|
|
|
<button id="searchJavaInfoBtn" class="btn btn-primary" style="margin-left: 15px">API统计详情</button>
|
...
|
...
|
@@ -131,31 +125,36 @@ |
|
|
if($("#searchApiName").val() != null && $("#searchApiName").select("getText") != null) {
|
|
|
$("#ipInfoTable").table("load", {
|
|
|
serviceType: $("#searchApiName").val(),
|
|
|
serviceName: $("#searchApiName").select("getText")
|
|
|
serviceName: $("#searchApiName").select("getText"),
|
|
|
timeInterval: $("#timeInterval").val()
|
|
|
});
|
|
|
//更新曲线图
|
|
|
getLineDate(1);
|
|
|
getLineDate(2);
|
|
|
}
|
|
|
setTimeout("timer()", 60000);
|
|
|
}
|
|
|
timer();
|
|
|
|
|
|
|
|
|
//画图事件
|
|
|
function drawLine(type,title,subTitle) {
|
|
|
function drawLine(type,title,subTitle,yText,categories,series) {
|
|
|
var title = {
|
|
|
text: title
|
|
|
};
|
|
|
var subtitle = {
|
|
|
text: subTitle
|
|
|
text: subTitle == null? "gateway":subTitle
|
|
|
};
|
|
|
var xAxis = {
|
|
|
// tickInterval: 5*60* 1000, // one week
|
|
|
categories: ['16:40','16:42','16:44', '16:46','16:48', '16:50',
|
|
|
'16:52', '16:54', '16:56', '16:58', '17:00', '17:02']
|
|
|
//max : "10:00",
|
|
|
// min : "9:00"
|
|
|
// categories: ['16:40','16:42','16:44', '16:46','16:48', '16:50',
|
|
|
// '16:52', '16:54', '16:56', '16:58', '17:00', '17:02']
|
|
|
categories:categories
|
|
|
};
|
|
|
var yAxis = {
|
|
|
title: {
|
|
|
text: 'cost (ms)'
|
|
|
// text: 'cost (ms)'
|
|
|
text: yText
|
|
|
},
|
|
|
plotLines: [{
|
|
|
value: 0,
|
...
|
...
|
@@ -172,23 +171,24 @@ |
|
|
verticalAlign: 'middle',
|
|
|
borderWidth: 0
|
|
|
};
|
|
|
var series = [
|
|
|
{
|
|
|
name: '172.31.57.252',
|
|
|
data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2,
|
|
|
26.5, 23.3, 18.3, 13.9, 9.6]
|
|
|
},
|
|
|
{
|
|
|
name: '172.31.57.254',
|
|
|
data: [1, 0.8, 5.7, 11.3, 17.0, 22.0, 24.8,
|
|
|
24.1, 20.1, 14.1, 8.6, 2.5]
|
|
|
},
|
|
|
{
|
|
|
name: '172.31.57.253',
|
|
|
data: [3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0,
|
|
|
16.6, 14.2, 10.3, 6.6, 4.8]
|
|
|
}
|
|
|
];
|
|
|
// var series = [
|
|
|
// {
|
|
|
// name: '172.31.57.252',
|
|
|
// data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2,
|
|
|
// 26.5, 23.3, 18.3, 13.9, 9.6]
|
|
|
// },
|
|
|
// {
|
|
|
// name: '172.31.57.254',
|
|
|
// data: [1, 0.8, 5.7, 11.3, 17.0, 22.0, 24.8,
|
|
|
// 24.1, 20.1, 14.1, 8.6, 2.5]
|
|
|
// },
|
|
|
// {
|
|
|
// name: '172.31.57.253',
|
|
|
// data: [3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0,
|
|
|
// 16.6, 14.2, 10.3, 6.6, 4.8]
|
|
|
// }
|
|
|
// ];
|
|
|
var series = series;
|
|
|
|
|
|
var json = {};
|
|
|
json.title = title;
|
...
|
...
|
@@ -205,33 +205,51 @@ |
|
|
}
|
|
|
}
|
|
|
|
|
|
//类型选择事件
|
|
|
function getOnchange(){
|
|
|
//类型选择事件,type用于区分点击服务名称下拉(1)还是时间下拉(2)
|
|
|
function getOnchange(type){
|
|
|
$("#ipInfoTable").table("load", {
|
|
|
serviceType: $("#searchApiName").val(),
|
|
|
serviceName: $("#searchApiName").select("getText")
|
|
|
serviceName: $("#searchApiName").select("getText"),
|
|
|
timeInterval:$("#timeInterval").val()
|
|
|
});
|
|
|
drawLine(1,"平均耗时-曲线图",$("#searchApiName").select("getText"));
|
|
|
drawLine(2,"异常次数-曲线图",$("#searchApiName").select("getText"));
|
|
|
//为1则是服务名选择
|
|
|
if(type == 1){
|
|
|
//更新曲线图
|
|
|
getLineDate(1);
|
|
|
getLineDate(2);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
//获取曲线数据
|
|
|
function getLineDate(lineType){
|
|
|
$.ajax({
|
|
|
url: contextPath + "/type/queryJavaApiType",
|
|
|
type: 'get',
|
|
|
url: contextPath + "/javaMonitor/getGraphData",
|
|
|
type: 'post',
|
|
|
data:{
|
|
|
serviceType : $("#searchApiName").val(),
|
|
|
serviceName : $("#searchApiName").select("getText"),
|
|
|
graphType : lineType
|
|
|
},
|
|
|
dataType:'json',
|
|
|
success: function (data) {
|
|
|
if (!data || data.code != 200) {
|
|
|
$.toaster('获取曲线数据失败', '警告', 'warning');
|
|
|
return;
|
|
|
}
|
|
|
$.each(data.data, function (idx, val) {
|
|
|
java_api_type.push({
|
|
|
"value": val.typeId,
|
|
|
"text": val.typeName
|
|
|
});
|
|
|
});
|
|
|
refreshNameSelected();
|
|
|
//根据Ip处理曲线数据
|
|
|
var categories = data.data.time;
|
|
|
var series = data.data.content;
|
|
|
var title = "";
|
|
|
var xText = "";
|
|
|
if(lineType == 1){
|
|
|
title = "平均耗时-曲线图";
|
|
|
xText = "cost(ms)";
|
|
|
}else{
|
|
|
title = "异常次数-曲线图";
|
|
|
xText = "error times";
|
|
|
}
|
|
|
drawLine(lineType,title,$("#searchApiName").select("getText"),xText,categories,series);
|
|
|
}
|
|
|
});
|
|
|
}
|
...
|
...
|
@@ -250,7 +268,8 @@ |
|
|
if(data.length>0){
|
|
|
$("#ipInfoTable").table("load", {
|
|
|
serviceType: data[0].typeId,
|
|
|
serviceName: data[0].typeName
|
|
|
serviceName: data[0].typeName,
|
|
|
timeInterval:$("#timeInterval").val()
|
|
|
});
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -265,9 +284,14 @@ |
|
|
sortable: true, //是否启用排序
|
|
|
sortOrder:"desc",
|
|
|
loadFilter: function (data) {
|
|
|
return defaultLoadFilter(data);
|
|
|
//记录下开始时间和结束时间
|
|
|
paramObj.startTime = data.startTime;
|
|
|
paramObj.endTime = data.endTime;
|
|
|
return defaultLoadFilter(data).content;
|
|
|
},
|
|
|
onLoadSuccess: function (data) {
|
|
|
//记录第一条ip
|
|
|
paramObj.ipName = data[0].ip;
|
|
|
//同步加载根据异常次数排序的tab页列表
|
|
|
var errorObj = new Array();
|
|
|
for(var i = 0;i<data.length;i++){
|
...
|
...
|
@@ -308,13 +332,11 @@ |
|
|
title: "请求异常次数",
|
|
|
field: "errorCount",
|
|
|
width: "10%",
|
|
|
sortable:true
|
|
|
},{
|
|
|
title: "异常信息",
|
|
|
field: "errorInfo",
|
|
|
width: "8%",
|
|
|
sortable:true,
|
|
|
formatter : function(value, rowData, rowIndex) {
|
|
|
var div = $("<div>");
|
|
|
var textView = $("<span>").html(rowData.errorCount).appendTo(div);
|
|
|
div.append("<br>");
|
|
|
var editBtn = $("<button>").addClass("btn btn-xs btn-success").html("详情").appendTo(div);
|
|
|
var content = "";
|
|
|
if(rowData.errorInfo != null){
|
...
|
...
|
@@ -341,11 +363,41 @@ |
|
|
});
|
|
|
return div;
|
|
|
}
|
|
|
}, {
|
|
|
title: "平均耗时",
|
|
|
},{
|
|
|
title: "平均耗时(ms)",
|
|
|
field: "avgCost",
|
|
|
width: "10%",
|
|
|
sortable:true
|
|
|
sortable:true,
|
|
|
formatter : function(value, rowData, rowIndex) {
|
|
|
var div = $("<div>");
|
|
|
var textView = $("<span>").html(rowData.avgCost).appendTo(div);
|
|
|
div.append("<br>");
|
|
|
var editBtn = $("<button>").addClass("btn btn-xs btn-success").html("详情").appendTo(div);
|
|
|
var content = "";
|
|
|
if(rowData.timeoutInfo != null){
|
|
|
for(var i = 0;i<rowData.timeoutInfo.length;i++){
|
|
|
content= content +rowData.timeoutInfo[i]+"<br><br>";
|
|
|
}
|
|
|
}
|
|
|
editBtn.click(function () {
|
|
|
var dialog = $("<div>").appendTo($("body"));
|
|
|
dialog.dialog({
|
|
|
backdrop : "static",
|
|
|
title : "超时详情",
|
|
|
content : content,
|
|
|
height : "60%",
|
|
|
width : "50%",
|
|
|
buttons : [{
|
|
|
text : "关闭",
|
|
|
className : "btn-danger",
|
|
|
onclick : function() {
|
|
|
$(dialog).dialog("hide");
|
|
|
}
|
|
|
}]
|
|
|
});
|
|
|
});
|
|
|
return div;
|
|
|
}
|
|
|
}, {
|
|
|
title: "CPU使用率",
|
|
|
field: "cpuRate",
|
...
|
...
|
@@ -353,12 +405,6 @@ |
|
|
},{
|
|
|
title: "内存使用率",
|
|
|
field: "memoryRate",
|
|
|
// formatter: function (value, rowData, rowIndex) {
|
|
|
// if (rowData.apiToggle == 0)
|
|
|
// return "N";
|
|
|
// else
|
|
|
// return "Y";
|
|
|
// },
|
|
|
width: "10%"
|
|
|
|
|
|
}, {
|
...
|
...
|
@@ -404,13 +450,11 @@ |
|
|
title: "请求异常次数",
|
|
|
field: "errorCount",
|
|
|
width: "10%",
|
|
|
sortable:true
|
|
|
}, {
|
|
|
title: "异常信息",
|
|
|
field: "errorInfo",
|
|
|
width: "20%",
|
|
|
sortable:true,
|
|
|
formatter : function(value, rowData, rowIndex) {
|
|
|
var div = $("<div>");
|
|
|
var textView = $("<span>").html(rowData.errorCount).appendTo(div);
|
|
|
div.append("<br>");
|
|
|
var editBtn = $("<button>").addClass("btn btn-xs btn-success").html("详情").appendTo(div);
|
|
|
var content = "";
|
|
|
if(rowData.errorInfo != null){
|
...
|
...
|
@@ -438,10 +482,40 @@ |
|
|
return div;
|
|
|
}
|
|
|
},{
|
|
|
title: "平均耗时",
|
|
|
title: "平均耗时(ms)",
|
|
|
field: "avgCost",
|
|
|
width: "10%",
|
|
|
sortable:true
|
|
|
sortable:true,
|
|
|
formatter : function(value, rowData, rowIndex) {
|
|
|
var div = $("<div>");
|
|
|
var textView = $("<span>").html(rowData.avgCost).appendTo(div);
|
|
|
div.append("<br>");
|
|
|
var editBtn = $("<button>").addClass("btn btn-xs btn-success").html("详情").appendTo(div);
|
|
|
var content = "";
|
|
|
if(rowData.timeoutInfo != null){
|
|
|
for(var i = 0;i<rowData.timeoutInfo.length;i++){
|
|
|
content= content +rowData.timeoutInfo[i]+"<br><br>";
|
|
|
}
|
|
|
}
|
|
|
editBtn.click(function () {
|
|
|
var dialog = $("<div>").appendTo($("body"));
|
|
|
dialog.dialog({
|
|
|
backdrop : "static",
|
|
|
title : "超时详情",
|
|
|
content : content,
|
|
|
height : "60%",
|
|
|
width : "50%",
|
|
|
buttons : [{
|
|
|
text : "关闭",
|
|
|
className : "btn-danger",
|
|
|
onclick : function() {
|
|
|
$(dialog).dialog("hide");
|
|
|
}
|
|
|
}]
|
|
|
});
|
|
|
});
|
|
|
return div;
|
|
|
}
|
|
|
}, {
|
|
|
title: "CPU使用率",
|
|
|
field: "cpuRate",
|
...
|
...
|
@@ -496,13 +570,11 @@ |
|
|
title: "请求异常次数",
|
|
|
field: "errorCount",
|
|
|
width: "10%",
|
|
|
sortable:true
|
|
|
}, {
|
|
|
title: "异常信息",
|
|
|
field: "errorInfo",
|
|
|
width: "20%",
|
|
|
sortable:true,
|
|
|
formatter : function(value, rowData, rowIndex) {
|
|
|
var div = $("<div>");
|
|
|
var textView = $("<span>").html(rowData.errorCount).appendTo(div);
|
|
|
div.append("<br>");
|
|
|
var editBtn = $("<button>").addClass("btn btn-xs btn-success").html("详情").appendTo(div);
|
|
|
var content = "";
|
|
|
if(rowData.errorInfo != null){
|
...
|
...
|
@@ -530,10 +602,40 @@ |
|
|
return div;
|
|
|
}
|
|
|
},{
|
|
|
title: "平均耗时",
|
|
|
title: "平均耗时(ms)",
|
|
|
field: "avgCost",
|
|
|
width: "10%",
|
|
|
sortable:true
|
|
|
sortable:true,
|
|
|
formatter : function(value, rowData, rowIndex) {
|
|
|
var div = $("<div>");
|
|
|
var textView = $("<span>").html(rowData.avgCost).appendTo(div);
|
|
|
div.append("<br>");
|
|
|
var editBtn = $("<button>").addClass("btn btn-xs btn-success").html("详情").appendTo(div);
|
|
|
var content = "";
|
|
|
if(rowData.timeoutInfo != null){
|
|
|
for(var i = 0;i<rowData.timeoutInfo.length;i++){
|
|
|
content= content +rowData.timeoutInfo[i]+"<br><br>";
|
|
|
}
|
|
|
}
|
|
|
editBtn.click(function () {
|
|
|
var dialog = $("<div>").appendTo($("body"));
|
|
|
dialog.dialog({
|
|
|
backdrop : "static",
|
|
|
title : "超时详情",
|
|
|
content : content,
|
|
|
height : "60%",
|
|
|
width : "50%",
|
|
|
buttons : [{
|
|
|
text : "关闭",
|
|
|
className : "btn-danger",
|
|
|
onclick : function() {
|
|
|
$(dialog).dialog("hide");
|
|
|
}
|
|
|
}]
|
|
|
});
|
|
|
});
|
|
|
return div;
|
|
|
}
|
|
|
}, {
|
|
|
title: "CPU使用率",
|
|
|
field: "cpuRate",
|
...
|
...
|
@@ -566,8 +668,19 @@ |
|
|
if (title == null){
|
|
|
title = "gateway";
|
|
|
}
|
|
|
drawLine(1,"平均耗时-曲线图",$("#searchApiName").select("getText"));
|
|
|
drawLine(2,"异常次数-曲线图",$("#searchApiName").select("getText"));
|
|
|
//更新曲线图
|
|
|
getLineDate(1);
|
|
|
getLineDate(2);
|
|
|
|
|
|
//新增
|
|
|
$("#searchJavaInfoBtn").click(function() {
|
|
|
// paramObj.markingPustId = 0;
|
|
|
// paramObj.markingPushFlag = '1';
|
|
|
var url = contextPath + "/javaMonitor/toJavaApiInfoList";
|
|
|
var serviceType = $("#searchApiName").val();
|
|
|
url += "?serviceType=" + serviceType;
|
|
|
window.location.href = url;
|
|
|
});
|
|
|
|
|
|
});
|
|
|
|
...
|
...
|
|