diff --git a/skywalking-webui/demo/searchResult.html b/skywalking-webui/demo/searchResult.html index b5e7d883a..fe88ebd6c 100644 --- a/skywalking-webui/demo/searchResult.html +++ b/skywalking-webui/demo/searchResult.html @@ -1,89 +1,105 @@ + - + + -
-
-
- - - +
+
+
+ + + +
+
+
+ + 搜索
-
-
- - 搜索 -
+
+
+ +
+
+
+
+
+
+
+

http://localhost:8080/ordersave

+

+ http://localhost:8080/ordersave +
+ com.ai.test.controller.com.ai.test.controllersaveOrder() +
+ com.ai.test.controller.saveOrder() +
+ com.ai.test.controller.saveOrder() +
+ com.ai.test.controller.saveOrder() +
+ .... +
+

+

2016年03月已经被调用100次,成功100次,失败0次 more

+
+
+
+

http://localhost:8080/ordersave

+

http://localhost:8080/ordersave +
  com.ai.test.controller.com.ai.test.controllersaveOrder() +
    com.ai.test.controller.saveOrder() +
       com.ai.test.controller.saveOrder() +
  com.ai.test.controller.saveOrder() +
.... +

+

2016年03月已经被调用100次,成功100次,失败0次 more

+
+
+
+

http://localhost:8080/ordersave

+

http://localhost:8080/ordersave +
  com.ai.test.controller.com.ai.test.controllersaveOrder() +
    com.ai.test.controller.saveOrder() +
       com.ai.test.controller.saveOrder() +
  com.ai.test.controller.saveOrder() +
.... +

+

2016年03月已经被调用100次,成功100次,失败0次 more

+
+
+
-
- +
+ afafdasd

-
-
-
-
-

http://localhost:8080/ordersave

-

http://localhost:8080/ordersave
-   com.ai.test.controller.com.ai.test.controllersaveOrder()
-     com.ai.test.controller.saveOrder()
-        com.ai.test.controller.saveOrder()
-   com.ai.test.controller.saveOrder()
- .... -

-

2016年03月已经被调用100次,成功100次,失败0次 more

-
-
-
-

http://localhost:8080/ordersave

-

http://localhost:8080/ordersave
-   com.ai.test.controller.com.ai.test.controllersaveOrder()
-     com.ai.test.controller.saveOrder()
-        com.ai.test.controller.saveOrder()
-   com.ai.test.controller.saveOrder()
- .... -

-

2016年03月已经被调用100次,成功100次,失败0次 more

-
-
-
-

http://localhost:8080/ordersave

-

http://localhost:8080/ordersave
-   com.ai.test.controller.com.ai.test.controllersaveOrder()
-     com.ai.test.controller.saveOrder()
-        com.ai.test.controller.saveOrder()
-   com.ai.test.controller.saveOrder()
- .... -

-

2016年03月已经被调用100次,成功100次,失败0次 more

-
-
-
-
- afafdasd -
-
-
+ diff --git a/skywalking-webui/demo/treeDetail.html b/skywalking-webui/demo/treeDetail.html index 233ea3725..2711cc151 100644 --- a/skywalking-webui/demo/treeDetail.html +++ b/skywalking-webui/demo/treeDetail.html @@ -4,14 +4,42 @@ - + + + @@ -50,129 +78,165 @@
-
- +
+
+
+ + +
+ + + + + +
+ +
+ + +
+
+
+
+ - + + + + - + + + + - + + + - + - + + + - + + - + + + + - + + + - + + +
LevelId ViewPoint 应用 调用次数平均耗时正确次数 错误次数正确率平均耗时
0 Http://localhost:8080/order/save1 Order-Application 10020.0ms100 0100%20.0ms
0.0   com.ai.aisse.core.service.impl...taServiceImpl.SynchAisseData() Account-Application 10020.0ms100 0100%20.0ms
    com.ai.aisse.core.dao.impl.Syn...taDaoImpl.queryAppAisseTimer()  com.ai.aisse.core.dao.impl.Syn...taDaoImpl.queryAppAisseTimer() Biling-Application 10020.0ms100 0100%20.0ms
      tracing:jdbc:oracle:thin:@10.1.1.61:1521:OAPROD(aisse)0.2  tracing:jdbc:oracle:thin:@10.1.1.61:1521:OAPROD(aisse) Order-Application 10020.0ms100 0100%20.0ms
0.3   com.ai.aisse.core.dao.impl.Syn...AisseTimer(java.sql.Timestamp) Order-Application 10020.0ms100 0100%20.0ms
  tracing:jdbc:oracle:thin:@10.1.1.61:1521:OAPROD(aisse) Order-Application 10020.0ms100 0100%20.0ms

-
-
-
- -
-
-
- - - - - - - - - - - - - - - - - - - -
- - 正常调用链A
- - 正常调用链A
- - 正常调用链A
- - 正常调用链A
-
-
diff --git a/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/controller/AnalysisResultController.java b/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/controller/AnalysisResultController.java index 060ab5f9a..8d31b146a 100644 --- a/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/controller/AnalysisResultController.java +++ b/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/controller/AnalysisResultController.java @@ -5,6 +5,8 @@ import com.ai.cloud.skywalking.web.dto.CallChainTree; import com.ai.cloud.skywalking.web.dto.LoginUserInfo; import com.ai.cloud.skywalking.web.service.inter.IAnalysisResultService; import com.alibaba.fastjson.JSONObject; +import com.google.gson.Gson; +import com.google.gson.JsonObject; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; @@ -18,7 +20,7 @@ import javax.servlet.http.HttpServletRequest; /** * Created by xin on 16-4-5. */ -@RequestMapping("/usr/applications") +@RequestMapping("/analy") @Controller public class AnalysisResultController extends BaseController { @@ -27,8 +29,9 @@ public class AnalysisResultController extends BaseController { @Autowired private IAnalysisResultService analysisResultService; - @RequestMapping("/anlsResult") - public String analysisResult() { + @RequestMapping("/mainPage") + public String analysisResult(String treeId, HttpServletRequest request) { + request.setAttribute("treeId", treeId); return "anls-result/analysisResult"; } @@ -44,12 +47,18 @@ public class AnalysisResultController extends BaseController { @PathVariable("analyDate") String analyDate) { JSONObject result = new JSONObject(); try { - LoginUserInfo userInfo = fetchLoginUserInfoFromSession(request); + // LoginUserInfo userInfo = fetchLoginUserInfoFromSession(request); CallChainTree callChainTree = analysisResultService. fetchAnalysisResult(treeId, analyType, analyDate); + result.put("code", "200"); + if (callChainTree != null) { + result.put("result", new Gson().toJson(callChainTree)); + }else{ + result.put("result", "{}"); + } } catch (Exception e) { logger.error("Failed to load treeId[{}], anlysisType:[{}], anlyDate:[{}]", treeId, analyType, analyDate); - logger.error(e); + e.printStackTrace(); result.put("code", "500"); result.put("message", "Fatal error"); } diff --git a/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/dao/impl/CallChainTreeDao.java b/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/dao/impl/CallChainTreeDao.java index 8f5e3a3e8..808a2a3fa 100644 --- a/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/dao/impl/CallChainTreeDao.java +++ b/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/dao/impl/CallChainTreeDao.java @@ -23,6 +23,7 @@ import org.springframework.stereotype.Repository; import java.io.IOException; import java.util.Calendar; +import java.util.Collections; import java.util.Map; @Repository @@ -35,7 +36,7 @@ public class CallChainTreeDao implements ICallChainTreeDao { @Override public AnlyResult queryEntranceAnlyResult(String entranceColumnName, String treeId) throws IOException { - String columnName = null; + String columnName = entranceColumnName; if (entranceColumnName.lastIndexOf(":") != -1) { columnName = entranceColumnName.substring(0, entranceColumnName.length() - 1); } @@ -85,6 +86,7 @@ public class CallChainTreeDao implements ICallChainTreeDao { chainTree.addNode(callChainTreeNode); } + return chainTree; } } diff --git a/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/dto/CallChainTree.java b/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/dto/CallChainTree.java index 72ee8092b..f48c4f2a7 100644 --- a/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/dto/CallChainTree.java +++ b/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/dto/CallChainTree.java @@ -22,4 +22,18 @@ public class CallChainTree { public void setTreeId(String treeId) { this.treeId = treeId; } + + public List getCallChainTreeNodeList() { + return callChainTreeNodeList; + } + + public void setCallChainTreeNodeList(List callChainTreeNodeList) { + this.callChainTreeNodeList = callChainTreeNodeList; + } + + public void beautifulViewPointForShow() { + for (CallChainTreeNode node : callChainTreeNodeList){ + node.beautifulViewPoint(); + } + } } diff --git a/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/dto/CallChainTreeNode.java b/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/dto/CallChainTreeNode.java index ecfbea632..f217fee8f 100644 --- a/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/dto/CallChainTreeNode.java +++ b/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/dto/CallChainTreeNode.java @@ -1,11 +1,11 @@ package com.ai.cloud.skywalking.web.dto; +import com.ai.cloud.skywalking.web.util.StringUtil; import com.google.gson.Gson; import com.google.gson.JsonObject; import com.google.gson.JsonParser; import com.google.gson.reflect.TypeToken; -import java.util.Calendar; import java.util.Map; /** @@ -18,15 +18,16 @@ public class CallChainTreeNode { private AnlyResult anlyResult; public CallChainTreeNode(String qualifierStr, String valueStr, String loadKey) { - String[] qualifierArray = qualifierStr.split("@"); - traceLevelId = qualifierArray[0]; - viewPoint = qualifierArray[1]; + traceLevelId = qualifierStr.substring(0, qualifierStr.indexOf("@")); + viewPoint = qualifierStr.substring(qualifierStr.indexOf("@") + 1); JsonObject jsonObject = (JsonObject) new JsonParser().parse(valueStr); Map resultMap = new Gson().fromJson(jsonObject.getAsJsonObject("summaryValueMap"), new TypeToken>() { }.getType()); anlyResult = resultMap.get(loadKey); - + if (anlyResult == null){ + anlyResult = new AnlyResult(); + } } public String getTraceLevelId() { @@ -36,4 +37,11 @@ public class CallChainTreeNode { public String getViewPoint() { return viewPoint; } + + public void beautifulViewPoint() { + if (!StringUtil.isBlank(viewPoint) && viewPoint.length() > 80) { + viewPoint = viewPoint.substring(0, 50) + "..." + + viewPoint.substring(viewPoint.length() - 50); + } + } } diff --git a/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/service/impl/AnalysisResultService.java b/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/service/impl/AnalysisResultService.java index d2d185a4d..736905ea0 100644 --- a/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/service/impl/AnalysisResultService.java +++ b/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/service/impl/AnalysisResultService.java @@ -2,6 +2,7 @@ package com.ai.cloud.skywalking.web.service.impl; import com.ai.cloud.skywalking.web.dao.inter.ICallChainTreeDao; import com.ai.cloud.skywalking.web.dto.CallChainTree; +import com.ai.cloud.skywalking.web.dto.CallChainTreeNode; import com.ai.cloud.skywalking.web.service.inter.IAnalysisResultService; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -12,6 +13,8 @@ import java.io.IOException; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; +import java.util.Collections; +import java.util.Comparator; import java.util.Date; /** @@ -43,8 +46,7 @@ public class AnalysisResultService implements IAnalysisResultService { Date date = format.parse(analyDate); Calendar calendar = Calendar.getInstance(); calendar.setTime(date); - rowKey = treeId + "/" + calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH) + 1) - + "-" + calendar.get(Calendar.DAY_OF_MONTH); + rowKey = treeId + "/" + calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH) + 1); loadKey = calendar.get(Calendar.DAY_OF_MONTH) + ""; tableName = "sw-chain-1day-summary"; } else if ("HOUR".equals(analyType)) { @@ -64,7 +66,17 @@ public class AnalysisResultService implements IAnalysisResultService { logger.info("fetchAnalysisResult: tableName :{}, rowKey : {}, loadKey:{}", tableName, rowKey, loadKey); CallChainTree callChainTree = callChainTreeDao.queryAnalysisCallTree(tableName, rowKey, loadKey); - callChainTree.setTreeId(treeId); + if (callChainTree != null) { + callChainTree.setTreeId(treeId); + Collections.sort(callChainTree.getCallChainTreeNodeList(), new Comparator() { + @Override + public int compare(CallChainTreeNode o1, CallChainTreeNode o2) { + return o1.getTraceLevelId().compareTo(o2.getTraceLevelId()); + } + }); + callChainTree.beautifulViewPointForShow(); + } + return callChainTree; } } diff --git a/skywalking-webui/src/main/resources/log4j2.xml b/skywalking-webui/src/main/resources/log4j2.xml index 5d274655b..91e20d37a 100644 --- a/skywalking-webui/src/main/resources/log4j2.xml +++ b/skywalking-webui/src/main/resources/log4j2.xml @@ -2,7 +2,7 @@ - + diff --git a/skywalking-webui/src/main/webapp/bower_components/skywalking/css/tracelog.css b/skywalking-webui/src/main/webapp/bower_components/skywalking/css/tracelog.css index 83eb4b1f7..6190da430 100644 --- a/skywalking-webui/src/main/webapp/bower_components/skywalking/css/tracelog.css +++ b/skywalking-webui/src/main/webapp/bower_components/skywalking/css/tracelog.css @@ -34,3 +34,29 @@ .highlight-viewpoint { background-color: #baec7e; } + +table.gridtable { + font-family: verdana, arial, sans-serif; + font-size: 0.8em; + line-height: 1; + color: #333333; + border-width: 1px; + border-color: #666666; + border-collapse: collapse; +} + +table.gridtable th { + border-width: 1px; + padding: 0.3em 1em; + border-style: solid; + border-color: #666666; + background-color: #dedede; +} + +table.gridtable td { + border-width: 1px; + padding: 0.3em 1em; + border-style: solid; + border-color: #666666; + background-color: #ffffff; +} \ No newline at end of file diff --git a/skywalking-webui/src/main/webapp/pages/anls-result/analysisResult.ftl b/skywalking-webui/src/main/webapp/pages/anls-result/analysisResult.ftl index 5e9cd8599..c14a33b90 100644 --- a/skywalking-webui/src/main/webapp/pages/anls-result/analysisResult.ftl +++ b/skywalking-webui/src/main/webapp/pages/anls-result/analysisResult.ftl @@ -1,3 +1,4 @@ +<#import "../common/commons.ftl" as common> @@ -5,22 +6,273 @@ <@common.importResources /> - - - - - - - - - + + - + <@common.navbar/>
+
+
+
+
+ + +
+ + + + +
+
+
+ 上个小时     + 昨天     + 本月     + 上月     +
+
+
+
+
+ + + + + + + + + + + + + + + +
LevelIdViewPoint调用次数正确次数正确率平均耗时
+
+
+ +
\ No newline at end of file diff --git a/skywalking-webui/src/main/webapp/pages/anls-result/analysisSearchResult.ftl b/skywalking-webui/src/main/webapp/pages/anls-result/analysisSearchResult.ftl index 7d60e80f9..fa9cfbb31 100644 --- a/skywalking-webui/src/main/webapp/pages/anls-result/analysisSearchResult.ftl +++ b/skywalking-webui/src/main/webapp/pages/anls-result/analysisSearchResult.ftl @@ -13,7 +13,7 @@ <#macro anlyResultDisplayTmpl>