Authored by jack

Merge branch 'dev1019'

... ... @@ -43,7 +43,11 @@ public class JavaMonitorCtrl {
public BaseResponse queryApiMonitorInfo(JavaApiMonitorReq req) {
//校验参数
if(StringUtils.isEmpty(req.getServiceName())){
req.setServiceName("gateway");
req.setServiceName("all");
}
//0-gateway的默认,-1-all的默认
if(req.getServiceType() == 0){
req.setServiceType(-1);
}
if(req.getTimeInterval() == 0){
req.setTimeInterval(1);
... ... @@ -55,7 +59,7 @@ public class JavaMonitorCtrl {
@RequestMapping("/getGraphData")
@ResponseBody
public BaseResponse getGraphData(JavaApiMonitorReq req) {
if(StringUtils.isEmpty(req.getServiceName())){
if(StringUtils.isEmpty(req.getServiceName()) || "all".equals(req.getServiceName())){
req.setServiceName("gateway");
}
BaseResponse rep;
... ... @@ -73,7 +77,11 @@ public class JavaMonitorCtrl {
public BaseResponse queryIpList(JavaApiMonitorReq req) {
//校验参数
if(StringUtils.isEmpty(req.getServiceName())){
req.setServiceName("gateway");
req.setServiceName("all");
}
//0-gateway的默认,-1-all的默认
if(req.getServiceType() == 0){
req.setServiceType(-1);
}
BaseResponse rep = httpClient.defaultPost(HttpUriContants.JAVA_IP_LIST, req, BaseResponse.class);
return rep;
... ... @@ -88,6 +96,10 @@ public class JavaMonitorCtrl {
if ("0".equals(req.getIp())) {
req.setIp("");
}
//0-gateway的默认,-1-all的默认
if(req.getServiceType() == 0){
req.setServiceType(-1);
}
BaseResponse rep = httpClient.defaultPost(HttpUriContants.JAVA_API_LIST, req, BaseResponse.class);
return rep;
}
... ...
... ... @@ -114,6 +114,14 @@
cloudType = 1;
}
getJavaAppType(cloudType);
$("#infoTable").table("load", {
startTime : startTime,
endTime : endTime,
serviceType : serviceType,
serviceName : serviceName,
ip:"",
cloudType :cloudType
});
}
//ip类型选择事件
... ... @@ -134,7 +142,8 @@
type: 'post',
data : {
serviceType:serviceType,
cloudType : cloudType
cloudType : cloudType,
serviceName : serviceName
},
dataType:'json',
success: function (data) {
... ... @@ -169,21 +178,25 @@
if(data.data != null){
//同步加载根据平均耗时排序的tab页列表
var costObj = new Array();
var errorObj = new Array();
for(var j = 0;j<data.data.length;j++){
costObj.push(data.data[j]);
errorObj.push(data.data[j]);
}
//按平均耗时从大到小排序ss
costObj.sort(function(a,b){
if(b.avgCost == a.avgCost){
return b.errorCount-a.errorCount;
}
return b.avgCost-a.avgCost;
});
//同步加载根据异常次数排序的tab页列表
var errorObj = new Array();
for (var i = 0; i < data.data.length; i++) {
errorObj.push(data.data[i]);
}
//按异常次数从大到小排序
errorObj.sort(function (a, b) {
if(b.errorCount == a.errorCount){
return b.avgCost-a.avgCost;
}
return b.errorCount - a.errorCount;
});
$("#infoTable").table("loadLoaclData", errorObj);
... ... @@ -199,10 +212,10 @@
var end = endTime.split(" ");
var div = $("<div>");
var editBtn = $("<button>").addClass("btn btn-xs btn-success").html(rowData.apiName).appendTo(div);
var editBtn = $("<button>").addClass("btn btn-xs btn-success").css("height","35px").html(rowData.apiName).appendTo(div);
editBtn.click(function () {
var dialog = $("<div>").appendTo($("body"));
var url = contextPath + "/javaMonitor/toJavaIpInfoList?serviceName="+serviceName+"&apiName="+rowData.apiName+"&serviceType="+serviceType+"&cloudType="+$("#cloudType").val()
var url = contextPath + "/javaMonitor/toJavaIpInfoList?serviceName="+rowData.serviceName+"&apiName="+rowData.apiName+"&cloudType="+$("#cloudType").val()
+"&startTime1="+start[0]+"&startTime2="+start[1]+"&endTime1="+end[0]+"&endTime2="+end[1];
dialog.dialog({
backdrop: "static",
... ...
... ... @@ -5,7 +5,6 @@
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
String serviceType = request.getParameter("serviceType");
String serviceName = request.getParameter("serviceName");
String startTime1 = request.getParameter("startTime1");
String endTime1 = request.getParameter("endTime1");
... ... @@ -57,7 +56,6 @@
$(function () {
var contextPath = '<%=basePath %>';
var serviceType = "<%=serviceType %>";
var serviceName = "<%=serviceName%>";
var startTime = "<%=startTime1%>"+" "+"<%=startTime2%>";
var endTime = "<%=endTime1%>"+" "+"<%=endTime2%>";
... ... @@ -74,7 +72,6 @@
queryParams : {
startTime : startTime,
endTime : endTime,
serviceType : serviceType,
serviceName : serviceName,
apiName :apiName,
cloudType : cloudType
... ... @@ -87,21 +84,25 @@
if(data.data != null){
//同步加载根据平均耗时排序的tab页列表
var costObj = new Array();
var errorObj = new Array();
for(var j = 0;j<data.data.length;j++){
costObj.push(data.data[j]);
errorObj.push(data.data[j]);
}
//按平均耗时从大到小排序ss
costObj.sort(function(a,b){
if(b.avgCost == a.avgCost){
return b.errorCount-a.errorCount;
}
return b.avgCost-a.avgCost;
});
//同步加载根据异常次数排序的tab页列表
var errorObj = new Array();
for (var i = 0; i < data.data.length; i++) {
errorObj.push(data.data[i]);
}
//按异常次数从大到小排序
errorObj.sort(function (a, b) {
if(b.errorCount == a.errorCount){
return b.avgCost-a.avgCost;
}
return b.errorCount - a.errorCount;
});
$("#javaMonitorForm #ipInfoTable").table("loadLoaclData", errorObj);
... ...
... ... @@ -87,7 +87,7 @@
<div id="infoTableDiv">
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active">
<a href="#ipPart" aria-controls="ipPart" role="tab" data-toggle="tab">IP</a>
<a href="#ipPart" aria-controls="ipPart" role="tab" data-toggle="tab">总请求次数</a>
</li>
<li role="presentation">
<a href="#timesPart" aria-controls="timesPart" role="tab" data-toggle="tab">异常次数</a>
... ... @@ -287,7 +287,11 @@
title = "异常次数-曲线图";
xText = "error times";
}
drawLine(lineType,title,$("#searchApiName").select("getText"),xText,categories,series);
var subTitle = $("#searchApiName").select("getText");
if(subTitle == "all"){
subTitle = "gateway"
}
drawLine(lineType,title,subTitle,xText,categories,series);
}
});
}
... ... @@ -298,10 +302,13 @@
valueField: "typeId",
textField: "typeName",
className: "form-control",
firstText : "all",
firstValue : 0,
url: contextPath + "/type/queryJavaApiType",
loadFilter: function (data) {
return defaultLoadFilter(data);
}
},
value : 0
});
$("#ipInfoTable").table({
... ... @@ -311,37 +318,48 @@
dataType: "json",
sortable: true, //是否启用排序
sortOrder:"desc",
loadFilter: function (data) {
//记录下开始时间和结束时间
paramObj.startTime = data.data.startTime;
paramObj.endTime = data.data.endTime;
return defaultLoadFilter(data).content;
},
onLoadSuccess: function (data) {
//记录第一条ip
if(data!= null){
paramObj.ipName = data[0].ip;
//同步加载根据异常次数排序的tab页列表
var errorObj = new Array();
for(var i = 0;i<data.length;i++){
errorObj.push(data[i]);
}
//按异常次数从大到小排序
errorObj.sort(function(a,b){
return b.errorCount-a.errorCount;
});
$("#infoTable").table("loadLoaclData", errorObj);
//同步加载根据平均耗时排序的tab页列表
var costObj = new Array();
for(var j = 0;j<data.length;j++){
costObj.push(data[j]);
}
//按平均耗时从大到小排序ss
costObj.sort(function(a,b){
return b.avgCost-a.avgCost;
});
$("#infoTable1").table("loadLoaclData", costObj);
if(data.data!= null){
//记录下开始时间和结束时间
paramObj.startTime = data.data.startTime;
paramObj.endTime = data.data.endTime;
if(data.data.content != null){
//根据总请求次数排序
var totalObj = new Array();
var errorObj = new Array();
var costObj = new Array();
for(var k = 0;k<data.data.content.length;k++){
totalObj.push(data.data.content[k]);
errorObj.push(data.data.content[k]);
costObj.push(data.data.content[k]);
}
//按平均耗时从大到小排序ss
totalObj.sort(function(a,b){
return b.totalCount-a.totalCount;
});
$("#ipInfoTable").table("loadLoaclData", totalObj);
//同步加载根据异常次数排序的tab页列表
//按异常次数从大到小排序
errorObj.sort(function(a,b){
if(b.errorCount == a.errorCount){
return b.avgCost-a.avgCost
}
return b.errorCount-a.errorCount;
});
$("#infoTable").table("loadLoaclData", errorObj);
//同步加载根据平均耗时排序的tab页列表
//按平均耗时从大到小排序ss
costObj.sort(function(a,b){
if(b.avgCost == a.avgCost){
return b.errorCount-a.errorCount
}
return b.avgCost-a.avgCost;
});
$("#infoTable1").table("loadLoaclData", costObj);
}
}
},
columns: [{
... ...