提交 61f01af6 编写于 作者: Y youyong

modify the test

上级 6b6e74ef
......@@ -56,12 +56,6 @@ public class CrossAnalyzer extends AbstractMessageAnalyzer<CrossReport> implemen
return m_reports.keySet();
}
private String getIpFromMessageId(String messageId) {
MessageId id = MessageId.parse(messageId);
return id.getIpAddress();
}
public CrossReport getReport(String domain) {
CrossReport report = m_reports.get(domain);
......@@ -137,26 +131,51 @@ public class CrossAnalyzer extends AbstractMessageAnalyzer<CrossReport> implemen
return crossInfo;
}
private CrossInfo parsePigeonServerTransaction(Transaction t, MessageTree tree) {
CrossInfo crossInfo = new CrossInfo();
String localIp = tree.getIpAddress();
List<Message> messages = t.getChildren();
for (Message message : messages) {
if (message instanceof Event) {
if (message.getType().equals("PigeonService.client")) {
String name = message.getName();
int index = name.indexOf(":");
if (index > 0) {
name = name.substring(0, index);
public boolean isIp(String ip) {
boolean result = false;
try {
if (ip.matches("\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}")) {
String s[] = ip.split("\\.");
if (Integer.parseInt(s[0]) <= 255) {
if (Integer.parseInt(s[1]) <= 255) {
if (Integer.parseInt(s[2]) <= 255) {
if (Integer.parseInt(s[3]) <= 255) {
result = true;
}
}
}
crossInfo.setRemoteAddress(name);
break;
}
}
} catch (Exception e) {
//ignore
}
return result;
}
private CrossInfo parsePigeonServerTransaction(Transaction t, MessageTree tree) {
CrossInfo crossInfo = new CrossInfo();
String localIp = tree.getIpAddress();
// List<Message> messages = t.getChildren();
// for (Message message : messages) {
// if (message instanceof Event) {
// if (message.getType().equals("PigeonService.client")) {
// String name = message.getName();
// int index = name.indexOf(":");
// if (index > 0) {
// name = name.substring(0, index);
// }
// if (isIp(name)) {
// crossInfo.setRemoteAddress(name);
// }
// break;
// }
// }
// }
if (crossInfo.getRemoteAddress().equals(UNKNOWN)) {
String remoteIp = getIpFromMessageId(tree.getMessageId());
MessageId id = MessageId.parse(tree.getMessageId());
String remoteIp = id.getIpAddress();
crossInfo.setRemoteAddress(remoteIp);
}
crossInfo.setLocalAddress(localIp);
......@@ -213,7 +232,7 @@ public class CrossAnalyzer extends AbstractMessageAnalyzer<CrossReport> implemen
DefaultXmlBuilder builder = new DefaultXmlBuilder(true);
Bucket<String> reportBucket = null;
Transaction t = Cat.getProducer().newTransaction("Checkpoint", getClass().getSimpleName());
t.setStatus(Message.SUCCESS);
try {
reportBucket = m_bucketManager.getReportBucket(m_startTime, "cross");
......
......@@ -5,8 +5,8 @@
<implementation>com.dianping.cat.consumer.DefaultAnalyzerFactory</implementation>
</component>
<component>
<role>com.dianping.cat.consumer.sqlparse.SqlParseManager</role>
<implementation>com.dianping.cat.consumer.sqlparse.SqlParseManager</implementation>
<role>com.dianping.cat.consumer.sql.SqlParseManager</role>
<implementation>com.dianping.cat.consumer.sql.SqlParseManager</implementation>
<requirements>
<requirement>
<role>com.dainping.cat.consumer.dal.report.SqltableDao</role>
......@@ -130,7 +130,7 @@
<role>com.dainping.cat.consumer.dal.report.ReportDao</role>
</requirement>
<requirement>
<role>com.dianping.cat.consumer.sqlparse.SqlParseManager</role>
<role>com.dianping.cat.consumer.sql.SqlParseManager</role>
</requirement>
</requirements>
</component>
......@@ -146,7 +146,7 @@
<role>com.dainping.cat.consumer.dal.report.ReportDao</role>
</requirement>
<requirement>
<role>com.dianping.cat.consumer.sqlparse.SqlParseManager</role>
<role>com.dianping.cat.consumer.sql.SqlParseManager</role>
</requirement>
</requirements>
</component>
......
......@@ -359,7 +359,10 @@ public class HealthReportCreator {
m_healthReport.setUrl(temp);
}
TransactionType service = types.get("Service");
TransactionType service = types.get("PigeonService");
if (service == null) {
service = types.get("Service");
}
if (service != null) {
BaseInfo serviceBaseInfo = buildBaseInfo(service);
Service temp = new Service();
......@@ -372,7 +375,10 @@ public class HealthReportCreator {
m_healthReport.setService(temp);
}
TransactionType call = types.get("Call");
TransactionType call = types.get("PigeonCall");
if (call == null) {
call = types.get("Call");
}
if (call != null) {
BaseInfo callBaseInfo = buildBaseInfo(call);
Call temp = new Call();
......
......@@ -31,14 +31,13 @@ public class NavigationBar {
ReportPage.TASK,
ReportPage.LOGVIEW,
ReportPage.DATABASE,
ReportPage.HEALTH,
ReportPage.MONTHREPORT
ReportPage.MONTHREPORT,
ReportPage.LOGVIEW
};
}
}
......@@ -9,6 +9,14 @@ import com.dianping.cat.message.Transaction;
public class TestSendMessage {
@Test
public void sendException() throws Exception {
for (int i = 0; i < 100; i++) {
Cat.getProducer().logError(new OutOfMemoryError());
}
Thread.sleep(1000);
}
@Test
public void sendSendUrlErrorMessage() throws Exception {
for (int i = 0; i < 100; i++) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册