From f8a17db5731a8492de79306fdb965924cc4220ec Mon Sep 17 00:00:00 2001 From: ascrutae Date: Wed, 11 May 2016 08:26:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E9=83=A8=E5=88=86=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../skywalking/web/dto/TypicalCallTree.java | 6 + .../web/dto/TypicalCallTreeNode.java | 17 ++- .../service/impl/AnalysisResultService.java | 1 + .../js/analysisResultViewResovler.js | 44 ++++--- .../pages/anls-result/analysisResult.ftl | 113 +++++++----------- .../src/main/webapp/pages/main.ftl | 2 + 6 files changed, 94 insertions(+), 89 deletions(-) diff --git a/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/dto/TypicalCallTree.java b/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/dto/TypicalCallTree.java index 4dbe76d8c..f6916ff59 100644 --- a/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/dto/TypicalCallTree.java +++ b/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/dto/TypicalCallTree.java @@ -19,4 +19,10 @@ public class TypicalCallTree { public void addNode(TypicalCallTreeNode typicalCallTreeNode) { this.treeNodes.put(typicalCallTreeNode.getNodeToken(), typicalCallTreeNode); } + + public void beautifulViewPointForShow() { + for (Map.Entry entry : treeNodes.entrySet()) { + entry.getValue().beautifulViewPoint(); + } + } } diff --git a/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/dto/TypicalCallTreeNode.java b/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/dto/TypicalCallTreeNode.java index c22bd5f06..a8e97fe28 100644 --- a/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/dto/TypicalCallTreeNode.java +++ b/skywalking-webui/src/main/java/com/ai/cloud/skywalking/web/dto/TypicalCallTreeNode.java @@ -9,20 +9,29 @@ import com.ai.cloud.skywalking.web.util.TokenGenerator; public class TypicalCallTreeNode { private String nodeToken; private String viewPoint; - private String levelId; + private String viewPointStr; + private String traceLevelId; public TypicalCallTreeNode(String parentLevelId, String levelId, String viewPoint) { if (StringUtil.isBlank(parentLevelId)){ - this.levelId = levelId; + this.traceLevelId = levelId; }else{ - this.levelId = parentLevelId + "." + levelId; + this.traceLevelId = parentLevelId + "." + levelId; } this.viewPoint = viewPoint; - nodeToken = TokenGenerator.generate(levelId + ":" + viewPoint); + this.viewPointStr = viewPoint; + nodeToken = TokenGenerator.generate(this.traceLevelId + ":" + viewPoint); } public String getNodeToken() { return nodeToken; } + + 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 99ce7dbf8..53bd9c17e 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 @@ -99,6 +99,7 @@ public class AnalysisResultService implements IAnalysisResultService { List typicalCallTrees = new ArrayList(); for (String callTreeId : typicalCallTreeIds) { TypicalCallTree typicalCallTree = typicalCallTreeDao.queryCallChainTree(callTreeId); + typicalCallTree.beautifulViewPointForShow(); typicalCallTrees.add(typicalCallTree); } diff --git a/skywalking-webui/src/main/webapp/bower_components/skywalking/js/analysisResultViewResovler.js b/skywalking-webui/src/main/webapp/bower_components/skywalking/js/analysisResultViewResovler.js index 69520c69a..4efe9161f 100644 --- a/skywalking-webui/src/main/webapp/bower_components/skywalking/js/analysisResultViewResovler.js +++ b/skywalking-webui/src/main/webapp/bower_components/skywalking/js/analysisResultViewResovler.js @@ -27,15 +27,13 @@ AnalysisResultViewResolver.prototype.bindEvent = function () { } - AnalysisResultViewResolver.prototype.callChainTreeData = []; AnalysisResultViewResolver.prototype.callEntrance = {}; AnalysisResultViewResolver.prototype.typicCallChainData = []; -AnalysisResultViewResolver.prototype.currentTypicalTreeNodeMapping = []; +AnalysisResultViewResolver.prototype.currentTypicalTreeNodes = {callChainTreeNodeList:[]}; +AnalysisResultViewResolver.prototype.currentTypicalTreeNodeMapping={typicalTreeIds:[]}; AnalysisResultViewResolver.prototype.showTypicalCallTree = function (nodeToken) { - - for (var i = 0; i < this.typicCallChainData.length; i++) { var node = this.typicCallChainData[i]; var tmpInfo = node.treeNodes[nodeToken]; @@ -43,18 +41,16 @@ AnalysisResultViewResolver.prototype.showTypicalCallTree = function (nodeToken) continue; } - var tmpTypicalCallChain = {}; - tmpTypicalCallChain.callTreeId = node.callTreeId; + var tmpTypicalCallChain = []; for (var key in node.treeNodes) { var tmpNode = node.treeNodes[key]; - tmpNode.analyResult = JSON.parse($("#" + key).text()); - tmpTypicalCallChain.nodes.push(tmpNode); + tmpNode.anlyResult = JSON.parse($("#" + key).text()); + tmpTypicalCallChain.push(key); + this.currentTypicalTreeNodes.callChainTreeNodeList.push(tmpNode); } - this.currentTypicalTreeNodeMapping.push(tmpTypicalCallChain); + this.currentTypicalTreeNodeMapping[node.callTreeId] = tmpTypicalCallChain; + this.currentTypicalTreeNodeMapping.typicalTreeIds.push(node.callTreeId); } - - alert(currentTypicalTreeNodeMapping); - } AnalysisResultViewResolver.prototype.loadData = function (analyType, analyDate) { @@ -84,6 +80,26 @@ AnalysisResultViewResolver.prototype.loadData = function (analyType, analyDate) var htmlOutput = template.render({}); $("#mainPanel").empty(); $("#mainPanel").html(htmlOutput); + + template = $.templates("#typicalTreeCheckBoxTmpl"); + htmlOutput = template.render({"typicalTreeIds": self.currentTypicalTreeNodeMapping.typicalTreeIds}); + alert(htmlOutput); + $("#typicalCheckBoxDiv").empty(); + $("#typicalCheckBoxDiv").html(htmlOutput); + + $("input[name='typicalTreeCheckBox']").each(function(){ + $(this).change(function(){ + var treeIds = new Array(); + $("input[name='typicalTreeCheckBox']").each(function(){ + + }); + }); + }); + + template = $.templates("#typicalTreeTableTmpl"); + var htmlOutput = template.render((self.convertAnalysisResult(self.currentTypicalTreeNodes))); + $("#typicalTreeTableDataBody").empty(); + $("#typicalTreeTableDataBody").html(htmlOutput); }) }); } @@ -122,10 +138,6 @@ AnalysisResultViewResolver.prototype.convertAnalysisResult = function (originDat var flag = false; for (var i = 0; i < originData.callChainTreeNodeList.length; i++) { var node = originData.callChainTreeNodeList[i]; - if (node.traceLevelId == "0") { - self.callEntrance = node; - } - if (previousNodeLevelId == node.traceLevelId) { if (count == 1) { index = i - 1; 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 9c19dea0a..7c2055492 100644 --- a/skywalking-webui/src/main/webapp/pages/anls-result/analysisResult.ftl +++ b/skywalking-webui/src/main/webapp/pages/anls-result/analysisResult.ftl @@ -46,12 +46,13 @@
+ <#macro analysisResultTableTmpl> @@ -114,11 +116,7 @@
-
-       归属该节点下所有的典型调用链: - 典型调用链1  - 典型调用链2  - 典型调用链3 +

@@ -126,79 +124,56 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
LevelId ViewPoint应用 调用次数 正确次数错误次数 正确率 平均耗时
0Http://localhost:8080/order/save1Order-Application1001000100%20.0ms
0.0  com.ai.aisse.core.service.impl...taServiceImpl.SynchAisseData()Account-Application1001000100%20.0ms
0.0  com.ai.aisse.core.dao.impl.Syn...taDaoImpl.queryAppAisseTimer()Biling-Application1001000100%20.0ms
0.2  tracing:jdbc:oracle:thin:@10.1.1.61:1521:OAPROD(aisse)Order-Application1001000100%20.0ms
0.3  com.ai.aisse.core.dao.impl.Syn...AisseTimer(java.sql.Timestamp)Order-Application1001000100%20.0ms
0.0  tracing:jdbc:oracle:thin:@10.1.1.61:1521:OAPROD(aisse)Order-Application1001000100%20.0ms
+ + + + +<#macro typicalCallChainCheckBox> + + + +<#macro typicalCallChainTreeTable> + diff --git a/skywalking-webui/src/main/webapp/pages/main.ftl b/skywalking-webui/src/main/webapp/pages/main.ftl index 41d9b14e9..e8745de6e 100644 --- a/skywalking-webui/src/main/webapp/pages/main.ftl +++ b/skywalking-webui/src/main/webapp/pages/main.ftl @@ -46,6 +46,8 @@ <@anlyResult.analysisResult/> <@anlyResult.analysisResultTableTmpl/> <@anlyResult.typicalCallChainTrees/> +<@anlyResult.typicalCallChainTreeTable/> +<@anlyResult.typicalCallChainCheckBox/>