diff --git a/cat-home/pom.xml b/cat-home/pom.xml index e5e10e32049828e474083f32fd4178e6b3b55b38..edbedae381aa89088ed1bdef7c3d9936b2e2619c 100755 --- a/cat-home/pom.xml +++ b/cat-home/pom.xml @@ -184,7 +184,9 @@ ${basedir}/src/main/resources/META-INF/dal/model/topology-graph-config-manifest.xml, ${basedir}/src/main/resources/META-INF/dal/model/info-manifest.xml, ${basedir}/src/main/resources/META-INF/dal/model/exception-threshold-config-manifest.xml, - ${basedir}/src/main/resources/META-INF/dal/model/threshold-template-manifest.xml, + ${basedir}/src/main/resources/META-INF/dal/model/threshold-template-manifest.xml, + ${basedir}/src/main/resources/META-INF/dal/model/bug-manifest.xml, + ${basedir}/src/main/resources/META-INF/dal/model/bug-config-manifest.xml, diff --git a/cat-home/src/main/java/com/dianping/cat/report/page/metric/MetricDisplay.java b/cat-home/src/main/java/com/dianping/cat/report/page/metric/MetricDisplay.java index ea22d8f4c2e5d442e1a5894fc49d444cda4bb5da..6fe2fdc857191b50961c9f34c5a1d0134d8f5ecb 100644 --- a/cat-home/src/main/java/com/dianping/cat/report/page/metric/MetricDisplay.java +++ b/cat-home/src/main/java/com/dianping/cat/report/page/metric/MetricDisplay.java @@ -48,7 +48,7 @@ public class MetricDisplay extends BaseVisitor{ private static final String AVG = MetricType.AVG.name(); - private static final int INTERVAL = 10; + private static final int INTERVAL = 1; private static final int HOUR = 24; @@ -224,7 +224,7 @@ public class MetricDisplay extends BaseVisitor{ if (day == null) { continue; } - value[i] = avgOfArray(day, j); + value[i] = day[j]; } lineChart.addSubTitle("Baseline"); lineChart.addValue(value); @@ -249,7 +249,7 @@ public class MetricDisplay extends BaseVisitor{ resultMap.put(subTitle, newValue); } for (int j = 0; j < MINUTE / INTERVAL; j++) { - newValue[index * 6 + j] = avgOfArray(value,j*INTERVAL); + newValue[index * MINUTE / INTERVAL + j] = value[j*INTERVAL]; } i++; } @@ -262,21 +262,21 @@ public class MetricDisplay extends BaseVisitor{ } } - private double avgOfArray(double[]values, int j){ - double result = 0; - int size = 0; - for(int i = j; i < j+INTERVAL; i++){ - if(values[i] >= 0){ - result +=values[i]; - size ++; - } - } - if(size == 0){ - return result; - } else{ - return result /size; - } - } +// private double avgOfArray(double[]values, int j){ +// double result = 0; +// int size = 0; +// for(int i = j; i < j+INTERVAL; i++){ +// if(values[i] >= 0){ +// result +=values[i]; +// size ++; +// } +// } +// if(size == 0){ +// return result; +// } else{ +// return result /size; +// } + // } public void setBaselineService(BaselineService baselineService) { m_baselineService = baselineService; diff --git a/cat-home/src/main/resources/META-INF/dal/model/bug-codegen.xml b/cat-home/src/main/resources/META-INF/dal/model/bug-codegen.xml new file mode 100644 index 0000000000000000000000000000000000000000..c4501e5c1eb1767d20e170e23abda79087208bc7 --- /dev/null +++ b/cat-home/src/main/resources/META-INF/dal/model/bug-codegen.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/cat-home/src/main/resources/META-INF/dal/model/bug-config-codegen.xml b/cat-home/src/main/resources/META-INF/dal/model/bug-config-codegen.xml new file mode 100644 index 0000000000000000000000000000000000000000..36768e3dc1f8948b4cb6d9e7e94868da44190aaa --- /dev/null +++ b/cat-home/src/main/resources/META-INF/dal/model/bug-config-codegen.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/cat-home/src/main/resources/META-INF/dal/model/bug-config-manifest.xml b/cat-home/src/main/resources/META-INF/dal/model/bug-config-manifest.xml new file mode 100644 index 0000000000000000000000000000000000000000..8f1a3c9a15183bbabf598438bc8e6617391bc2dd --- /dev/null +++ b/cat-home/src/main/resources/META-INF/dal/model/bug-config-manifest.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/cat-home/src/main/resources/META-INF/dal/model/bug-config-model.xml b/cat-home/src/main/resources/META-INF/dal/model/bug-config-model.xml new file mode 100644 index 0000000000000000000000000000000000000000..e16c662bc303b1f8b9ac1e345c653175c6b507ae --- /dev/null +++ b/cat-home/src/main/resources/META-INF/dal/model/bug-config-model.xml @@ -0,0 +1,4 @@ + + + diff --git a/cat-home/src/main/resources/META-INF/dal/model/bug-manifest.xml b/cat-home/src/main/resources/META-INF/dal/model/bug-manifest.xml new file mode 100644 index 0000000000000000000000000000000000000000..8d46795e47e52cfe046ffdea1131506ada727d1d --- /dev/null +++ b/cat-home/src/main/resources/META-INF/dal/model/bug-manifest.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/cat-home/src/main/resources/META-INF/dal/model/bug-model.xml b/cat-home/src/main/resources/META-INF/dal/model/bug-model.xml new file mode 100644 index 0000000000000000000000000000000000000000..2e0b0b6dd2f92e7be96f1501b09b13b6530392b8 --- /dev/null +++ b/cat-home/src/main/resources/META-INF/dal/model/bug-model.xml @@ -0,0 +1,4 @@ + + + diff --git a/cat-home/src/main/resources/META-INF/wizard/model/wizard.xml b/cat-home/src/main/resources/META-INF/wizard/model/wizard.xml index e8643c33c012b306f7fffd7241db920f62c386cd..3a5ae7cc0391814e1502f10b3bfc6e55cbeb5963 100644 --- a/cat-home/src/main/resources/META-INF/wizard/model/wizard.xml +++ b/cat-home/src/main/resources/META-INF/wizard/model/wizard.xml @@ -12,4 +12,10 @@ src/test/resources/com/dianping/cat/report/page/dependency/exception-threshold-config.xml + + src/test/resources/com/dianping/cat/report/page/bug/bug.xml + + + src/test/resources/com/dianping/cat/report/page/bug/bug-config.xml + diff --git a/cat-home/src/main/resources/config/default-exception-threshold-config.xml b/cat-home/src/main/resources/config/default-exception-threshold-config.xml index 22935464a917ee0e8d3fccc489093790763567cf..14d59f3e8262a52c08b010e8fffd5a51cd43e72c 100644 --- a/cat-home/src/main/resources/config/default-exception-threshold-config.xml +++ b/cat-home/src/main/resources/config/default-exception-threshold-config.xml @@ -7,3 +7,4 @@ + diff --git a/cat-home/src/main/webapp/jsp/report/dependency/dependencyDashboard.jsp b/cat-home/src/main/webapp/jsp/report/dependency/dependencyDashboard.jsp index 6f428b92107027dd7f748ad934bafa923108ee76..eb58d56f7f35c6f2642ec8be3083501656b82cae 100644 --- a/cat-home/src/main/webapp/jsp/report/dependency/dependencyDashboard.jsp +++ b/cat-home/src/main/webapp/jsp/report/dependency/dependencyDashboard.jsp @@ -119,10 +119,10 @@ col:3, colInside:5, //模块距上沿距离 - paddingUp: 0, + paddingUp: 10, //小方块间的间隔比率 - blockPaddingRatio: 0.5, - leftTitlePaddingRatio: 0.5, + blockPaddingRatio: 0.2, + leftTitlePaddingRatio: 0.05, showLeft: true, showUp: false }); diff --git a/cat-home/src/test/java/com/dianping/cat/demo/TestBusinessMessage.java b/cat-home/src/test/java/com/dianping/cat/demo/TestBusinessMessage.java index 4f7279f341512691060673eef13c8d0b5b387527..39bb1577da2955aceb036781270382d178198349 100644 --- a/cat-home/src/test/java/com/dianping/cat/demo/TestBusinessMessage.java +++ b/cat-home/src/test/java/com/dianping/cat/demo/TestBusinessMessage.java @@ -6,6 +6,7 @@ import com.dianping.cat.Cat; import com.dianping.cat.message.Event; import com.dianping.cat.message.Transaction; import com.dianping.cat.message.spi.MessageTree; +import com.dianping.cat.message.spi.internal.DefaultMessageTree; public class TestBusinessMessage { private static final String TuanGou = "TuanGouWeb"; @@ -45,7 +46,7 @@ public class TestBusinessMessage { t.addData("channel=channel" + i % 5); t.complete(); } - + for (int i = 0; i < 1000; i++) { Transaction t = Cat.newTransaction("URL", "t"); Cat.logEvent("RemoteLink", "sina", Event.SUCCESS, "http://sina.com.cn/"); @@ -63,11 +64,10 @@ public class TestBusinessMessage { t.complete(); } - Thread.sleep(1000); } } - + @Test public void test2() throws Exception { while (true) { @@ -98,4 +98,19 @@ public class TestBusinessMessage { } } + @Test + public void test3() throws InterruptedException { + for (int i = 0; i < 500; i++) { + Transaction t = Cat.newTransaction("test", "test"); + + Cat.logMetricForCount("MemberCardSuccess"); + Cat.logMetricForCount("MemberCardFail", 2); + + MessageTree tree = Cat.getManager().getThreadLocalMessageTree(); + ((DefaultMessageTree) tree).setDomain("MobileMembercardMainApiWeb"); + t.complete(); + } + Thread.sleep(100000); + } + } diff --git a/cat-home/src/test/java/com/dianping/cat/demo/TestSendMessage.java b/cat-home/src/test/java/com/dianping/cat/demo/TestSendMessage.java index d89a8be205692ac6e1b6a32b70cb00aa3300a0a4..0e68ed40231bdfd060991c860efb73ee48c1b4e0 100644 --- a/cat-home/src/test/java/com/dianping/cat/demo/TestSendMessage.java +++ b/cat-home/src/test/java/com/dianping/cat/demo/TestSendMessage.java @@ -11,11 +11,22 @@ public class TestSendMessage { @Test public void sendException() throws Exception { + for (int i = 0; i < 10; i++) { - Cat.getProducer().logError(new OutOfMemoryError()); - Cat.getProducer().logError(new NullPointerException()); + Transaction t = Cat.newTransaction("Midas", "XXName"); + try{ + //your bussiness code + //for see the message on cat in problem report + t.setStatus("Fail"); + }catch(Exception e){ + t.setStatus(Transaction.SUCCESS); + Cat.logError(e); + throw e; + }finally{ + t.complete(); + } } - Thread.sleep(1000); + Thread.sleep(10000); } @Test diff --git a/cat-home/src/test/resources/com/dianping/cat/report/page/bug/bug-config.xml b/cat-home/src/test/resources/com/dianping/cat/report/page/bug/bug-config.xml new file mode 100644 index 0000000000000000000000000000000000000000..f0d48fe6dc5d393bc50b80518c4964ff65728fc5 --- /dev/null +++ b/cat-home/src/test/resources/com/dianping/cat/report/page/bug/bug-config.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/cat-home/src/test/resources/com/dianping/cat/report/page/bug/bug.xml b/cat-home/src/test/resources/com/dianping/cat/report/page/bug/bug.xml new file mode 100644 index 0000000000000000000000000000000000000000..a22a4cd7f1a1e3f7a1c587e856e0645b877289d9 --- /dev/null +++ b/cat-home/src/test/resources/com/dianping/cat/report/page/bug/bug.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + \ No newline at end of file