提交 fd68759e 编写于 作者: Y You Yong

modify the cat page

上级 af3c0da9
......@@ -107,7 +107,7 @@ public class DumpUploader implements Initializable, LogEnabled {
upload();
}
} catch (Exception e) {
m_logger.warn("Error when dumping message to HDFS.", e);
m_logger.warn("Error when dumping message to HDFS. " +e.getMessage());
}
try {
......
......@@ -104,7 +104,7 @@ public class RemoteIdUploader implements Initializable, LogEnabled {
upload();
}
} catch (Exception e) {
m_logger.warn("Error when dumping remoteIds to HDFS.", e);
m_logger.error("Error when dumping remoteIds to HDFS. " + e.getMessage());
}
try {
......@@ -112,7 +112,6 @@ public class RemoteIdUploader implements Initializable, LogEnabled {
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
......@@ -134,7 +133,8 @@ public class RemoteIdUploader implements Initializable, LogEnabled {
private void upload() {
File outbox = new File(m_baseDir, "outbox");
String ipAddress = NetworkInterfaceManager.INSTANCE.getLocalHostAddress();
String path = m_builder.getMessageRemoteIdPath(ipAddress, new Date());
Date lastHour = new Date(System.currentTimeMillis() - 60 * 60 * 1000);
String path = m_builder.getMessageRemoteIdPath(ipAddress, lastHour);
File file = new File(outbox, path);
if (!file.exists()) {
return;
......@@ -168,7 +168,8 @@ public class RemoteIdUploader implements Initializable, LogEnabled {
t.addData("speed", speed);
t.setStatus(Message.SUCCESS);
m_logger.info(String.format("Finish remoteIds uploading(%s) to HDFS(%s) with size(%s) at %s.", file.getCanonicalPath(), path, size, speed));
m_logger.info(String.format("Finish remoteIds uploading(%s) to HDFS(%s) with size(%s) at %s.",
file.getCanonicalPath(), path, size, speed));
if (!file.delete()) {
m_logger.warn("Can't delete file: " + file);
......
......@@ -21,7 +21,6 @@ import com.dianping.cat.configuration.server.entity.ServerConfig;
import com.dianping.cat.configuration.server.entity.StorageConfig;
import com.dianping.cat.configuration.server.transform.DefaultDomParser;
import com.site.helper.Files;
import com.site.helper.Threads;
import com.site.helper.Threads.Task;
public class ServerConfigManager implements Initializable, LogEnabled {
......
......@@ -56,12 +56,10 @@ public class DefaultMessagePathBuilder implements MessagePathBuilder, Initializa
return messageId + "/logview.html";
}
@Override
public String getMessageRemoteIdPath(String ip, Date timestamp) {
MessageFormat format = new MessageFormat("{0,date,yyyyMMdd}/{0,date,HH}/remoteid-{1}");
String path = format.format(new Object[] { new Date(), ip });
String path = format.format(new Object[] { timestamp, ip });
return path;
}
......
......@@ -15,6 +15,7 @@ import com.dianping.cat.message.io.InMemoryTest;
import com.dianping.cat.message.io.TcpSocketTest;
import com.dianping.cat.message.spi.codec.HtmlMessageCodecTest;
import com.dianping.cat.message.spi.codec.PlainTextMessageCodecTest;
import com.dianping.cat.message.spi.internal.DefaultMessagePathBuilderTest;
import com.dianping.cat.storage.BucketManagerTest;
import com.dianping.cat.storage.message.LocalLogviewBucketTest;
import com.dianping.cat.storage.message.LogviewBucketTest;
......@@ -44,6 +45,8 @@ MessageIdFactoryTest.class,
MillisSecondTimerTest.class,
DefaultMessagePathBuilderTest.class,
/* .io */
InMemoryTest.class,
......
package com.dianping.cat.message.spi.internal;
import java.text.SimpleDateFormat;
import java.util.Date;
import junit.framework.Assert;
import org.junit.Test;
public class DefaultMessagePathBuilderTest {
@Test
public void testRemotePathBuilder() {
DefaultMessagePathBuilder builder = new DefaultMessagePathBuilder();
int hour = 60 * 60 * 1000;
long current = System.currentTimeMillis();
long currentHour = current - current % hour;
Date date = new Date(currentHour);
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd/HH/");
String dateStr = sdf.format(date);
String ip = "127.0.0.1";
String path = builder.getMessageRemoteIdPath(ip, date);
Assert.assertEquals(dateStr + "remoteid-" + ip, path);
date = new Date(currentHour - hour);
dateStr = sdf.format(date);
path = builder.getMessageRemoteIdPath(ip, date);
Assert.assertEquals(dateStr + "remoteid-" + ip, path);
date = new Date(currentHour + 5*hour);
dateStr = sdf.format(date);
path = builder.getMessageRemoteIdPath(ip, date);
Assert.assertEquals(dateStr + "remoteid-" + ip, path);
}
}
......@@ -52,17 +52,18 @@ public class HistoricalEventService extends BaseHistoricalModelService<EventRepo
model.accept(merger);
}
EventReport eventReport = merger.getEventReport();
List<Report> historyReports = m_reportDao.findAllByDomainNameDuration(new Date(timestamp), new Date(
timestamp + 60 * 60 * 1000), null, null, ReportEntity.READSET_DOMAIN_NAME);
if (eventReport != null && historyReports != null) {
Set<String> domainNames = eventReport.getDomainNames();
for (Report report : historyReports) {
domainNames.add(report.getDomain());
}
if (eventReport == null) {
eventReport = new EventReport(domain);
}
Set<String> domainNames = eventReport.getDomainNames();
for (Report report : historyReports) {
domainNames.add(report.getDomain());
}
return merger == null ? null : eventReport;
return eventReport;
}
private EventReport getReportFromLocalDisk(long timestamp, String domain) throws Exception {
......
......@@ -56,14 +56,15 @@ public class HistoricalHeartbeatService extends BaseHistoricalModelService<Heart
List<Report> historyReports = m_reportDao.findAllByDomainNameDuration(new Date(timestamp), new Date(
timestamp + 60 * 60 * 1000), null, null, ReportEntity.READSET_DOMAIN_NAME);
if (heartbeatReport != null && historyReports != null) {
Set<String> domainNames = heartbeatReport.getDomainNames();
for (Report report : historyReports) {
domainNames.add(report.getDomain());
}
if (heartbeatReport == null) {
heartbeatReport = new HeartbeatReport(domain);
}
Set<String> domainNames = heartbeatReport.getDomainNames();
for (Report report : historyReports) {
domainNames.add(report.getDomain());
}
return merger == null ? null : heartbeatReport;
return heartbeatReport;
}
private HeartbeatReport getReportFromLocalDisk(long timestamp, String domain) throws Exception {
......
......@@ -56,13 +56,14 @@ public class HistoricalProblemService extends BaseHistoricalModelService<Problem
List<Report> historyReports = m_reportDao.findAllByDomainNameDuration(new Date(timestamp), new Date(
timestamp + 60 * 60 * 1000), null, null, ReportEntity.READSET_DOMAIN_NAME);
if (problemReport != null && historyReports != null) {
Set<String> domainNames = problemReport.getDomainNames();
for (Report report : historyReports) {
domainNames.add(report.getDomain());
}
if (problemReport == null) {
problemReport = new ProblemReport(domain);
}
return merger == null ? null : problemReport;
Set<String> domainNames = problemReport.getDomainNames();
for (Report report : historyReports) {
domainNames.add(report.getDomain());
}
return problemReport;
}
private ProblemReport getReportFromLocalDisk(long timestamp, String domain) throws Exception {
......
......@@ -52,17 +52,18 @@ public class HistoricalTransactionService extends BaseHistoricalModelService<Tra
model.accept(merger);
}
TransactionReport transactionReport = merger.getTransactionReport();
List<Report> historyReports = m_reportDao.findAllByDomainNameDuration(new Date(timestamp), new Date(
timestamp + 60 * 60 * 1000), null, null, ReportEntity.READSET_DOMAIN_NAME);
if (transactionReport != null && historyReports != null) {
Set<String> domainNames = transactionReport.getDomainNames();
for (Report report : historyReports) {
domainNames.add(report.getDomain());
}
if (transactionReport == null) {
transactionReport = new TransactionReport(domain);
}
Set<String> domainNames = transactionReport.getDomainNames();
for (Report report : historyReports) {
domainNames.add(report.getDomain());
}
return merger == null ? null : transactionReport;
return transactionReport;
}
private TransactionReport getReportFromLocalDisk(long timestamp, String domain) throws Exception {
......
......@@ -266,7 +266,7 @@ public class Handler implements PageHandler<Context> {
TransactionReport reportModel = DefaultSaxParser.parse(xml);
reportModel.accept(merger);
}
transactionReport = merger == null ? null : merger.getTransactionReport();
transactionReport = merger.getTransactionReport();
} catch (Exception e) {
e.printStackTrace();
}
......
......@@ -13,7 +13,7 @@
<res:useCss value='${res.css.local.body_css}' target="head-css"/>
</head>
<body>
<table style="height:10px"></table>
<table style="height:8px"></table>
<ul class="tabs">
<c:forEach var="page" items="${navBar.visiblePages}">
<c:if test="${page.standalone}">
......
......@@ -14,9 +14,24 @@
<div class="report">
<table class="header">
<tr>
<td class="title">${title}&nbsp;&nbsp;<jsp:invoke fragment="subtitle"/></td>
<td class="switch">Browse Mode:History Summarize Report
[&nbsp;<a href="?domain=${model.domain}">Hourly Mode</a>&nbsp;]&nbsp;
<td class="title">&nbsp;&nbsp;<jsp:invoke fragment="subtitle"/></td>
<td class="switch"><a href="?domain=${model.domain}">Switch To Hourly Mode</a>
</td>
<td class="nav">
&nbsp;&nbsp;<c:forEach var="nav" items="${model.historyNavs}">
<c:choose>
<c:when test="${nav.title eq model.reportType}">
&nbsp;&nbsp;[ <a href="?op=history&domain=${model.domain}&date=${model.date}&reportType=${nav.title}" class="current">${nav.title}</a> ]
</c:when>
<c:otherwise>
&nbsp;&nbsp;[ <a href="?op=history&domain=${model.domain}&date=${model.date}&reportType=${nav.title}">${nav.title}</a> ]&nbsp;&nbsp;
</c:otherwise>
</c:choose>
</c:forEach>
&nbsp;&nbsp;[ <a href="?op=history&domain=${model.domain}&date=${model.date}&reportType=${model.reportType}&step=-1">${model.currentNav.last}</a> ]&nbsp;&nbsp;
&nbsp;&nbsp;[ <a href="?op=history&domain=${model.domain}&date=${model.date}&reportType=${model.reportType}&step=1">${model.currentNav.next}</a> ]&nbsp;&nbsp;
&nbsp;&nbsp;[ <a href="?op=history&domain=${model.domain}&reportType=${model.reportType}&nav=next">now</a> ]&nbsp;&nbsp;
</td>
</tr>
</table>
......@@ -36,26 +51,6 @@
</c:forEach>
</div>
</td>
<td class="nav">
&nbsp;&nbsp;[ <a href="?op=history&domain=${model.domain}&date=${model.date}&reportType=${model.reportType}&step=-1">${model.currentNav.last}</a> ]&nbsp;&nbsp;
&nbsp;&nbsp;[ <a href="?op=history&domain=${model.domain}&date=${model.date}&reportType=${model.reportType}&step=1">${model.currentNav.next}</a> ]&nbsp;&nbsp;
&nbsp;&nbsp;[ <a href="?op=history&domain=${model.domain}&reportType=${model.reportType}&nav=next">now</a> ]&nbsp;&nbsp;
</td>
</tr>
<tr>
<td class="nav">
<c:forEach var="nav" items="${model.historyNavs}">
<c:choose>
<c:when test="${nav.title eq model.reportType}">
&nbsp;&nbsp;[ <a href="?op=history&domain=${model.domain}&date=${model.date}&reportType=${nav.title}" class="current">${nav.title}</a> ]
</c:when>
<c:otherwise>
&nbsp;&nbsp;[ <a href="?op=history&domain=${model.domain}&date=${model.date}&reportType=${nav.title}">${nav.title}</a> ]&nbsp;&nbsp;
</c:otherwise>
</c:choose>
</c:forEach>
&nbsp;
</td>
</tr>
</table>
<jsp:doBody />
......
......@@ -14,9 +14,14 @@
<div class="report">
<table class="header">
<tr>
<td class="title">${title}&nbsp;&nbsp;<jsp:invoke fragment="subtitle"/></td>
<td class="switch">Browse Mode:Hourly Report
[&nbsp;<a href="${model.baseUri}?op=history&domain=${model.domain}">History Mode</a>&nbsp;]&nbsp;
<td class="title">&nbsp;&nbsp;<jsp:invoke fragment="subtitle"/></td>
<td class="switch"><a href="${model.baseUri}?op=history&domain=${model.domain}">Switch To History Mode</a>
</td>
<td class="nav">
<c:forEach var="nav" items="${model.navs}">
&nbsp;[ <a href="${model.baseUri}?date=${model.date}&step=${nav.hours}&${navUrlPrefix}">${nav.title}</a> ]&nbsp;
</c:forEach>
&nbsp;[ <a href="${model.baseUri}?${navUrlPrefix}">now</a> ]&nbsp;
</td>
</tr>
</table>
......@@ -37,12 +42,6 @@
</c:forEach>
</div>
</td>
<td class="nav">
<c:forEach var="nav" items="${model.navs}">
&nbsp;[ <a href="${model.baseUri}?date=${model.date}&step=${nav.hours}&${navUrlPrefix}">${nav.title}</a> ]&nbsp;
</c:forEach>
&nbsp;[ <a href="${model.baseUri}?${navUrlPrefix}">now</a> ]&nbsp;
</td>
</tr>
</table>
......
......@@ -33,7 +33,7 @@ a:hover {
}
ul.tabs {
border-bottom: 1px solid gray;
border-bottom: 1px solid black;
list-style-type: none;
position: relative;
padding: 0em;
......@@ -46,9 +46,9 @@ ul.tabs {
margin: 0em 0.4em 0em 0.4em;
padding: 0.4em 0.4em 0.4em 0.4em;
overflow: hidden;
border-top: 1px solid gray;
border-left: 1px solid gray;
border-right: 1px solid gray;
border-top: 1px solid black;
border-left: 1px solid black;
border-right: 1px solid black;
}
.tabs li.selected {
......
......@@ -8,11 +8,12 @@
.report .header .title {
font-weight: bold;
color: black;
}
.report .header .timestamp {
white-space: nowrap;
width: 200px;
.report .header .title {
font-weight: bold;
color: black;
}
.report .navbar {
......@@ -47,10 +48,17 @@
font-weight: bold;
}
.report .header .switch {
.report .header .nav {
text-align: right;
font-size: small;
font-weight: bold;
color: black;
}
.report .header .switch {
text-align: left;
font-size: small;
font-weight: bold;
}
.report .navbar .nav A {
......
......@@ -19,22 +19,20 @@ Welcome to <b>Central Application Tracking (CAT)</b>.
<br>
<br>
<table>
<tr><td><a href="http://192.168.7.43:9080/bin/view/soa-110-cat/userefrrence" target="_blank">CAT用户手册</a></td> </tr>
<tr><td><a href="http://192.168.7.43:9080/bin/view/soa-110-cat/cat-developer-cat" target="_blank">CAT开发者文档</a></td> </tr>
<tr><td><a href="http://192.168.7.43:9080/bin/view/soa-110-cat/CATIntegration" target="_blank">CAT集成帮助文档</a></td> </tr>
<tr><td><a href="http://wiki.dianpingoa.com/bin/view/SOA%E6%9E%B6%E6%9E%84/CAT%E7%94%A8%E6%88%B7%E6%89%8B%E5%86%8C" target="_blank">CAT用户手册</a></td> </tr>
<tr><td><a href="http://wiki.dianpingoa.com/bin/view/SOA%E6%9E%B6%E6%9E%84/CAT%E5%BC%80%E5%8F%91%E8%80%85%E6%96%87%E6%A1%A3" target="_blank">CAT开发者文档</a></td> </tr>
<tr><td><a href="http://wiki.dianpingoa.com/bin/view/SOA%E6%9E%B6%E6%9E%84/CAT%E9%9B%86%E6%88%90%E5%B8%AE%E5%8A%A9%E6%96%87%E6%A1%A3" target="_blank">CAT集成帮助文档</a></td> </tr>
</table>
<br>
<br>
<br>
<table class='version'>
<tr class="odd"><td>版本</td><td>说明</td></tr>
<tr class="even"><td>0.3.3</td><td>1、修改CAT线程为后台Dameon线程。2、减少CAT的日志输出。3、修复了极端情况客户端丢失部分消息。4、支持CAT的延迟加载。</td></tr>
<tr class="even"><td>0.3.2</td><td>1、修复了配置单个服务器时候,服务器重启,客户端断开链接bug。2、修复了CAT不正常加载时候,内存溢出的问题。</td></tr>
<tr class="even"><td>0.3.1</td><td>1、修复CAT在业务testcase的使用,支持业务运行Testcase在Console上看到运行情况。</td></tr>
<tr class="odd"><td>0.3.0</td><td>1、修复CAT在Transaction Name的Nullpoint异常。</td></tr>
<tr class="even"><td>0.2.5</td><td>1、心跳消息监控新增oldgc和newgc
2、更新了ThreadLocal的线程模型(修复了一些无头消息和部分错乱消息)
</td></tr>
<tr class="odd"><td>版本</td><td>说明</td><td>发布时间</td></tr>
<tr class="even"><td>0.3.3</td><td>1、修改CAT线程为后台Dameon线程。2、减少CAT的日志输出。3、修复了极端情况客户端丢失部分消息。4、支持CAT的延迟加载。</td><td>2012-07-17</td></tr>
<tr class="odd"><td>0.3.2</td><td>1、修复了配置单个服务器时候,服务器重启,客户端断开链接bug。2、修复了CAT不正常加载时候,内存溢出的问题。</td><td>2012-07-01</td></tr>
<tr class="even"><td>0.3.1</td><td>1、修复CAT在业务testcase的使用,支持业务运行Testcase在Console上看到运行情况。</td><td>2012-06-25</td></tr>
<tr class="odd"><td>0.3.0</td><td>1、修复CAT在Transaction Name的Nullpoint异常。</td><td>2012-06-15</td></tr>
<tr class="even"><td>0.2.5</td><td>1、心跳消息监控新增oldgc和newgc 2、更新了ThreadLocal的线程模型(修复了一些无头消息和部分错乱消息)</td><td>2012-05-01</td></tr>
</table>
<br>
<br>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册