提交 7f56aaf6 编写于 作者: F Frankie Wu

Merge pull request #119 from youyong205/biz

add bug report
......@@ -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,</manifest>
${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,</manifest>
</configuration>
</execution>
<execution>
......
......@@ -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;
......
<?xml version="1.0" encoding="UTF-8"?>
<model>
<entity name="bug-report" root="true">
<attribute name="startTime" value-type="Date" format="yyyy-MM-dd HH:mm:ss" />
<attribute name="endTime" value-type="Date" format="yyyy-MM-dd HH:mm:ss" />
<entity-ref name="domain" type="list" names="domains" />
</entity>
<entity name="domain">
<attribute name="id" value-type="String" />
<element name="excpetion" value-type="String" />
<entity-ref name="exception" />
</entity>
<entity name="exception">
<attribute name="id" value-type="String" />
<attribute name="count" value-type="int" />
<entity-ref name="message" type="list" names="messages" />
</entity>
<entity name="message">
<attribute name="id" value-type="String" />
</entity>
</model>
<?xml version="1.0" encoding="UTF-8"?>
<model>
<entity name="bug-config" root="true">
<entity-ref name="exception" type="list" names="exceptions" />
<entity-ref name="domain" />
</entity>
<entity name="exception">
<attribute name="id" value-type="String" />
</entity>
<entity name="domain">
<attribute name="id" value-type="String" />
<attribute name="additivity" value-type="boolean" />
<entity-ref name="exception" type="list" names="exceptions" />
</entity>
</model>
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<file path="bug-config-codegen.xml" />
<file path="bug-config-model.xml" />
</manifest>
<?xml version="1.0" encoding="UTF-8"?>
<model model-package="com.dianping.cat.home.bug.config" enable-merger="true" enable-sax-parser="true"
enable-base-visitor="true" >
</model>
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<file path="bug-codegen.xml" />
<file path="bug-model.xml" />
</manifest>
<?xml version="1.0" encoding="UTF-8"?>
<model model-package="com.dianping.cat.home.bug" enable-merger="true" enable-sax-parser="true"
enable-base-visitor="true" >
</model>
......@@ -12,4 +12,10 @@
<model package="com.dianping.cat.home.exception-threshold" name="exception-threshold-config">
<sample-model>src/test/resources/com/dianping/cat/report/page/dependency/exception-threshold-config.xml</sample-model>
</model>
<model package="com.dianping.cat.home.bug" name="bug">
<sample-model>src/test/resources/com/dianping/cat/report/page/bug/bug.xml</sample-model>
</model>
<model package="com.dianping.cat.home.bug.config" name="bug-config">
<sample-model>src/test/resources/com/dianping/cat/report/page/bug/bug-config.xml</sample-model>
</model>
</wizard>
......@@ -7,3 +7,4 @@
<domain-config id = "Cat"></domain-config>
</exception-threshold-config>
......@@ -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
});
......
......@@ -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);
}
}
......@@ -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
......
<?xml version="1.0" encoding="utf-8"?>
<bug-config>
<exception id="NetTimexception"/>
<exception id="NetTimexception2"/>
<exception id="exception"/>
<exception id="exception"/>
<domain id="Cat" additivity="false">
<exception id="exception"/>
<exception id="exception"/>
<exception id="exception"/>
</domain>
</bug-config>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<bug-report startTime="2012-05-16 16:00:00"
endTime="2012-05-16 16:59:59">
<domain id="Cat">
<exception id="NPE" count="123">
<message id="http://cat.dianpingoa.com/cat/r/ShopServer"></message>
<message id="http://cat.dianpingoa.com/cat/r/ShopServer"></message>
<message id="http://cat.dianpingoa.com/cat/r/ShopServer"></message>
</exception>
<excpetion></excpetion>
</domain>
<domain>
</domain>
</bug-report>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册