From c7e7dd3fcb0f50828e8a209fc9bdf3afea99c0ed Mon Sep 17 00:00:00 2001 From: Chisu Yu Date: Tue, 23 Oct 2012 04:47:10 +0000 Subject: [PATCH] =?UTF-8?q?[=EC=9C=A0=EC=B9=98=EC=88=98]=20[NOBTS]=20show?= =?UTF-8?q?=20each=20transaction=20processing=20time.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://svn.bds.nhncorp.com/pe/hippo-web/trunk@816 84d0f5b1-2673-498c-a247-62c4ff18d310 --- .../nhn/hippo/web/vo/BusinessTransaction.java | 20 +++++++------ src/main/java/com/nhn/hippo/web/vo/Trace.java | 20 +++++++++++++ src/main/webapp/WEB-INF/views/flowserver.jsp | 28 +++++++++---------- src/main/webapp/index.html | 8 ++++-- 4 files changed, 50 insertions(+), 26 deletions(-) create mode 100644 src/main/java/com/nhn/hippo/web/vo/Trace.java diff --git a/src/main/java/com/nhn/hippo/web/vo/BusinessTransaction.java b/src/main/java/com/nhn/hippo/web/vo/BusinessTransaction.java index 228151a04..9fcacb402 100644 --- a/src/main/java/com/nhn/hippo/web/vo/BusinessTransaction.java +++ b/src/main/java/com/nhn/hippo/web/vo/BusinessTransaction.java @@ -8,7 +8,7 @@ import com.profiler.common.bo.AnnotationBo; import com.profiler.common.bo.SpanBo; public class BusinessTransaction { - private final List traces = new ArrayList(); + private final List traces = new ArrayList(); private final String name; private int calls = 0; @@ -18,8 +18,6 @@ public class BusinessTransaction { public BusinessTransaction(SpanBo span) { this.name = span.getName(); - this.traces.add(new UUID(span.getMostTraceId(), span.getLeastTraceId()).toString()); - calls++; List annotations = span.getAnnotationBoList(); long begin = 0; @@ -34,14 +32,12 @@ public class BusinessTransaction { } long elapsed = end - begin; totalTime = maxTime = minTime = elapsed; + + this.traces.add(new Trace(new UUID(span.getMostTraceId(), span.getLeastTraceId()).toString(), elapsed)); + calls++; } public void add(SpanBo span) { - this.traces.add(new UUID(span.getMostTraceId(), span.getLeastTraceId()).toString()); - if (span.getParentSpanId() == -1) { - calls++; - } - List annotations = span.getAnnotationBoList(); long begin = 0; long end = 0; @@ -59,13 +55,19 @@ public class BusinessTransaction { maxTime = elapsed; if (minTime > elapsed) minTime = elapsed; + + this.traces.add(new Trace(new UUID(span.getMostTraceId(), span.getLeastTraceId()).toString(), elapsed)); + + if (span.getParentSpanId() == -1) { + calls++; + } } public String getName() { return name; } - public List getTraces() { + public List getTraces() { return traces; } diff --git a/src/main/java/com/nhn/hippo/web/vo/Trace.java b/src/main/java/com/nhn/hippo/web/vo/Trace.java new file mode 100644 index 000000000..f88652259 --- /dev/null +++ b/src/main/java/com/nhn/hippo/web/vo/Trace.java @@ -0,0 +1,20 @@ +package com.nhn.hippo.web.vo; + +public class Trace { + + private final String traceId; + private final long time; + + public Trace(String traceId, long time) { + this.traceId = traceId; + this.time = time; + } + + public String getTraceId() { + return traceId; + } + + public long getTime() { + return time; + } +} diff --git a/src/main/webapp/WEB-INF/views/flowserver.jsp b/src/main/webapp/WEB-INF/views/flowserver.jsp index 54ed0f344..9ce52ac69 100644 --- a/src/main/webapp/WEB-INF/views/flowserver.jsp +++ b/src/main/webapp/WEB-INF/views/flowserver.jsp @@ -3,41 +3,41 @@ { "graphdata": { -"nodes": +"nodes" : [ - {"name":"${node.endPoint}"} + { "name" : "${node.endPoint}" } - {"name":"${node}"} + { "name" : "${node}" } , ], -"links": +"links" : [ - {"source":${link.from.sequence},"target":${link.to.sequence},"value":${link.callCount}} + {"source" : ${link.from.sequence}, "target" : ${link.to.sequence}, "value" : ${link.callCount}} , ] }, -"businessTransactions": +"businessTransactions" : [ { - "name":"${t.name}", - "calls":${t.calls}, - "time":${t.totalTime / t.calls}, - "minTime":${t.minTime}, - "maxTime":${t.maxTime}, - "health":1, - "traces": + "name" : "${t.name}", + "calls" : ${t.calls}, + "time" : ${t.totalTime / t.calls}, + "minTime" : ${t.minTime}, + "maxTime" : ${t.maxTime}, + "health" : 1, + "traces" : [ - "${trace}" + { "traceId" : "${trace.traceId}", "time" : ${trace.time} } , ] diff --git a/src/main/webapp/index.html b/src/main/webapp/index.html index 7b14197e8..6e79e223f 100644 --- a/src/main/webapp/index.html +++ b/src/main/webapp/index.html @@ -358,12 +358,14 @@ function openTransactionDetails(index, row) { html.push(""); html.push(""); - html.push(traces[i]); + html.push(traces[i].traceId); html.push(""); - html.push(" "); + html.push(""); + html.push(traces[i].time); + html.push(""); html.push(""); }