提交 ccd45e8e 编写于 作者: Y youyong205

Merge pull request #249 from youyong205/biz

Biz
......@@ -4,7 +4,7 @@
<parent>
<groupId>com.dianping.cat</groupId>
<artifactId>parent</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>cat-client</artifactId>
......
......@@ -121,10 +121,6 @@ public class Cat {
initialize(configFile);
}
public static boolean isEnabled() {
return Cat.getProducer().isEnabled();
}
public static boolean isInitialized() {
synchronized (s_instance) {
return s_instance.m_container != null;
......
......@@ -83,7 +83,7 @@ public class DefaultMessageManager extends ContainerHolder implements MessageMan
public void flush(MessageTree tree) {
MessageSender sender = m_transportManager.getSender();
if (sender != null && isCatEnabled()) {
if (sender != null && isMessageEnabled()) {
sender.send(tree);
if (m_statistics != null) {
......@@ -165,6 +165,11 @@ public class DefaultMessageManager extends ContainerHolder implements MessageMan
@Override
public boolean isCatEnabled() {
return m_domain != null && m_domain.isEnabled() && m_configManager.isCatEnabled();
}
@Override
public boolean isMessageEnabled() {
return m_domain != null && m_domain.isEnabled() && m_context.get() != null && m_configManager.isCatEnabled();
}
......@@ -419,13 +424,6 @@ public class DefaultMessageManager extends ContainerHolder implements MessageMan
}
}
private void markAsRunAway(Transaction parent, DefaultTaggedTransaction transaction) {
transaction.addData("RunAway");
transaction.setStatus(Message.SUCCESS);
transaction.setStandalone(true);
transaction.complete();
}
private void markAsNotCompleted(DefaultTransaction transaction) {
DefaultEvent event = new DefaultEvent("CAT", "BadInstrument");
......@@ -435,6 +433,13 @@ public class DefaultMessageManager extends ContainerHolder implements MessageMan
transaction.setCompleted(true);
}
private void markAsRunAway(Transaction parent, DefaultTaggedTransaction transaction) {
transaction.addData("RunAway");
transaction.setStatus(Message.SUCCESS);
transaction.setStandalone(true);
transaction.complete();
}
private void migrateMessage(Stack<Transaction> stack, Transaction source, Transaction target, int level) {
Transaction current = level < stack.size() ? stack.get(level) : null;
boolean shouldKeep = false;
......@@ -443,7 +448,8 @@ public class DefaultMessageManager extends ContainerHolder implements MessageMan
if (child != current) {
target.addChild(child);
} else {
DefaultTransaction cloned = new DefaultTransaction(current.getType(), current.getName(), DefaultMessageManager.this);
DefaultTransaction cloned = new DefaultTransaction(current.getType(), current.getName(),
DefaultMessageManager.this);
cloned.setTimestamp(current.getTimestamp());
cloned.setDurationInMicros(current.getDurationInMicros());
......@@ -473,7 +479,8 @@ public class DefaultMessageManager extends ContainerHolder implements MessageMan
String rootId = tree.getRootMessageId();
String childId = nextMessageId();
DefaultTransaction source = (DefaultTransaction) message;
DefaultTransaction target = new DefaultTransaction(source.getType(), source.getName(), DefaultMessageManager.this);
DefaultTransaction target = new DefaultTransaction(source.getType(), source.getName(),
DefaultMessageManager.this);
target.setTimestamp(source.getTimestamp());
target.setDurationInMicros(source.getDurationInMicros());
......
......@@ -31,12 +31,12 @@ public class DefaultMessageProducer implements MessageProducer {
@Override
public boolean isEnabled() {
return m_manager.isCatEnabled();
return m_manager.isMessageEnabled();
}
@Override
public void logError(String message, Throwable cause) {
if (Cat.isEnabled()) {
if (Cat.getManager().isCatEnabled()) {
if (shouldLog(cause)) {
StringWriter writer = new StringWriter(2048);
......@@ -131,7 +131,7 @@ public class DefaultMessageProducer implements MessageProducer {
m_manager.setup();
}
if (m_manager.isCatEnabled()) {
if (m_manager.isMessageEnabled()) {
DefaultEvent event = new DefaultEvent(type, name);
m_manager.add(event);
......@@ -146,7 +146,7 @@ public class DefaultMessageProducer implements MessageProducer {
m_manager.setup();
}
if (m_manager.isCatEnabled() && parent != null) {
if (m_manager.isMessageEnabled() && parent != null) {
DefaultEvent event = new DefaultEvent(type, name);
parent.addChild(event);
......@@ -163,7 +163,7 @@ public class DefaultMessageProducer implements MessageProducer {
m_manager.setup();
}
if (m_manager.isCatEnabled()) {
if (m_manager.isMessageEnabled()) {
DefaultForkedTransaction transaction = new DefaultForkedTransaction(type, name, m_manager);
m_manager.start(transaction, true);
......@@ -179,7 +179,7 @@ public class DefaultMessageProducer implements MessageProducer {
m_manager.setup();
}
if (m_manager.isCatEnabled()) {
if (m_manager.isMessageEnabled()) {
DefaultHeartbeat heartbeat = new DefaultHeartbeat(type, name);
m_manager.add(heartbeat);
......@@ -194,7 +194,7 @@ public class DefaultMessageProducer implements MessageProducer {
m_manager.setup();
}
if (m_manager.isCatEnabled() && parent != null) {
if (m_manager.isMessageEnabled() && parent != null) {
DefaultHeartbeat heartbeat = new DefaultHeartbeat(type, name);
parent.addChild(heartbeat);
......@@ -210,7 +210,7 @@ public class DefaultMessageProducer implements MessageProducer {
m_manager.setup();
}
if (m_manager.isCatEnabled()) {
if (m_manager.isMessageEnabled()) {
DefaultMetric metric = new DefaultMetric(type == null ? "" : type, name);
m_manager.add(metric);
......@@ -227,7 +227,7 @@ public class DefaultMessageProducer implements MessageProducer {
m_manager.setup();
}
if (m_manager.isCatEnabled()) {
if (m_manager.isMessageEnabled()) {
DefaultTaggedTransaction transaction = new DefaultTaggedTransaction(type, name, tag, m_manager);
m_manager.start(transaction, true);
......@@ -243,7 +243,7 @@ public class DefaultMessageProducer implements MessageProducer {
m_manager.setup();
}
if (m_manager.isCatEnabled()) {
if (m_manager.isMessageEnabled()) {
DefaultTrace trace = new DefaultTrace(type, name);
m_manager.add(trace);
......@@ -260,7 +260,7 @@ public class DefaultMessageProducer implements MessageProducer {
m_manager.setup();
}
if (m_manager.isCatEnabled()) {
if (m_manager.isMessageEnabled()) {
DefaultTransaction transaction = new DefaultTransaction(type, name, m_manager);
m_manager.start(transaction, false);
......@@ -276,7 +276,7 @@ public class DefaultMessageProducer implements MessageProducer {
m_manager.setup();
}
if (m_manager.isCatEnabled() && parent != null) {
if (m_manager.isMessageEnabled() && parent != null) {
DefaultTransaction transaction = new DefaultTransaction(type, name, m_manager);
parent.addChild(transaction);
......
......@@ -186,7 +186,7 @@ public class TcpSocketSender implements Task, MessageSender, LogEnabled {
private int m_retriedTimes = 0;
private AtomicInteger m_reconnects = new AtomicInteger(999);
private AtomicInteger m_reconnects = new AtomicInteger(99);
public ChannelManager(Logger logger, List<InetSocketAddress> serverAddresses) {
int len = serverAddresses.size();
......@@ -224,34 +224,34 @@ public class TcpSocketSender implements Task, MessageSender, LogEnabled {
private ChannelFuture createChannel(int index) {
InetSocketAddress address = m_serverAddresses.get(index);
try {
ChannelFuture future = m_bootstrap.connect(address);
ChannelFuture future = null;
try {
future = m_bootstrap.connect(address);
future.awaitUninterruptibly(100, TimeUnit.MILLISECONDS); // 100 ms
if (!future.isSuccess()) {
future.getChannel().getCloseFuture().awaitUninterruptibly(100, TimeUnit.MILLISECONDS); // 100ms
int count = m_reconnects.incrementAndGet();
if (count % 100 == 0) {
m_logger.error("Error when try to connecting to " + address + ", message: " + future.getCause());
}
future.getChannel().close();
} else {
m_logger.info("Connected to CAT server at " + address);
return future;
}
} catch (Throwable e) {
m_logger.error("Error when connect server " + address.getAddress(), e);
if (future != null) {
future.getChannel().close();
}
}
return null;
}
public ChannelFuture getChannel() {
if (m_lastFuture != null && m_lastFuture != m_activeFuture) {
m_lastFuture.getChannel().close();
m_lastFuture = null;
}
return m_activeFuture;
}
......@@ -282,43 +282,48 @@ public class TcpSocketSender implements Task, MessageSender, LogEnabled {
@Override
public void run() {
try {
while (m_active) {
try {
if (isChannelStalled()) {
try {
m_activeFuture.getChannel().close();
m_activeFuture = null;
m_activeIndex = -1;
} catch (Throwable e) {
Cat.logError(e);
}
}
if (m_activeFuture != null && !m_activeFuture.getChannel().isOpen()) {
m_activeIndex = m_serverAddresses.size();
}
if (m_activeIndex == -1) {
m_activeIndex = m_serverAddresses.size();
}
for (int i = 0; i < m_activeIndex; i++) {
ChannelFuture future = createChannel(i);
if (future != null) {
m_lastFuture = m_activeFuture;
m_activeFuture = future;
m_activeIndex = i;
break;
}
while (m_active) {
try {
if (isChannelStalled()) {
m_activeFuture.getChannel().close();
m_activeFuture = null;
m_activeIndex = -1;
}
if (m_activeFuture != null && !m_activeFuture.getChannel().isOpen()) {
m_activeFuture.getChannel().close();
m_activeFuture = null;
m_activeIndex = m_serverAddresses.size();
}
if (m_activeIndex == -1) {
m_activeIndex = m_serverAddresses.size();
}
if (m_lastFuture != null && m_lastFuture != m_activeFuture) {
m_lastFuture.getChannel().close();
m_lastFuture = null;
}
} catch (Throwable e) {
Cat.logError(e);
}
try {
for (int i = 0; i < m_activeIndex; i++) {
ChannelFuture future = createChannel(i);
if (future != null) {
m_lastFuture = m_activeFuture;
m_activeFuture = future;
m_activeIndex = i;
break;
}
} catch (Throwable e) {
Cat.logError(e);
}
} catch (Throwable e) {
Cat.logError(e);
}
try {
Thread.sleep(2 * 1000L); // check every 2 seconds
} catch (InterruptedException e) {
// ignore
}
} catch (InterruptedException e) {
// ignore
}
}
......
......@@ -42,6 +42,14 @@ public interface MessageManager {
*/
public boolean hasContext();
/**
* Check if current context logging is enabled or disabled.
*
* @return true if current context is enabled
*/
public boolean isMessageEnabled();
/**
* Check if CAT logging is enabled or disabled.
*
......
......@@ -15,8 +15,11 @@ import java.util.concurrent.ConcurrentHashMap;
import org.codehaus.plexus.logging.LogEnabled;
import org.codehaus.plexus.logging.Logger;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
import org.jboss.netty.buffer.ChannelBuffer;
import org.unidal.lookup.annotation.Inject;
import org.unidal.tuple.Pair;
import com.dianping.cat.message.Event;
import com.dianping.cat.message.Heartbeat;
......@@ -33,7 +36,7 @@ import com.dianping.cat.message.spi.MessageCodec;
import com.dianping.cat.message.spi.MessageTree;
import com.dianping.cat.message.spi.internal.DefaultMessageTree;
public class PlainTextMessageCodec implements MessageCodec, LogEnabled {
public class PlainTextMessageCodec implements MessageCodec, LogEnabled, Initializable {
public static final String ID = "plain-text";
private static final String VERSION = "PT1"; // plain text version 1
......@@ -42,6 +45,8 @@ public class PlainTextMessageCodec implements MessageCodec, LogEnabled {
private static final byte LF = '\n'; // line feed character
private Map<String, Pair<Long, ChannelBuffer>> m_bufs = new ConcurrentHashMap<String, Pair<Long, ChannelBuffer>>();
@Inject
private BufferWriter m_writer = new EscapingBufferWriter();
......@@ -61,11 +66,25 @@ public class PlainTextMessageCodec implements MessageCodec, LogEnabled {
@Override
public void decode(ChannelBuffer buf, MessageTree tree) {
String key = Thread.currentThread().getName();
Pair<Long, ChannelBuffer> pair = m_bufs.get(key);
if (pair == null) {
pair = new Pair<Long, ChannelBuffer>(System.currentTimeMillis(), buf);
m_bufs.put(key, pair);
} else {
pair.setKey(System.currentTimeMillis());
pair.setValue(buf);
}
decodeHeader(buf, tree);
if (buf.readableBytes() > 0) {
decodeMessage(buf, tree);
}
m_bufs.remove(key);
}
protected void decodeHeader(ChannelBuffer buf, MessageTree tree) {
......@@ -121,7 +140,7 @@ public class PlainTextMessageCodec implements MessageCodec, LogEnabled {
return transaction;
case 'A':
DefaultTransaction tran = new DefaultTransaction(type, name, null);
String status = helper.read(buf, TAB);
String status = helper.readRaw(buf, TAB);
String duration = helper.read(buf, TAB);
String data = helper.readRaw(buf, TAB);
......@@ -140,7 +159,7 @@ public class PlainTextMessageCodec implements MessageCodec, LogEnabled {
return tran;
}
case 'T':
String transactionStatus = helper.read(buf, TAB);
String transactionStatus = helper.readRaw(buf, TAB);
String transactionDuration = helper.read(buf, TAB);
String transactionData = helper.readRaw(buf, TAB);
......@@ -149,12 +168,13 @@ public class PlainTextMessageCodec implements MessageCodec, LogEnabled {
parent.addData(transactionData);
long transactionD = Long.parseLong(transactionDuration.substring(0, transactionDuration.length() - 2));
parent.setDurationInMicros(transactionD);
return stack.pop();
case 'E':
DefaultEvent event = new DefaultEvent(type, name);
String eventStatus = helper.read(buf, TAB);
String eventStatus = helper.readRaw(buf, TAB);
String eventData = helper.readRaw(buf, TAB);
helper.read(buf, LF); // get rid of line feed
......@@ -170,7 +190,7 @@ public class PlainTextMessageCodec implements MessageCodec, LogEnabled {
}
case 'M':
DefaultMetric metric = new DefaultMetric(type, name);
String metricStatus = helper.read(buf, TAB);
String metricStatus = helper.readRaw(buf, TAB);
String metricData = helper.readRaw(buf, TAB);
helper.read(buf, LF); // get rid of line feed
......@@ -186,7 +206,7 @@ public class PlainTextMessageCodec implements MessageCodec, LogEnabled {
}
case 'L':
DefaultTrace trace = new DefaultTrace(type, name);
String traceStatus = helper.read(buf, TAB);
String traceStatus = helper.readRaw(buf, TAB);
String traceData = helper.readRaw(buf, TAB);
helper.read(buf, LF); // get rid of line feed
......@@ -202,7 +222,7 @@ public class PlainTextMessageCodec implements MessageCodec, LogEnabled {
}
case 'H':
DefaultHeartbeat heartbeat = new DefaultHeartbeat(type, name);
String heartbeatStatus = helper.read(buf, TAB);
String heartbeatStatus = helper.readRaw(buf, TAB);
String heartbeatData = helper.readRaw(buf, TAB);
helper.read(buf, LF); // get rid of line feed
......@@ -221,7 +241,6 @@ public class PlainTextMessageCodec implements MessageCodec, LogEnabled {
+ buf.toString(Charset.forName("utf-8")));
throw new RuntimeException("Unknown identifier int name");
}
}
protected void decodeMessage(ChannelBuffer buf, MessageTree tree) {
......@@ -312,7 +331,7 @@ public class PlainTextMessageCodec implements MessageCodec, LogEnabled {
count += helper.write(buf, TAB);
if (policy != Policy.WITHOUT_STATUS) {
count += helper.write(buf, message.getStatus());
count += helper.writeRaw(buf, message.getStatus());
count += helper.write(buf, TAB);
Object data = message.getData();
......@@ -375,7 +394,8 @@ public class PlainTextMessageCodec implements MessageCodec, LogEnabled {
m_bufferHelper = new BufferHelper(m_writer);
}
protected static class BufferHelper {
protected class BufferHelper {
private BufferWriter m_writer;
public BufferHelper(BufferWriter writer) {
......@@ -397,46 +417,55 @@ public class PlainTextMessageCodec implements MessageCodec, LogEnabled {
}
public String readRaw(ChannelBuffer buf, byte separator) {
int count = buf.bytesBefore(separator);
if (count < 0) {
return null;
} else {
byte[] data = new byte[count];
String str;
buf.readBytes(data);
buf.readByte(); // get rid of separator
try {
int count = buf.bytesBefore(separator);
int length = data.length;
for (int i = 0; i < length; i++) {
if (data[i] == '\\') {
if (i + 1 < length) {
byte b = data[i + 1];
if (b == 't') {
data[i] = '\t';
} else if (b == 'r') {
data[i] = '\r';
} else if (b == 'n') {
data[i] = '\n';
} else {
data[i] = b;
if (count < 0) {
return null;
} else {
byte[] data = new byte[count];
String str;
buf.readBytes(data);
buf.readByte(); // get rid of separator
int length = data.length;
int writeIndex = 0;
for (int i = 0; i < length; i++) {
if (data[i] == '\\') {
if (i + 1 < length) {
byte b = data[i + 1];
if (b == 't') {
data[writeIndex] = '\t';
i++;
} else if (b == 'r') {
data[writeIndex] = '\r';
i++;
} else if (b == 'n') {
data[writeIndex] = '\n';
i++;
} else{
data[writeIndex] = '\\';
}
}else{
data[writeIndex] = '\\';
}
System.arraycopy(data, i + 2, data, i + 1, length - i - 2);
length--;
} else {
data[writeIndex] = data[i];
}
writeIndex++;
}
}
try {
str = new String(data, 0, length, "utf-8");
} catch (UnsupportedEncodingException e) {
str = new String(data, 0, length);
try {
str = new String(data,0,writeIndex,"utf-8");
} catch (UnsupportedEncodingException e) {
str = new String(data, 0, length);
}
return str;
}
return str;
} finally {
}
}
......@@ -558,4 +587,8 @@ public class PlainTextMessageCodec implements MessageCodec, LogEnabled {
}
}
@Override
public void initialize() throws InitializationException {
}
}
......@@ -73,7 +73,7 @@ public class PlainTextMessageCodecTest {
Metric.setTimestamp(timestamp);
return Metric;
}
private Heartbeat newHeartbeat(String type, String name, long timestamp, String status, String data) {
DefaultHeartbeat heartbeat = new DefaultHeartbeat(type, name);
......@@ -108,7 +108,7 @@ public class PlainTextMessageCodecTest {
trace.setTimestamp(timestamp);
return trace;
}
private Transaction newTransaction(String type, String name, long timestamp, String status, int duration, String data) {
DefaultTransaction transaction = new DefaultTransaction(type, name, null);
......@@ -135,7 +135,7 @@ public class PlainTextMessageCodecTest {
check(metric, "M2012-01-02 15:33:41.987\ttype\tname\t0\there is the data.\t\n");
}
@Test
public void testEventForRawData() {
long timestamp = 1325489621987L;
......@@ -187,7 +187,7 @@ public class PlainTextMessageCodecTest {
"L2012-01-02 15:33:41.987\tException\tjava.lang.Exception\tERROR\t" + //
"java.lang.Exception\\n\\tat com.dianping.cat.message.spi.codec.PlainTextMessageCodecTest.testTraceForException(PlainTextMessageCodecTest.java:112)\\n\t\n");
}
@Test
public void testTransactionNormal() {
long timestamp = 1325489621987L;
......@@ -218,7 +218,7 @@ public class PlainTextMessageCodecTest {
"E2012-01-02 15:33:42.027\tURL\tView\t0\tview=HTML\t\n" + //
"T2012-01-02 15:33:42.087\tURL\tReview\t0\t100000us\t/review/2468\t\n");
}
@Test
public void testTransactionSimple() {
long timestamp = 1325489621987L;
......
......@@ -3,7 +3,7 @@
<parent>
<groupId>com.dianping.cat</groupId>
<artifactId>parent</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>cat-consumer-advanced</artifactId>
......
......@@ -3,7 +3,7 @@
<parent>
<groupId>com.dianping.cat</groupId>
<artifactId>parent</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>cat-consumer</artifactId>
......
......@@ -3,7 +3,7 @@
<parent>
<groupId>com.dianping.cat</groupId>
<artifactId>parent</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>cat-core</artifactId>
......
......@@ -149,7 +149,7 @@ public class TcpSocketReceiver implements LogEnabled {
try {
handleMessage();
} catch (Exception e) {
active = false;
//ignore
}
}
try {
......@@ -165,7 +165,7 @@ public class TcpSocketReceiver implements LogEnabled {
}
}
public void handleMessage() throws InterruptedException {
public void handleMessage() throws InterruptedException {
ChannelBuffer buf = m_queue.poll(1, TimeUnit.MILLISECONDS);
if (buf != null) {
......@@ -186,6 +186,7 @@ public class TcpSocketReceiver implements LogEnabled {
}
try {
buf.markReaderIndex();
// read the size of the message
buf.readInt();
DefaultMessageTree tree = (DefaultMessageTree) m_codec.decode(buf);
......
package com.dianping.cat.message.spi.core;
import java.io.PrintWriter;
import java.io.StringWriter;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.junit.Test;
import com.dianping.cat.Cat;
import com.dianping.cat.message.Message;
import com.dianping.cat.message.Transaction;
import com.dianping.cat.message.internal.DefaultTransaction;
import com.dianping.cat.message.internal.MockMessageBuilder;
import com.dianping.cat.message.spi.MessageTree;
import com.dianping.cat.message.spi.codec.PlainTextMessageCodec;
import com.dianping.cat.message.spi.internal.DefaultMessageTree;
public class PlainTextCodecTest {
@Test
public void test() throws InterruptedException {
MessageTree tree = buildMessages();
PlainTextMessageCodec codec = new PlainTextMessageCodec();
ChannelBuffer buf = ChannelBuffers.dynamicBuffer(8192);
codec.encode(tree, buf);
buf.readInt();
MessageTree tree2 = new DefaultMessageTree();
codec.decode(buf, tree2);
Thread.sleep(1000);
}
public MessageTree buildMessages() {
Transaction t = Cat.newTransaction("type1", "name1\t\n\t\n\\");
Transaction t2 = Cat.newTransaction("type2", "name\t\n\t\n2\\");
Transaction t3 = Cat.newTransaction("type3", "name3\t\n\t\n\\");
Transaction t4 = Cat.newTransaction("type4", "name4\t\n\t\n\\");
Cat.logEvent("type1\t\n", "name\t\n", "sdfsdf\t\n", convertException(new NullPointerException()));
Cat.logHeartbeat("type1\t\n", "name\t\n", "sdfsdf\t\n", convertException(new NullPointerException()));
Cat.logError(new RuntimeException());
t2.addData(convertException(new NullPointerException()));
t2.setStatus(convertException(new NullPointerException()));
t2.complete();
t3.complete();
t4.complete();
MessageTree tree = Cat.getManager().getThreadLocalMessageTree();
t.setStatus("sfsf\t\n");
((DefaultTransaction) t).setDurationInMicros(1000);
return tree;
}
public static String convertException(Throwable cause) {
StringWriter writer = new StringWriter(2048);
cause.printStackTrace(new PrintWriter(writer));
writer.write("\\\b\\c\\x\1\1\2\2\34\5\5");
return writer.toString();
}
public MessageTree buildMessage() {
Message message = new MockMessageBuilder() {
@Override
public MessageHolder define() {
TransactionHolder t = t("URL\t\n", "GET\t\n", 112819).child(
t("PigeonCall\t\n",
"groupService:groupNoteService_1.0.0:updateNoteDraft(Integer,Integer,String,String)\t\n",
"testtest\t\ntest\t\ntest\t\n", 100).child(
e("PigeonCall.server\t\n", "10.1.2.99:2011\t\n",
"Execute[34796272]testtest\t\ntest\t\ntest\t\n"))).child(
t("PigeonCall\t\n",
"groupService:groupNoteService_1.0.1:updateNoteDraft2(Integer,Integer,String,String)\t\n", "",
100).child(
e("PigeonCall.server\t\n", "10.1.2.199:2011\t\n",
"Execute[34796272]testtest\t\ntest\t\ntest\t\n")));
return t;
}
}.build();
MessageTree tree = new DefaultMessageTree();
tree.setDomain("cat test");
tree.setHostName("test test");
tree.setIpAddress("test test");
tree.setThreadGroupName("test test");
tree.setThreadId("test test");
tree.setThreadName("test test");
tree.setMessage(message);
tree.setMessageId("MobileApi-0a01077f-379304-1362256");
return tree;
}
}
......@@ -4,7 +4,7 @@
<parent>
<groupId>com.dianping.cat</groupId>
<artifactId>parent</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>cat-hadoop</artifactId>
......
......@@ -4,7 +4,7 @@
<parent>
<groupId>com.dianping.cat</groupId>
<artifactId>parent</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>cat-home</artifactId>
......@@ -159,7 +159,8 @@
${basedir}/src/main/resources/META-INF/dal/model/heavy-report-manifest.xml,
${basedir}/src/main/resources/META-INF/dal/model/utilization-report-manifest.xml,
${basedir}/src/main/resources/META-INF/dal/model/utilization-config-manifest.xml,
${basedir}/src/main/resources/META-INF/dal/model/browser-report-manifest.xml,</manifest>
${basedir}/src/main/resources/META-INF/dal/model/browser-report-manifest.xml,
${basedir}/src/main/resources/META-INF/dal/model/domainGroup-manifest.xml,</manifest>
</configuration>
</execution>
<execution>
......
......@@ -44,6 +44,7 @@ import com.dianping.cat.report.service.ReportService;
import com.dianping.cat.report.view.DomainNavManager;
import com.dianping.cat.system.config.BugConfigManager;
import com.dianping.cat.system.config.ConfigReloadTask;
import com.dianping.cat.system.config.DomainGroupConfigManager;
import com.dianping.cat.system.config.ExceptionThresholdConfigManager;
import com.dianping.cat.system.config.UtilizationConfigManager;
......@@ -75,6 +76,8 @@ public class ComponentsConfigurator extends AbstractResourceConfigurator {
all.add(C(TopologyGraphConfigManager.class).req(ConfigDao.class));
all.add(C(ExceptionThresholdConfigManager.class).req(ConfigDao.class));
all.add(C(DomainGroupConfigManager.class).req(ConfigDao.class));
all.add(C(BugConfigManager.class).req(ConfigDao.class));
......
......@@ -7,7 +7,7 @@ public class BaselineConfigManager {
public BaselineConfig queryBaseLineConfig(String key) {
BaselineConfig config = new BaselineConfig();
Integer[] days = { -21, -14, -7, 0 };
Double[] weights = { 1.0, 1.0, 1.0, 1.0 };
Double[] weights = { 1.0, 2.0, 3.0, 4.0 };
config.setDays(Arrays.asList(days));
config.setId(1);
......
package com.dianping.cat.report.page.dependency;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
......@@ -186,18 +185,16 @@ public class Handler implements PageHandler<Context> {
}
private void buildMetricDashboard(Model model, Payload payload, long date) {
Date start = new Date(date - 6 * TimeUtil.ONE_HOUR);
Date end = new Date(date + TimeUtil.ONE_HOUR);
System.err.println(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(start));
System.err.println(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(end));
Map<String, LineChart> allCharts = m_graphCreator.buildDashboard(start, end, "-1");
model.setReportStart(new Date(payload.getDate()));
model.setReportEnd(new Date(payload.getDate() + TimeUtil.ONE_HOUR - 1));
model.setLineCharts(new ArrayList<LineChart>(allCharts.values()));
m_externalInfoBuilder.buildTopErrorInfo(payload, model);
}
Date start = new Date(date - payload.getRange() * TimeUtil.ONE_HOUR);
Date end = new Date(date + TimeUtil.ONE_HOUR);
Map<String, LineChart> allCharts = m_graphCreator.buildDashboard(start, end, "-1");
model.setReportStart(new Date(payload.getDate()));
model.setReportEnd(new Date(payload.getDate() + TimeUtil.ONE_HOUR - 1));
model.setLineCharts(new ArrayList<LineChart>(allCharts.values()));
m_externalInfoBuilder.buildTopErrorInfo(payload, model);
}
private void buildProductLineChart(Model model, Payload payload, Date reportTime) {
String productLine = payload.getProductLine();
......
......@@ -15,6 +15,9 @@ public class Payload extends AbstractReportPayload<Action> {
private ReportPage m_page;
@FieldMeta("range")
private int m_range = 24;
@FieldMeta("op")
private Action m_action;
......@@ -141,4 +144,12 @@ public class Payload extends AbstractReportPayload<Action> {
m_tab = tab;
}
public int getRange() {
return m_range;
}
public void setRange(int range) {
m_range = range;
}
}
......@@ -7,7 +7,15 @@ public enum Action implements org.unidal.web.mvc.Action {
HISTORY_REPORT("history"),
HOURLY_REPORT("view");
HOURLY_REPORT("view"),
GROUP_GRAPHS("groupGraphs"),
HISTORY_GROUP_GRAPH("historyGroupGraph"),
HISTORY_GROUP_REPORT("historyGroupReport"),
HOURLY_GROUP_REPORT("groupReport");
public static Action getByName(String name, Action defaultAction) {
for (Action action : Action.values()) {
......
......@@ -5,7 +5,7 @@ import com.dianping.cat.consumer.event.model.entity.EventReport;
public class EventMergeManager {
public EventReport mergerAll(EventReport report, String ipAddress, String allName) {
public EventReport mergerAllName(EventReport report, String ipAddress, String allName) {
EventReport temp = mergerAllIp(report, ipAddress);
return mergerAllName(temp, allName);
......
......@@ -2,7 +2,6 @@ package com.dianping.cat.report.page.event;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Set;
......@@ -22,16 +21,19 @@ import com.dianping.cat.consumer.event.EventAnalyzer;
import com.dianping.cat.consumer.event.model.entity.EventName;
import com.dianping.cat.consumer.event.model.entity.EventReport;
import com.dianping.cat.consumer.event.model.entity.EventType;
import com.dianping.cat.consumer.event.model.entity.Machine;
import com.dianping.cat.helper.TimeUtil;
import com.dianping.cat.report.ReportPage;
import com.dianping.cat.report.graph.GraphBuilder;
import com.dianping.cat.report.page.PayloadNormalizer;
import com.dianping.cat.report.page.PieChart;
import com.dianping.cat.report.page.PieChart.Item;
import com.dianping.cat.report.page.event.DisplayNames.EventNameModel;
import com.dianping.cat.report.page.model.spi.ModelService;
import com.dianping.cat.report.service.ReportService;
import com.dianping.cat.service.ModelRequest;
import com.dianping.cat.service.ModelResponse;
import com.dianping.cat.system.config.DomainGroupConfigManager;
import com.google.gson.Gson;
public class Handler implements PageHandler<Context> {
......@@ -40,7 +42,7 @@ public class Handler implements PageHandler<Context> {
private GraphBuilder m_builder;
@Inject
private HistoryGraphs m_eventHistoryGraphs;
private HistoryGraphs m_historyGraphs;
@Inject
private JspViewer m_jspViewer;
......@@ -57,14 +59,46 @@ public class Handler implements PageHandler<Context> {
@Inject
private PayloadNormalizer m_normalizePayload;
private void buildEventNameGraph(String ip, String type, EventReport report, Model model) {
@Inject
private DomainGroupConfigManager m_configManager;
private void buildEventMetaInfo(Model model, Payload payload, EventReport report) {
String type = payload.getType();
String sorted = payload.getSortBy();
String ip = payload.getIpAddress();
if (!StringUtils.isEmpty(type)) {
DisplayNames displayNames = new DisplayNames();
model.setDisplayNameReport(displayNames.display(sorted, type, ip, report));
buildEventNamePieChart(displayNames.getResults(), model);
} else {
model.setDisplayTypeReport(new DisplayTypes().display(sorted, ip, payload.isShowAll(), report));
}
}
private void buildEventNameGraph(Model model, EventReport report, String type, String name, String ip) {
EventType t = report.findOrCreateMachine(ip).findOrCreateType(type);
EventName eventName = t.findOrCreateName(name);
if (eventName != null) {
String graph1 = m_builder.build(new HitPayload("Hits Over Time", "Time (min)", "Count", eventName));
String graph2 = m_builder.build(new FailurePayload("Failures Over Time", "Time (min)", "Count", eventName));
model.setGraph1(graph1);
model.setGraph2(graph2);
}
}
private void buildEventNamePieChart(List<EventNameModel> names, Model model) {
PieChart chart = new PieChart();
Collection<EventName> values = report.findOrCreateMachine(ip).findOrCreateType(type).getNames().values();
List<Item> items = new ArrayList<Item>();
for (EventName name : values) {
for (int i = 1; i < names.size(); i++) {
EventNameModel name = names.get(i);
Item item = new Item();
item.setNumber(name.getTotalCount()).setTitle(name.getId());
EventName event = name.getDetail();
item.setNumber(event.getTotalCount()).setTitle(event.getId());
items.add(item);
}
......@@ -89,16 +123,32 @@ public class Handler implements PageHandler<Context> {
}
}
private EventName getEventName(Payload payload) {
private EventReport filterReportByGroup(EventReport report, String domain, String group) {
List<String> ips = m_configManager.queryIpByDomainAndGroup(domain, group);
List<String> removes = new ArrayList<String>();
for (Machine machine : report.getMachines().values()) {
String ip = machine.getIp();
if (!ips.contains(ip)) {
removes.add(ip);
}
}
for (String ip : removes) {
report.getMachines().remove(ip);
}
return report;
}
private EventReport getEventGraphReport(Model model, Payload payload) {
String domain = payload.getDomain();
String type = payload.getType();
String name = payload.getName();
String ipAddress = payload.getIpAddress();
String ip = payload.getIpAddress();
String name = payload.getName();
ModelRequest request = new ModelRequest(domain, payload.getDate()) //
.setProperty("type", payload.getType())//
.setProperty("type", payload.getType()) //
.setProperty("name", payload.getName())//
.setProperty("ip", ipAddress);
if (name == null || name.length() == 0) {
request.setProperty("name", "*");
request.setProperty("all", "true");
......@@ -106,17 +156,11 @@ public class Handler implements PageHandler<Context> {
}
ModelResponse<EventReport> response = m_service.invoke(request);
EventReport report = response.getModel();
report = m_mergeManager.mergerAll(report, ipAddress, name);
EventType t = report.getMachines().get(ip).findType(type);
if (t != null) {
return t.findName(name);
}
return null;
return report;
}
private EventReport getReport(Payload payload) {
private EventReport getHourlyReport(Payload payload) {
String domain = payload.getDomain();
String ipAddress = payload.getIpAddress();
ModelRequest request = new ModelRequest(domain, payload.getDate()) //
......@@ -134,8 +178,6 @@ public class Handler implements PageHandler<Context> {
domainNames.addAll(domains);
}
report = m_mergeManager.mergerAllIp(report, ipAddress);
calculateTps(payload, report);
return report;
} else {
throw new RuntimeException("Internal error: no eligable event service registered for " + request + "!");
......@@ -156,96 +198,95 @@ public class Handler implements PageHandler<Context> {
Payload payload = ctx.getPayload();
normalize(model, payload);
String domain = payload.getDomain();
Action action = payload.getAction();
String ipAddress = payload.getIpAddress();
String group = payload.getGroup();
String type = payload.getType();
String name = payload.getName();
String ip = payload.getIpAddress();
switch (payload.getAction()) {
model.setGroups(m_configManager.queryDomainGroup(payload.getDomain()));
switch (action) {
case HOURLY_REPORT:
showHourlyReport(model, payload);
EventReport report = getHourlyReport(payload);
report = m_mergeManager.mergerAllIp(report, ipAddress);
calculateTps(payload, report);
if (report != null) {
model.setReport(report);
buildEventMetaInfo(model, payload, report);
}
break;
case HISTORY_REPORT:
showSummarizeReport(model, payload);
report = m_reportService.queryEventReport(domain, payload.getHistoryStartDate(), payload.getHistoryEndDate());
calculateTps(payload, report);
if (report != null) {
model.setReport(report);
buildEventMetaInfo(model, payload, report);
}
break;
case HISTORY_GRAPH:
m_eventHistoryGraphs.buildTrendGraph(model, payload);
m_historyGraphs.buildTrendGraph(model, payload);
break;
case GRAPHS:
showGraphs(model, payload);
break;
}
report = getEventGraphReport(model, payload);
m_jspViewer.view(ctx, model);
}
private void normalize(Model model, Payload payload) {
model.setPage(ReportPage.EVENT);
m_normalizePayload.normalize(model, payload);
if (StringUtils.isEmpty(payload.getType())) {
payload.setType(null);
}
}
private void showGraphs(Model model, Payload payload) {
EventName name = getEventName(payload);
if (name == null) {
return;
}
String graph1 = m_builder.build(new HitPayload("Hits Over Time", "Time (min)", "Count", name));
String graph2 = m_builder.build(new FailurePayload("Failures Over Time", "Time (min)", "Count", name));
model.setGraph1(graph1);
model.setGraph2(graph2);
}
private void showHourlyReport(Model model, Payload payload) {
try {
EventReport report = getReport(payload);
if (name == null || name.length() == 0) {
name = Constants.ALL;
}
report = m_mergeManager.mergerAllName(report, ip, name);
model.setReport(report);
buildEventNameGraph(model, report, type, name, ip);
break;
case HOURLY_GROUP_REPORT:
report = getHourlyReport(payload);
report = filterReportByGroup(report, domain, group);
report = m_mergeManager.mergerAllIp(report, ipAddress);
calculateTps(payload, report);
if (report != null) {
model.setReport(report);
if (payload.getPeriod().isFuture()) {
model.setLongDate(payload.getCurrentDate());
} else {
model.setLongDate(payload.getDate());
buildEventMetaInfo(model, payload, report);
}
break;
case HISTORY_GROUP_REPORT:
report = m_reportService.queryEventReport(domain, payload.getHistoryStartDate(), payload.getHistoryEndDate());
calculateTps(payload, report);
report = filterReportByGroup(report, domain, group);
report = m_mergeManager.mergerAllIp(report, ipAddress);
if (report != null) {
model.setReport(report);
buildEventMetaInfo(model, payload, report);
}
break;
case GROUP_GRAPHS:
report = getEventGraphReport(model, payload);
report = filterReportByGroup(report, domain, group);
String type = payload.getType();
String sorted = payload.getSortBy();
String ip = payload.getIpAddress();
if (!StringUtils.isEmpty(type)) {
model.setDisplayNameReport(new DisplayNames().display(sorted, type, ip, report));
buildEventNameGraph(ip, type, report, model);
} else {
model.setDisplayTypeReport(new DisplayTypes().display(sorted, ip, payload.isShowAll(), report));
if (name == null || name.length() == 0) {
name = Constants.ALL;
}
} catch (Throwable e) {
Cat.logError(e);
model.setException(e);
report = m_mergeManager.mergerAllName(report, ip, name);
model.setReport(report);
buildEventNameGraph(model, report, type, name, ip);
break;
case HISTORY_GROUP_GRAPH:
break;
}
m_jspViewer.view(ctx, model);
}
private void showSummarizeReport(Model model, Payload payload) {
String type = payload.getType();
String sorted = payload.getSortBy();
String ip = payload.getIpAddress();
String domain = model.getDomain();
Date start = payload.getHistoryStartDate();
Date end = payload.getHistoryEndDate();
EventReport eventReport = m_reportService.queryEventReport(domain, start, end);
private void normalize(Model model, Payload payload) {
model.setPage(ReportPage.EVENT);
m_normalizePayload.normalize(model, payload);
calculateTps(payload, eventReport);
model.setReport(eventReport);
if (!StringUtils.isEmpty(type)) {
model.setDisplayNameReport(new DisplayNames().display(sorted, type, ip, eventReport));
buildEventNameGraph(ip, type, eventReport, model);
} else {
model.setDisplayTypeReport(new DisplayTypes().display(sorted, ip, payload.isShowAll(), eventReport));
if (StringUtils.isEmpty(payload.getType())) {
payload.setType(null);
}
}
......
......@@ -7,8 +7,17 @@ public enum JspFile {
HISTORY_REPORT("/jsp/report/event/eventHistoryReport.jsp"),
HOURLY_REPORT("/jsp/report/event/event.jsp");
HOURLY_REPORT("/jsp/report/event/event.jsp"),
GROUP_GRAPHS("/jsp/report/event/event_graphs.jsp"),
HISTORY_GROUP_GRAPH("/jsp/report/event/eventHistoryGraphs.jsp"),
HISTORY_GROUP_REPORT("/jsp/report/event/eventHistoryGroupReport.jsp"),
HOURLY_GROUP_REPORT("/jsp/report/event/eventGroup.jsp");
private String m_path;
private JspFile(String path) {
......
......@@ -18,6 +18,14 @@ public class JspViewer extends BaseJspViewer<ReportPage, Action, Context, Model>
return JspFile.HISTORY_GRAPH.getPath();
case GRAPHS:
return JspFile.GRAPHS.getPath();
case GROUP_GRAPHS:
return JspFile.GROUP_GRAPHS.getPath();
case HISTORY_GROUP_GRAPH:
return JspFile.HISTORY_GROUP_GRAPH.getPath();
case HISTORY_GROUP_REPORT:
return JspFile.HISTORY_GROUP_REPORT.getPath();
case HOURLY_GROUP_REPORT:
return JspFile.HOURLY_GROUP_REPORT.getPath();
}
throw new RuntimeException("Unknown action: " + action);
......
......@@ -20,6 +20,8 @@ public class Model extends AbstractReportModel<Action, Context> {
@EntityMeta
private DisplayTypes m_displayTypeReport;
private List<String> m_groups;
private String m_failureTrend;
private String m_graph1;
......@@ -178,4 +180,12 @@ public class Model extends AbstractReportModel<Action, Context> {
m_type = type;
}
public List<String> getGroups() {
return m_groups;
}
public void setGroups(List<String> groups) {
m_groups = groups;
}
}
......@@ -21,6 +21,9 @@ public class Payload extends AbstractReportPayload<Action> {
@FieldMeta("type")
private String m_type;
@FieldMeta("group")
private String m_group;
public Payload() {
super(ReportPage.EVENT);
......@@ -67,6 +70,14 @@ public class Payload extends AbstractReportPayload<Action> {
m_type = type;
}
public String getGroup() {
return m_group;
}
public void setGroup(String group) {
m_group = group;
}
@Override
public void validate(ActionContext<?> ctx) {
if (m_action == null) {
......
package com.dianping.cat.report.page.metric.chart;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
......@@ -14,6 +15,8 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.codehaus.plexus.logging.LogEnabled;
import org.codehaus.plexus.logging.Logger;
import org.unidal.lookup.annotation.Inject;
import com.dianping.cat.advanced.metric.config.entity.MetricItemConfig;
......@@ -28,7 +31,7 @@ import com.dianping.cat.report.baseline.BaselineService;
import com.dianping.cat.report.page.LineChart;
import com.dianping.cat.report.task.metric.MetricType;
public class GraphCreator {
public class GraphCreator implements LogEnabled {
@Inject
private BaselineService m_baselineService;
......@@ -52,6 +55,8 @@ public class GraphCreator {
private int m_extraTime = 1;
private Logger m_logger;
private Map<String, LineChart> buildChartData(final Map<String, double[]> datas, Date startDate, Date endDate,
final Map<String, double[]> dataWithOutFutures) {
int step = m_dataExtractor.getStep();
......@@ -234,9 +239,7 @@ public class GraphCreator {
List<String> domains = m_productLineConfigManager.queryProductLineDomains(productLine);
List<MetricItemConfig> metricConfigs = m_metricConfigManager.queryMetricItemConfigs(new HashSet<String>(
domains));
MetricReport metricReport = m_metricReportService.query(productLine, new Date(start));
Map<String, double[]> currentValues = m_pruductDataFetcher.buildGraphData(metricReport, metricConfigs,
abtestId);
Map<String, double[]> currentValues = queryMetricValueByDate(productLine, abtestId, start, metricConfigs);
mergeMap(oldCurrentValues, currentValues, totalSize, index);
index++;
......@@ -244,6 +247,34 @@ public class GraphCreator {
return oldCurrentValues;
}
private Map<String, double[]> queryMetricValueByDate(String productLine, String abtestId, long start,
List<MetricItemConfig> metricConfigs) {
MetricReport metricReport = m_metricReportService.query(productLine, new Date(start));
Map<String, double[]> currentValues = m_pruductDataFetcher.buildGraphData(metricReport, metricConfigs, abtestId);
double sum = 0;
for (Entry<String, double[]> entry : currentValues.entrySet()) {
double[] value = entry.getValue();
int length = value.length;
for (int i = 0; i < length; i++) {
sum = sum + value[i];
}
}
// if current report is not exist, use last day value replace it.
if (sum <= 0 && start < TimeUtil.getCurrentHour().getTime()) {
MetricReport lastMetricReport = m_metricReportService.query(productLine, new Date(start - TimeUtil.ONE_DAY));
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:ss");
m_logger.error("Metric report is not exsit, productLine:" + productLine + " ,date:"
+ sdf.format(new Date(start)));
return m_pruductDataFetcher.buildGraphData(lastMetricReport, metricConfigs, abtestId);
}
return currentValues;
}
private void put(Map<String, LineChart> charts, Map<String, LineChart> result, String key) {
LineChart value = charts.get(key);
......@@ -301,4 +332,9 @@ public class GraphCreator {
return false;
}
@Override
public void enableLogging(Logger logger) {
m_logger = logger;
}
}
......@@ -5,15 +5,23 @@ public enum Action implements org.unidal.web.mvc.Action {
GROUP("group"),
THREAD("thread"),
HOUR_GRAPH("hourlyGraph"),
HISTORY("history"),
HISTORY_REPORT("history"),
HISTORY_GRAPH("historyGraph"),
THREAD("thread"),
HOULY_REPORT("view"),
GROUP_GRAPHS("groupGraphs"),
HISTORY_GROUP_GRAPH("historyGroupGraph"),
HISTORY_GROUP_REPORT("historyGroupReport"),
VIEW("view");
HOURLY_GROUP_REPORT("groupReport");
public static Action getByName(String name, Action defaultAction) {
for (Action action : Action.values()) {
......
......@@ -145,7 +145,7 @@ public class Handler implements PageHandler<Context> {
longConfig.setCacheThreshold(payload.getCacheThreshold()).setCallThreshold(payload.getCallThreshold());
problemStatistics.setLongConfig(longConfig);
switch (payload.getAction()) {
case VIEW:
case HOULY_REPORT:
report = getHourlyReport(payload, VIEW);
model.setReport(report);
if (ip.equals(Constants.ALL)) {
......@@ -156,7 +156,7 @@ public class Handler implements PageHandler<Context> {
problemStatistics.visitProblemReport(report);
model.setAllStatistics(problemStatistics);
break;
case HISTORY:
case HISTORY_REPORT:
report = showSummarizeReport(model, payload);
if (ip.equals(Constants.ALL)) {
problemStatistics.setAllIp(true);
......
......@@ -10,7 +10,7 @@ public class JspViewer extends BaseJspViewer<ReportPage, Action, Context, Model>
Action action = model.getAction();
switch (action) {
case VIEW:
case HOULY_REPORT:
return JspFile.ALL.getPath();
case GROUP:
return JspFile.GROUP.getPath();
......@@ -18,7 +18,7 @@ public class JspViewer extends BaseJspViewer<ReportPage, Action, Context, Model>
return JspFile.THREAD.getPath();
case DETAIL:
return JspFile.DETAIL.getPath();
case HISTORY:
case HISTORY_REPORT:
return JspFile.HISTORY.getPath();
case HISTORY_GRAPH:
return JspFile.HISTORY_GRAPH.getPath();
......
......@@ -127,7 +127,7 @@ public class Payload extends AbstractReportPayload<Action> {
}
public void setAction(String action) {
m_action = Action.getByName(action, Action.VIEW);
m_action = Action.getByName(action, Action.HOULY_REPORT);
}
public void setGroupName(String groupName) {
......@@ -161,7 +161,7 @@ public class Payload extends AbstractReportPayload<Action> {
@Override
public void validate(ActionContext<?> ctx) {
if (m_action == null) {
m_action = Action.VIEW;
m_action = Action.HOULY_REPORT;
}
}
}
......@@ -7,7 +7,15 @@ public enum Action implements org.unidal.web.mvc.Action {
HISTORY_REPORT("history"),
HOURLY_REPORT("view");
HOURLY_REPORT("view"),
GROUP_GRAPHS("groupGraphs"),
HISTORY_GROUP_GRAPH("historyGroupGraph"),
HISTORY_GROUP_REPORT("historyGroupReport"),
HOURLY_GROUP_REPORT("groupReport");
public static Action getByName(String name, Action defaultAction) {
for (Action action : Action.values()) {
......
......@@ -18,6 +18,7 @@ import org.unidal.web.mvc.annotation.PayloadMeta;
import com.dianping.cat.Cat;
import com.dianping.cat.Constants;
import com.dianping.cat.consumer.transaction.TransactionAnalyzer;
import com.dianping.cat.consumer.transaction.model.entity.Machine;
import com.dianping.cat.consumer.transaction.model.entity.TransactionName;
import com.dianping.cat.consumer.transaction.model.entity.TransactionReport;
import com.dianping.cat.consumer.transaction.model.entity.TransactionType;
......@@ -36,6 +37,7 @@ import com.dianping.cat.report.page.transaction.GraphPayload.HitPayload;
import com.dianping.cat.report.service.ReportService;
import com.dianping.cat.service.ModelRequest;
import com.dianping.cat.service.ModelResponse;
import com.dianping.cat.system.config.DomainGroupConfigManager;
import com.google.gson.Gson;
public class Handler implements PageHandler<Context> {
......@@ -61,10 +63,13 @@ public class Handler implements PageHandler<Context> {
@Inject
private PayloadNormalizer m_normalizePayload;
@Inject
private DomainGroupConfigManager m_configManager;
@Inject(type = ModelService.class, value = TransactionAnalyzer.ID)
private ModelService<TransactionReport> m_service;
private void buildTransactionNameGraph(List<TransactionNameModel> names, Model model) {
private void buildTransactionNamePieChart(List<TransactionNameModel> names, Model model) {
PieChart chart = new PieChart();
List<Item> items = new ArrayList<Item>();
......@@ -124,24 +129,21 @@ public class Handler implements PageHandler<Context> {
domainNames.addAll(domains);
}
report = m_mergeManager.mergerAllIp(report, ipAddress);
calculateTps(payload, report);
return report;
} else {
throw new RuntimeException("Internal error: no eligable transaction service registered for " + request + "!");
}
}
private TransactionName getTransactionName(Model model, Payload payload) {
private TransactionReport getTransactionGraphReport(Model model, Payload payload) {
String domain = payload.getDomain();
String type = payload.getType();
String name = payload.getName();
String ip = payload.getIpAddress();
String ipAddress = payload.getIpAddress();
String name = payload.getName();
ModelRequest request = new ModelRequest(domain, payload.getDate()) //
.setProperty("type", payload.getType()) //
.setProperty("name", payload.getName())//
.setProperty("ip", ipAddress);
if (name == null || name.length() == 0) {
request.setProperty("name", "*");
request.setProperty("all", "true");
......@@ -150,16 +152,7 @@ public class Handler implements PageHandler<Context> {
ModelResponse<TransactionReport> response = m_service.invoke(request);
TransactionReport report = response.getModel();
report = m_mergeManager.mergerAll(report, ipAddress, name);
model.setReport(report);
TransactionType t = report.getMachines().get(ip).findType(type);
if (t != null) {
return t.findName(name);
} else {
return null;
}
return report;
}
@Override
......@@ -176,27 +169,86 @@ public class Handler implements PageHandler<Context> {
Payload payload = ctx.getPayload();
normalize(model, payload);
String domain = payload.getDomain();
Action action = payload.getAction();
String ipAddress = payload.getIpAddress();
String group = payload.getGroup();
String type = payload.getType();
switch (payload.getAction()) {
String name = payload.getName();
String ip = payload.getIpAddress();
model.setGroups(m_configManager.queryDomainGroup(payload.getDomain()));
switch (action) {
case HOURLY_REPORT:
showHourlyReport(model, payload);
DisplayNames displayNameReport = model.getDisplayNameReport();
if ((!StringUtils.isEmpty(type)) && displayNameReport != null) {
buildTransactionNameGraph(displayNameReport.getResults(), model);
TransactionReport report = getHourlyReport(payload);
report = m_mergeManager.mergerAllIp(report, ipAddress);
calculateTps(payload, report);
if (report != null) {
model.setReport(report);
buildTransactionMetaInfo(model, payload, report);
}
break;
case HISTORY_REPORT:
showSummarizeReport(model, payload);
displayNameReport = model.getDisplayNameReport();
if ((!StringUtils.isEmpty(type)) && displayNameReport != null) {
buildTransactionNameGraph(displayNameReport.getResults(), model);
report = m_reportService.queryTransactionReport(domain, payload.getHistoryStartDate(),
payload.getHistoryEndDate());
calculateTps(payload, report);
if (report != null) {
model.setReport(report);
buildTransactionMetaInfo(model, payload, report);
}
break;
case HISTORY_GRAPH:
m_historyGraph.buildTrendGraph(model, payload);
break;
case GRAPHS:
showHourlyGraphs(model, payload);
report = getTransactionGraphReport(model, payload);
if (name == null || name.length() == 0) {
name = Constants.ALL;
}
report = m_mergeManager.mergerAllName(report, ip, name);
model.setReport(report);
buildTransactionNameGraph(model, report, type, name, ip);
break;
case HOURLY_GROUP_REPORT:
report = getHourlyReport(payload);
report = filterReportByGroup(report, domain, group);
report = m_mergeManager.mergerAllIp(report, ipAddress);
calculateTps(payload, report);
if (report != null) {
model.setReport(report);
buildTransactionMetaInfo(model, payload, report);
}
break;
case HISTORY_GROUP_REPORT:
report = m_reportService.queryTransactionReport(domain, payload.getHistoryStartDate(),
payload.getHistoryEndDate());
calculateTps(payload, report);
report = filterReportByGroup(report, domain, group);
report = m_mergeManager.mergerAllIp(report, ipAddress);
if (report != null) {
model.setReport(report);
buildTransactionMetaInfo(model, payload, report);
}
break;
case GROUP_GRAPHS:
report = getTransactionGraphReport(model, payload);
report = filterReportByGroup(report, domain, group);
if (name == null || name.length() == 0) {
name = Constants.ALL;
}
report = m_mergeManager.mergerAllName(report, ip, name);
model.setReport(report);
buildTransactionNameGraph(model, report, type, name, ip);
break;
case HISTORY_GROUP_GRAPH:
break;
}
......@@ -207,32 +259,18 @@ public class Handler implements PageHandler<Context> {
}
}
private void normalize(Model model, Payload payload) {
model.setPage(ReportPage.TRANSACTION);
m_normalizePayload.normalize(model, payload);
if (StringUtils.isEmpty(payload.getQueryName())) {
payload.setQueryName(null);
}
if (StringUtils.isEmpty(payload.getType())) {
payload.setType(null);
}
String queryName = payload.getQueryName();
if (queryName != null) {
model.setQueryName(queryName);
}
}
private void showHourlyGraphs(Model model, Payload payload) {
TransactionName name = getTransactionName(model, payload);
private void buildTransactionNameGraph(Model model, TransactionReport report, String type, String name, String ip) {
TransactionType t = report.findOrCreateMachine(ip).findOrCreateType(type);
TransactionName transactionName = t.findOrCreateName(name);
if (name != null) {
String graph1 = m_builder.build(new DurationPayload("Duration Distribution", "Duration (ms)", "Count", name));
String graph2 = m_builder.build(new HitPayload("Hits Over Time", "Time (min)", "Count", name));
if (transactionName != null) {
String graph1 = m_builder.build(new DurationPayload("Duration Distribution", "Duration (ms)", "Count",
transactionName));
String graph2 = m_builder.build(new HitPayload("Hits Over Time", "Time (min)", "Count", transactionName));
String graph3 = m_builder.build(new AverageTimePayload("Average Duration Over Time", "Time (min)",
"Average Duration (ms)", name));
String graph4 = m_builder.build(new FailurePayload("Failures Over Time", "Time (min)", "Count", name));
"Average Duration (ms)", transactionName));
String graph4 = m_builder.build(new FailurePayload("Failures Over Time", "Time (min)", "Count",
transactionName));
model.setGraph1(graph1);
model.setGraph2(graph2);
......@@ -241,47 +279,53 @@ public class Handler implements PageHandler<Context> {
}
}
private void showHourlyReport(Model model, Payload payload) {
try {
TransactionReport report = getHourlyReport(payload);
private TransactionReport filterReportByGroup(TransactionReport report, String domain, String group) {
List<String> ips = m_configManager.queryIpByDomainAndGroup(domain, group);
List<String> removes = new ArrayList<String>();
if (report != null) {
model.setReport(report);
for (Machine machine : report.getMachines().values()) {
String ip = machine.getIp();
String type = payload.getType();
String sorted = payload.getSortBy();
String queryName = payload.getQueryName();
String ip = payload.getIpAddress();
if (!StringUtils.isEmpty(type)) {
model.setDisplayNameReport(new DisplayNames().display(sorted, type, ip, report, queryName));
} else {
model.setDisplayTypeReport(new DisplayTypes().display(sorted, ip, report));
}
if (!ips.contains(ip)) {
removes.add(ip);
}
} catch (Throwable e) {
Cat.logError(e);
model.setException(e);
}
for (String ip : removes) {
report.getMachines().remove(ip);
}
return report;
}
private void showSummarizeReport(Model model, Payload payload) {
private void buildTransactionMetaInfo(Model model, Payload payload, TransactionReport report) {
String type = payload.getType();
String sorted = payload.getSortBy();
String queryName = payload.getQueryName();
String ip = payload.getIpAddress();
String domain = model.getDomain();
Date start = payload.getHistoryStartDate();
Date end = payload.getHistoryEndDate();
TransactionReport transactionReport = m_reportService.queryTransactionReport(domain, start, end);
calculateTps(payload, transactionReport);
model.setReport(transactionReport);
if (transactionReport != null) {
if (!StringUtils.isEmpty(type)) {
model.setDisplayNameReport(new DisplayNames().display(sorted, type, ip, transactionReport,
payload.getQueryName()));
} else {
model.setDisplayTypeReport(new DisplayTypes().display(sorted, ip, transactionReport));
}
if (!StringUtils.isEmpty(type)) {
DisplayNames displayNames = new DisplayNames();
model.setDisplayNameReport(displayNames.display(sorted, type, ip, report, queryName));
buildTransactionNamePieChart(displayNames.getResults(), model);
} else {
model.setDisplayTypeReport(new DisplayTypes().display(sorted, ip, report));
}
}
private void normalize(Model model, Payload payload) {
model.setPage(ReportPage.TRANSACTION);
m_normalizePayload.normalize(model, payload);
if (StringUtils.isEmpty(payload.getQueryName())) {
payload.setQueryName(null);
}
if (StringUtils.isEmpty(payload.getType())) {
payload.setType(null);
}
String queryName = payload.getQueryName();
if (queryName != null) {
model.setQueryName(queryName);
}
}
......
......@@ -7,7 +7,15 @@ public enum JspFile {
HISTORY_REPORT("/jsp/report/transaction/transactionHistoryReport.jsp"),
HOURLY_REPORT("/jsp/report/transaction/transaction.jsp");
HOURLY_REPORT("/jsp/report/transaction/transaction.jsp"),
GROUP_GRAPHS("/jsp/report/transaction/transactionGraphs.jsp"),
HISTORY_GROUP_GRAPH("/jsp/report/transaction/transactionHistoryGraphs.jsp"),
HISTORY_GROUP_REPORT("/jsp/report/transaction/transactionHistoryGroupReport.jsp"),
HOURLY_GROUP_REPORT("/jsp/report/transaction/transactionGroup.jsp");
private String m_path;
......
......@@ -18,6 +18,14 @@ public class JspViewer extends BaseJspViewer<ReportPage, Action, Context, Model>
return JspFile.HISTORY_REPORT.getPath();
case HISTORY_GRAPH:
return JspFile.HISTORY_GRAPH.getPath();
case GROUP_GRAPHS:
return JspFile.GROUP_GRAPHS.getPath();
case HISTORY_GROUP_GRAPH:
return JspFile.HISTORY_GROUP_GRAPH.getPath();
case HISTORY_GROUP_REPORT:
return JspFile.HISTORY_GROUP_REPORT.getPath();
case HOURLY_GROUP_REPORT:
return JspFile.HOURLY_GROUP_REPORT.getPath();
}
throw new RuntimeException("Unknown action: " + action);
......
......@@ -19,6 +19,8 @@ public class Model extends AbstractReportModel<Action, Context> {
@EntityMeta
private DisplayTypes m_displayTypeReport;
private List<String> m_groups;
private String m_errorTrend;
......@@ -198,4 +200,12 @@ public class Model extends AbstractReportModel<Action, Context> {
m_type = type;
}
public List<String> getGroups() {
return m_groups;
}
public void setGroups(List<String> groups) {
m_groups = groups;
}
}
......@@ -24,7 +24,10 @@ public class Payload extends AbstractReportPayload<Action> {
@FieldMeta("xml")
private boolean m_xml;
@FieldMeta("group")
private String m_group;
public Payload() {
super(ReportPage.TRANSACTION);
}
......@@ -78,6 +81,14 @@ public class Payload extends AbstractReportPayload<Action> {
m_xml = xml;
}
public String getGroup() {
return m_group;
}
public void setGroup(String group) {
m_group = group;
}
@Override
public void validate(ActionContext<?> ctx) {
if (m_action == null) {
......
......@@ -5,7 +5,7 @@ import com.dianping.cat.consumer.transaction.model.entity.TransactionReport;
public class TransactionMergeManager {
public TransactionReport mergerAll(TransactionReport report, String ipAddress, String allName) {
public TransactionReport mergerAllName(TransactionReport report, String ipAddress, String allName) {
TransactionReport temp = mergerAllIp(report, ipAddress);
return mergerAllName(temp, allName);
......
......@@ -2,7 +2,6 @@ package com.dianping.cat.report.view;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
......@@ -116,7 +115,7 @@ public class DomainNavManager implements Task, Initializable {
public static class Department {
private Map<String, ProjectLine> m_projectLines = new HashMap<String, ProjectLine>();
private Map<String, ProjectLine> m_projectLines = new TreeMap<String, ProjectLine>();
public ProjectLine findOrCreatProjectLine(String projectLine) {
if (projectLine == null) {
......
package com.dianping.cat.system.config;
import java.util.ArrayList;
import java.util.List;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
import org.unidal.dal.jdbc.DalNotFoundException;
import org.unidal.helper.Files;
import org.unidal.lookup.annotation.Inject;
import com.dianping.cat.Cat;
import com.dianping.cat.core.config.Config;
import com.dianping.cat.core.config.ConfigDao;
import com.dianping.cat.core.config.ConfigEntity;
import com.dianping.cat.home.domainGroup.entity.Domain;
import com.dianping.cat.home.domainGroup.entity.DomainGroup;
import com.dianping.cat.home.domainGroup.entity.Group;
import com.dianping.cat.home.domainGroup.transform.DefaultSaxParser;
public class DomainGroupConfigManager implements Initializable {
@Inject
private ConfigDao m_configDao;
private int m_configId;
private DomainGroup m_domainGroup;
private static final String CONFIG_NAME = "domainGroup";
public DomainGroup getDomainGroup() {
return m_domainGroup;
}
public List<String> queryDomainGroup(String domain) {
Domain domainGroup = m_domainGroup.findDomain(domain);
if (domainGroup == null) {
return new ArrayList<String>();
} else {
return new ArrayList<String>(domainGroup.getGroups().keySet());
}
}
public List<String> queryIpByDomainAndGroup(String domain, String group) {
Domain domainInfo = m_domainGroup.findDomain(domain);
if (domainInfo != null) {
Group groupInfo = domainInfo.findGroup(group);
if (groupInfo != null) {
return groupInfo.getIps();
}
}
return new ArrayList<String>();
}
public boolean insert(String xml) {
try {
m_domainGroup = DefaultSaxParser.parse(xml);
return storeConfig();
} catch (Exception e) {
Cat.logError(e);
return false;
}
}
private boolean storeConfig() {
synchronized (this) {
try {
Config config = m_configDao.createLocal();
config.setId(m_configId);
config.setKeyId(m_configId);
config.setName(CONFIG_NAME);
config.setContent(m_domainGroup.toString());
m_configDao.updateByPK(config, ConfigEntity.UPDATESET_FULL);
} catch (Exception e) {
Cat.logError(e);
return false;
}
}
return true;
}
@Override
public void initialize() throws InitializationException {
try {
Config config = m_configDao.findByName(CONFIG_NAME, ConfigEntity.READSET_FULL);
String content = config.getContent();
m_domainGroup = DefaultSaxParser.parse(content);
m_configId = config.getId();
} catch (DalNotFoundException e) {
try {
String content = Files.forIO().readFrom(
this.getClass().getResourceAsStream("/config/default-domain-group-config.xml"), "utf-8");
Config config = m_configDao.createLocal();
config.setName(CONFIG_NAME);
config.setContent(content);
m_configDao.insert(config);
m_domainGroup = DefaultSaxParser.parse(content);
m_configId = config.getId();
} catch (Exception ex) {
Cat.logError(ex);
}
} catch (Exception e) {
Cat.logError(e);
}
if (m_domainGroup == null) {
m_domainGroup = new DomainGroup();
}
}
}
......@@ -57,7 +57,9 @@ public enum Action implements org.unidal.web.mvc.Action {
BUG_CONFIG_UPDATE("bugConfigUpdate"),
UTILIZATION_CONFIG_UPDATE("utilizationConfigUpdate"), ;
UTILIZATION_CONFIG_UPDATE("utilizationConfigUpdate"),
DOMAIN_GROUP_CONFIG_UPDATE("domainGroupConfigUpdate"),;
private String m_name;
......
......@@ -39,6 +39,7 @@ import com.dianping.cat.report.page.dependency.graph.TopologyGraphConfigManager;
import com.dianping.cat.report.view.DomainNavManager;
import com.dianping.cat.system.SystemPage;
import com.dianping.cat.system.config.BugConfigManager;
import com.dianping.cat.system.config.DomainGroupConfigManager;
import com.dianping.cat.system.config.ExceptionThresholdConfigManager;
import com.dianping.cat.system.config.UtilizationConfigManager;
......@@ -67,6 +68,9 @@ public class Handler implements PageHandler<Context> {
@Inject
private UtilizationConfigManager m_utilizationConfigManager;
@Inject
private DomainGroupConfigManager m_domainGroupConfigManger;
@Inject
private BugConfigManager m_bugConfigManager;
......@@ -298,6 +302,16 @@ public class Handler implements PageHandler<Context> {
}
model.setContent(m_utilizationConfigManager.getUtilizationConfig().toString());
break;
case DOMAIN_GROUP_CONFIG_UPDATE:
String domainGroupContent = payload.getContent();
if (!StringUtils.isEmpty(domainGroupContent)) {
model.setOpState(m_domainGroupConfigManger.insert(domainGroupContent));
} else {
model.setOpState(true);
}
model.setContent(m_domainGroupConfigManger.getDomainGroup().toString());
break;
}
m_jspViewer.view(ctx, model);
}
......
......@@ -33,7 +33,9 @@ public enum JspFile {
BUG_CONFIG_UPDATE("/jsp/system/bug/bugConfig.jsp"),
UTILIZATION_CONFIG_UPDATE("/jsp/system/utilization/utilizationConfig.jsp"), ;
UTILIZATION_CONFIG_UPDATE("/jsp/system/utilization/utilizationConfig.jsp"),
DOMAIN_GROUP_CONFIG_UPDATE("/jsp/system/domainGroup/domainGroupConfig.jsp"), ;
private String m_path;
......
......@@ -74,6 +74,8 @@ public class JspViewer extends BaseJspViewer<SystemPage, Action, Context, Model>
return JspFile.BUG_CONFIG_UPDATE.getPath();
case UTILIZATION_CONFIG_UPDATE:
return JspFile.UTILIZATION_CONFIG_UPDATE.getPath();
case DOMAIN_GROUP_CONFIG_UPDATE:
return JspFile.DOMAIN_GROUP_CONFIG_UPDATE.getPath();
}
throw new RuntimeException("Unknown action: " + action);
......
<?xml version="1.0" encoding="UTF-8"?>
<model>
<entity name="domain-group" root="true">
<entity-ref name="domain" type="list" names="domains" />
</entity>
<entity name="domain">
<attribute name="id" value-type="String" />
<entity-ref name="group" type="list" names="groups" />
</entity>
<entity name="group">
<attribute name="id" value-type="String" />
<element name="ip" value-type="String" type="list" names="ips" />
</entity>
</model>
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<file path="domainGroup-codegen.xml" />
<file path="domainGroup-model.xml" />
</manifest>
<?xml version="1.0" encoding="UTF-8"?>
<model model-package="com.dianping.cat.home.domainGroup" enable-merger="true" enable-sax-parser="true"
enable-base-visitor="true" enable-json-parser="true" enable-json-builder="true" enable-native-parser="true" enable-native-builder="true"
enable-xml-parser="false" enable-xml-builder="false">
<entity name="domain-group" root="true">
<entity-ref name="domain" type="map" names="domains" />
</entity>
<entity name="domain">
<attribute name="id" value-type="String" key="true"/>
<entity-ref name="group" type="map" names="groups" />
</entity>
<entity name="group">
<attribute name="id" value-type="String" key="true"/>
<element name="ip" value-type="String" type="list" names="ips" />
</entity>
</model>
\ No newline at end of file
......@@ -82,6 +82,15 @@
</requirement>
</requirements>
</component>
<component>
<role>com.dianping.cat.system.config.DomainGroupConfigManager</role>
<implementation>com.dianping.cat.system.config.DomainGroupConfigManager</implementation>
<requirements>
<requirement>
<role>com.dianping.cat.core.config.ConfigDao</role>
</requirement>
</requirements>
</component>
<component>
<role>com.dianping.cat.system.config.BugConfigManager</role>
<implementation>com.dianping.cat.system.config.BugConfigManager</implementation>
......@@ -1821,6 +1830,9 @@
<requirement>
<role>com.dianping.cat.report.page.PayloadNormalizer</role>
</requirement>
<requirement>
<role>com.dianping.cat.system.config.DomainGroupConfigManager</role>
</requirement>
<requirement>
<role>com.dianping.cat.report.page.model.spi.ModelService</role>
<role-hint>transaction</role-hint>
......@@ -1857,6 +1869,15 @@
<role>com.dianping.cat.report.page.transaction.TransactionMergeManager</role>
<implementation>com.dianping.cat.report.page.transaction.TransactionMergeManager</implementation>
</component>
<component>
<role>com.dianping.cat.system.config.DomainGroupConfigManager</role>
<implementation>com.dianping.cat.system.config.DomainGroupConfigManager</implementation>
<requirements>
<requirement>
<role>com.dianping.cat.core.config.ConfigDao</role>
</requirement>
</requirements>
</component>
<component>
<role>com.dianping.cat.report.page.event.Handler</role>
<implementation>com.dianping.cat.report.page.event.Handler</implementation>
......@@ -1884,6 +1905,9 @@
<requirement>
<role>com.dianping.cat.report.page.PayloadNormalizer</role>
</requirement>
<requirement>
<role>com.dianping.cat.system.config.DomainGroupConfigManager</role>
</requirement>
</requirements>
</component>
<component>
......@@ -2903,6 +2927,9 @@
<requirement>
<role>com.dianping.cat.system.config.UtilizationConfigManager</role>
</requirement>
<requirement>
<role>com.dianping.cat.system.config.DomainGroupConfigManager</role>
</requirement>
<requirement>
<role>com.dianping.cat.system.config.BugConfigManager</role>
</requirement>
......
......@@ -30,4 +30,7 @@
<model package="com.dianping.cat.home.utilization-config" name="utilization-config">
<sample-model>src/test/resources/com/dianping/cat/system/config/utilizationConfig.xml</sample-model>
</model>
<model package="com.dianping.cat.home.domainGroup" name="domainGroup">
<sample-model>src/test/resources/com/dianping/cat/system/config/domainGroup.xml</sample-model>
</model>
</wizard>
<domain-group>
<domain id="Cat">
<group id="weixin">
<ip>192.168.213.115</ip>
<ip>127.0.0.1</ip>
</group>
<group id="dianping">
<ip>192.168.213.115</ip>
<ip>127.0.0.1</ip>
</group>
</domain>
</domain-group>
\ No newline at end of file
......@@ -37,7 +37,7 @@
</td>
<td class="title"><span class="text-success"><span class="text-error">【报表时间】</span><jsp:invoke fragment="subtitle"/></span></td>
<td class="nav">
<span class="text-error switch">【<a class="switch" href="${model.baseUri}?op=history&domain=${model.domain}&ip=${model.ipAddress}"><span class="text-error">切到历史模式</span></a>】</span>
<span class="text-error switch"><a class="switch" href="${model.baseUri}?op=history&domain=${model.domain}&ip=${model.ipAddress}"><span class="text-error">【切到历史模式】</span></a></span>
<c:forEach var="nav" items="${model.navs}">
&nbsp;[ <a href="${model.baseUri}?date=${model.date}&ip=${model.ipAddress}&step=${nav.hours}&${navUrlPrefix}">${nav.title}</a> ]
</c:forEach>
......
......@@ -26,3 +26,9 @@ function selectByName(date, domain, ip, type) {
+ date + "&queryname=" + queryname + "&ip=" + ip;
}
function selectGroupByName(date, domain, ip, type) {
var queryname = $("#queryname").val();
window.location.href = "?op=groupReport&domain=" + domain + "&type=" + type + "&date="
+ date + "&queryname=" + queryname + "&ip=" + ip;
}
......@@ -5,12 +5,12 @@
<ul>
</c:if>
<c:if test="${item > model.maxMinute }"><li class="disabled" id="minute${item}"><a
class="href${item}" href="?op=${payload.action.name}&domain=${model.domain}&date=${model.date}&minute=${item}&productLine=${payload.productLine}">
class="href${item}" href="?op=${payload.action.name}&domain=${model.domain}&date=${model.date}&minute=${item}&productLine=${payload.productLine}&fullScreen=${payload.fullScreen}&refresh=${payload.refresh}&frequency=${payload.frequency}">
<c:if test="${item < 10}">0${item}</c:if>
<c:if test="${item >= 10}">${item}</c:if></a></li>
</c:if>
<c:if test="${item <= model.maxMinute }"><li id="minute${item}"><a
class="href${item}" href="?op=${payload.action.name}&domain=${model.domain}&date=${model.date}&minute=${item}&productLine=${payload.productLine}">
class="href${item}" href="?op=${payload.action.name}&domain=${model.domain}&date=${model.date}&minute=${item}&productLine=${payload.productLine}&fullScreen=${payload.fullScreen}&refresh=${payload.refresh}&frequency=${payload.frequency}">
<c:if test="${item < 10}">0${item}</c:if>
<c:if test="${item >= 10}">${item}</c:if></a></li>
</c:if>
......
......@@ -5,12 +5,12 @@
<ul>
</c:if>
<c:if test="${item > model.maxMinute }"><li class="disabled" id="minute${item}"><a
class="href${item}" href="?op=${payload.action.name}&domain=${model.domain}&date=${model.date}&minute=${item}&productLine=${payload.productLine}&tab=tab2">
class="href${item}" href="?op=${payload.action.name}&domain=${model.domain}&date=${model.date}&minute=${item}&productLine=${payload.productLine}&tab=tab2&fullScreen=${payload.fullScreen}&refresh=${payload.refresh}&frequency=${payload.frequency}">
<c:if test="${item < 10}">0${item}</c:if>
<c:if test="${item >= 10}">${item}</c:if></a></li>
</c:if>
<c:if test="${item <= model.maxMinute }"><li id="minute${item}"><a
class="href${item}" href="?op=${payload.action.name}&domain=${model.domain}&date=${model.date}&minute=${item}&productLine=${payload.productLine}&tab=tab2">
class="href${item}" href="?op=${payload.action.name}&domain=${model.domain}&date=${model.date}&minute=${item}&productLine=${payload.productLine}&tab=tab2&fullScreen=${payload.fullScreen}&refresh=${payload.refresh}&frequency=${payload.frequency}">
<c:if test="${item < 10}">0${item}</c:if>
<c:if test="${item >= 10}">${item}</c:if></a></li>
</c:if>
......
......@@ -5,12 +5,12 @@
<ul>
</c:if>
<c:if test="${item > model.maxMinute }"><li class="disabled" id="minute${item}"><a
class="href${item}" href="?op=${payload.action.name}&domain=${model.domain}&date=${model.date}&minute=${item}&productLine=${payload.productLine}&tab=tab3">
class="href${item}" href="?op=${payload.action.name}&domain=${model.domain}&date=${model.date}&minute=${item}&productLine=${payload.productLine}&tab=tab3&fullScreen=${payload.fullScreen}&refresh=${payload.refresh}&frequency=${payload.frequency}">
<c:if test="${item < 10}">0${item}</c:if>
<c:if test="${item >= 10}">${item}</c:if></a></li>
</c:if>
<c:if test="${item <= model.maxMinute }"><li id="minute${item}"><a
class="href${item}" href="?op=${payload.action.name}&domain=${model.domain}&date=${model.date}&minute=${item}&productLine=${payload.productLine}&tab=tab3">
class="href${item}" href="?op=${payload.action.name}&domain=${model.domain}&date=${model.date}&minute=${item}&productLine=${payload.productLine}&tab=tab3&fullScreen=${payload.fullScreen}&refresh=${payload.refresh}&frequency=${payload.frequency}">
<c:if test="${item < 10}">0${item}</c:if>
<c:if test="${item >= 10}">${item}</c:if></a></li>
</c:if>
......
......@@ -29,6 +29,7 @@
</style>
<c:choose>
<c:when test="${payload.fullScreen}">
<res:useJs value="${res.js.local['highcharts.js']}" target="head-js" />
<div class="report">
<div class="row-fluid">
<div class="span12 text-center">
......
......@@ -44,6 +44,17 @@
</th>
</tr>
</table>
<table class="groups">
<tr class="left">
<th>机器分组: &nbsp;&nbsp;
<c:forEach var="group" items="${model.groups}">
&nbsp;[&nbsp;
<a href="?op=groupReport&domain=${model.domain}&date=${model.date}&group=${group}">${group}</a>
&nbsp;]&nbsp;
</c:forEach>
</th>
</tr>
</table>
<table class='data'>
<c:choose>
<c:when test="${empty payload.type}">
......@@ -76,7 +87,7 @@
</c:when>
<c:otherwise>
<tr>
<th class="left"><a href="?op=graphs&domain=${model.domain}&date=${model.date}&type=${payload.type}&ip=${model.ipAddress}" class="graph_link" data-status="-1">[:: show ::]</a>
<th class="left"><a href="?op=groupGraphs&domain=${model.domain}&date=${model.date}&type=${payload.type}&ip=${model.ipAddress}" class="graph_link" data-status="-1">[:: show ::]</a>
<a href="?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&type=${payload.type}&sort=type"> Name</a></th>
<th><a href="?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&type=${payload.type}&sort=total">Total Count</a></th>
<th><a href="?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&type=${payload.type}&sort=failure">Failure Count</a></th>
......@@ -93,7 +104,7 @@
<td class="left">
<c:choose>
<c:when test="${status.index > 0}">
<a href="?op=graphs&domain=${report.domain}&ip=${model.ipAddress}&date=${model.date}&type=${payload.type}&name=${e.id}" class="graph_link" data-status="${status.index}">[:: show ::]</a>
<a href="?op=groupGraphs&domain=${report.domain}&ip=${model.ipAddress}&date=${model.date}&type=${payload.type}&name=${e.id}" class="graph_link" data-status="${status.index}">[:: show ::]</a>
</c:when>
</c:choose>
&nbsp;&nbsp;${e.id}
......
<%@ page session="false" language="java" pageEncoding="UTF-8"%>
<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="a" uri="/WEB-INF/app.tld"%>
<%@ taglib prefix="w" uri="http://www.unidal.org/web/core"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="res" uri="http://www.unidal.org/webres"%>
<jsp:useBean id="ctx" type="com.dianping.cat.report.page.event.Context" scope="request" />
<jsp:useBean id="payload" type="com.dianping.cat.report.page.event.Payload" scope="request" />
<jsp:useBean id="model" type="com.dianping.cat.report.page.event.Model" scope="request" />
<c:set var="report" value="${model.report}" />
<a:report
title="Event Report${empty payload.type ? '' : ' :: '}<a href='?op=groupReport&domain=${model.domain}&date=${model.date}&group=${payload.group}&type=${payload.type}'>${payload.type}</a>"
navUrlPrefix="op=groupReport&op=groupReport&domain=${model.domain}${empty payload.type ? '' : '&type='}${payload.type}"
timestamp="${w:format(model.creatTime,'yyyy-MM-dd HH:mm:ss')}">
<jsp:attribute name="subtitle">From ${w:format(report.startTime,'yyyy-MM-dd HH:mm:ss')} to ${w:format(report.endTime,'yyyy-MM-dd HH:mm:ss')}</jsp:attribute>
<jsp:body>
<res:useJs value="${res.js.local['highcharts.js']}" target="head-js"/>
<res:useJs value="${res.js.local['baseGraph.js']}" target="head-js"/>
<table class="machines">
<tr class="left">
<th>机器: &nbsp;[&nbsp;
<a href="?domain=${model.domain}&date=${model.date}&group=${payload.group}&type=${payload.type}" >All</a>
&nbsp;]&nbsp;
<c:forEach var="ip" items="${model.ips}">
&nbsp;[&nbsp;
<a href="?domain=${model.domain}&ip=${ip}&date=${model.date}&group=${payload.group}&type=${payload.type}">${ip}</a>
&nbsp;]&nbsp;
</c:forEach>
</th>
</tr>
</table>
<table class="groups">
<tr class="left">
<th>机器分组: &nbsp;&nbsp;
<c:forEach var="group" items="${model.groups}">
<c:choose><c:when test="${payload.group eq group}">
&nbsp;[&nbsp;
<a class="current" href="?op=groupReport&domain=${model.domain}&group=${group}&date=${model.date}&group=${payload.group}">${group}</a>
&nbsp;]&nbsp;
</c:when>
<c:otherwise>
&nbsp;[&nbsp;
<a href="?op=groupReport&domain=${model.domain}&group=${group}&date=${model.date}&group=${payload.group}">${group}</a>
&nbsp;]&nbsp;
</c:otherwise></c:choose>
</c:forEach>
</th>
</tr>
</table>
<table class='data'>
<c:choose>
<c:when test="${empty payload.type}">
<tr>
<th class="left"><a href="?domain=${model.domain}&date=${model.date}&group=${payload.group}&op=groupReport&sort=type">Type</a></th>
<th><a href="?domain=${model.domain}&date=${model.date}&group=${payload.group}&op=groupReport&sort=total">Total Count</a></th>
<th><a href="?domain=${model.domain}&date=${model.date}&group=${payload.group}&op=groupReport&sort=failure">Failure Count</a></th>
<th><a href="?domain=${model.domain}&date=${model.date}&group=${payload.group}&op=groupReport&sort=failurePercent">Failure%</a></th>
<th>Sample Link</th>
<th>QPS</th>
</tr>
<c:forEach var="item" items="${model.displayTypeReport.results}" varStatus="status">
<c:set var="e" value="${item.detail}" />
<c:set var="lastIndex" value="${status.index}" />
<tr class="${status.index mod 2 != 0 ? 'odd' : 'even'} right">
<td class="left">
<a href="?domain=${model.domain}&date=${model.date}&group=${payload.group}&op=groupReport&sort=type"><a href="?op=groupGraphs&domain=${model.domain}&date=${model.date}&group=${payload.group}&type=${item.type}" class="graph_link" data-status="${status.index}">[:: show ::]</a>
&nbsp;&nbsp;<a href="?domain=${report.domain}&date=${model.date}&group=${payload.group}&op=groupReport&type=${item.type}">${item.type}</a>
</td>
<td>${w:format(e.totalCount,'#,###,###,###,##0')}</td>
<td>${w:format(e.failCount,'#,###,###,###,##0')}</td>
<td>&nbsp;${w:format(e.failPercent/100,'0.0000%')}</td>
<td class="center"><a href="${model.logViewBaseUri}/${empty e.failMessageUrl ? e.successMessageUrl : e.failMessageUrl}?domain=${model.domain}">Log View</a></td>
<td>${w:format(e.tps,'###,##0.0')}</td>
</tr>
<tr class="graphs">
<td colspan="7"><div id="${status.index}" style="display: none"></div></td>
</tr>
</c:forEach>
</c:when>
<c:otherwise>
<tr>
<th class="left"><a href="?op=groupGraphs&domain=${model.domain}&date=${model.date}&group=${payload.group}&type=${payload.type}&op=groupReport" class="graph_link" data-status="-1">[:: show ::]</a>
<a href="?domain=${model.domain}&date=${model.date}&group=${payload.group}&op=groupReport&type=${payload.type}&sort=type"> Name</a></th>
<th><a href="?domain=${model.domain}&date=${model.date}&group=${payload.group}&op=groupReport&type=${payload.type}&sort=total">Total Count</a></th>
<th><a href="?domain=${model.domain}&date=${model.date}&group=${payload.group}&op=groupReport&type=${payload.type}&sort=failure">Failure Count</a></th>
<th><a href="?domain=${model.domain}&date=${model.date}&group=${payload.group}&op=groupReport&type=${payload.type}&sort=failurePercent">Failure%</a></th>
<th>Sample Link</th>
<th><a href="?domain=${model.domain}&date=${model.date}&group=${payload.group}&op=groupReport&type=${payload.type}&sort=total">QPS</a></th>
<th><a href="?domain=${model.domain}&date=${model.date}&group=${payload.group}&op=groupReport&type=${payload.type}&sort=total">Percent%</a></th>
</tr>
<tr class="graphs"><td colspan="7"><div id="-1" style="display: none"></div></td></tr>
<c:forEach var="item" items="${model.displayNameReport.results}" varStatus="status">
<c:set var="e" value="${item.detail}" />
<c:set var="lastIndex" value="${status.index}" />
<tr class="${status.index mod 2 != 0 ? 'odd' : 'even'} right">
<td class="left">
<c:choose>
<c:when test="${status.index > 0}">
<a href="?op=groupGraphs&domain=${report.domain}&op=groupReport&date=${model.date}&group=${payload.group}&type=${payload.type}&name=${e.id}" class="graph_link" data-status="${status.index}">[:: show ::]</a>
</c:when>
</c:choose>
&nbsp;&nbsp;${e.id}
</td>
<td>${w:format(e.totalCount,'#,###,###,###,##0')}</td>
<td>${w:format(e.failCount,'#,###,###,###,##0')}</td>
<td>&nbsp;${w:format(e.failPercent/100,'0.0000%')}</td>
<td class="center"><a href="${model.logViewBaseUri}/${empty e.failMessageUrl ? e.successMessageUrl : e.failMessageUrl}?domain=${model.domain}">Log View</a></td>
<td>${w:format(e.tps,'0.0')}</td>
<td>${w:format(e.totalPercent,'0.0000%')}</td>
</tr>
<tr class="graphs">
<td colspan="5"><div id="${status.index}" style="display: none"></div></td>
</tr>
</c:forEach>
</c:otherwise>
</c:choose>
</table>
<font color="white">${lastIndex+1}</font>
<res:useJs value="${res.js.local.event_js}" target="bottom-js" />
<c:choose>
<c:when test="${not empty payload.type}">
<table>
<tr>
<td><div id="eventGraph" class="pieChart"></div>
</td>
</tr>
</table>
<script type="text/javascript">
var data = ${model.pieChart};
graphPieChart(document.getElementById('eventGraph'), data );
</script>
</c:when>
</c:choose>
</jsp:body>
</a:report>
<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="a" uri="/WEB-INF/app.tld"%>
<%@ taglib prefix="w" uri="http://www.unidal.org/web/core"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="res" uri="http://www.unidal.org/webres"%>
<jsp:useBean id="ctx" type="com.dianping.cat.report.page.event.Context" scope="request" />
<jsp:useBean id="payload" type="com.dianping.cat.report.page.event.Payload" scope="request" />
<jsp:useBean id="model" type="com.dianping.cat.report.page.event.Model" scope="request" />
<a:historyReport title="History Report" navUrlPrefix="type=${payload.type}&group=${payload.group}">
<jsp:attribute name="subtitle">From ${w:format(payload.historyStartDate,'yyyy-MM-dd HH:mm:ss')} to ${w:format(payload.historyDisplayEndDate,'yyyy-MM-dd HH:mm:ss')}</jsp:attribute>
<jsp:body>
<res:useJs value="${res.js.local['highcharts.js']}" target="head-js"/>
<res:useJs value="${res.js.local['baseGraph.js']}" target="head-js"/>
<table class="machines">
<tr style="text-align: left">
<th>机器: <c:forEach var="ip" items="${model.ips}">&nbsp;[&nbsp;
<a href="?op=history&domain=${model.domain}&ip=${ip}&date=${model.date}&reportType=${model.reportType}${model.customDate}"
>${ip}</a>
&nbsp;]&nbsp;
</c:forEach>
</th>
</tr>
</table>
<table class="groups">
<tr class="left">
<th>机器分组: &nbsp;&nbsp;
<c:forEach var="group" items="${model.groups}">
<c:choose><c:when test="${payload.group eq group}">
&nbsp;[&nbsp;
<a class="current" href="?op=historyGroupReport&domain=${model.domain}&group=${group}&date=${model.date}">${group}</a>
&nbsp;]&nbsp;
</c:when>
<c:otherwise>
&nbsp;[&nbsp;
<a href="?op=historyGroupReport&domain=${model.domain}&group=${group}&date=${model.date}">${group}</a>
&nbsp;]&nbsp;
</c:otherwise></c:choose>
</c:forEach>
</th>
</tr>
</table>
<table class='data'>
<c:choose>
<c:when test="${empty payload.type}">
<tr>
<th style="text-align: left;"><a href="?op=historyGroupReport&domain=${model.domain}&date=${model.date}&group=${payload.group}&reportType=${model.reportType}&sort=type${model.customDate}"> Type</a></th>
<th class="right"><a href="?op=historyGroupReport&domain=${model.domain}&date=${model.date}&group=${payload.group}&reportType=${model.reportType}&sort=total${model.customDate}">Total Count</a></th>
<th class="right"><a href="?op=historyGroupReport&domain=${model.domain}&date=${model.date}&group=${payload.group}&reportType=${model.reportType}&sort=failure${model.customDate}">Failure Count</a></th>
<th class="right"><a href="?op=historyGroupReport&domain=${model.domain}&date=${model.date}&group=${payload.group}&reportType=${model.reportType}&sort=failurePercent${model.customDate}">Failure%</a></th>
<th class="right">Sample Link</th><th class="right"><a href="?op=historyGroupReport&domain=${model.domain}&date=${model.date}&group=${payload.group}&reportType=${model.reportType}&sort=total${model.customDate}">QPS</a></th>
</tr>
<c:forEach var="item" items="${model.displayTypeReport.results}"
varStatus="status">
<c:set var="e" value="${item.detail}" />
<c:set var="lastIndex" value="${status.index}" />
<tr class="${status.index mod 2 != 0 ? 'odd' : 'even'} right">
<td style="text-align: left">
<a href="?op=historyGroupGraph&domain=${model.domain}&date=${model.date}&group=${payload.group}&reportType=${model.reportType}&type=${item.type}${model.customDate}" class="history_graph_link" data-status="${status.index}">[:: show ::]</a>
&nbsp;&nbsp;&nbsp;<a href="?op=historyGroupReport&domain=${model.domain}&date=${model.date}&group=${payload.group}&reportType=${model.reportType}&type=${item.type}${model.customDate}">${item.type}</a></td>
<td>${w:format(e.totalCount,'#,###,###,###,##0')}</td>
<td>${e.failCount}</td>
<td>${w:format(e.failPercent/100,'0.0000%')}</td>
<td><a href="${model.logViewBaseUri}/${empty e.failMessageUrl ? e.successMessageUrl : e.failMessageUrl}?domain=${model.domain}">Log View</a></td>
<td>${w:format(e.tps,'0.0')}</td>
</tr>
<tr class="graphs"><td colspan="5"><div id="${status.index}" style="display:none"></div></td></tr>
</c:forEach>
</c:when>
<c:otherwise>
<tr>
<th style="text-align: left;"><a href="?op=historyGroupGraph&domain=${model.domain}&date=${model.date}&group=${payload.group}&reportType=${model.reportType}&type=${payload.type}&sort=type${model.customDate}"> Name</a></th>
<th class="right"><a href="?op=historyGroupReport&domain=${model.domain}&date=${model.date}&group=${payload.group}&reportType=${model.reportType}&type=${payload.type}&sort=total${model.customDate}">Total Count</a></th>
<th class="right"><a href="?op=historyGroupReport&domain=${model.domain}&date=${model.date}&group=${payload.group}&reportType=${model.reportType}&type=${payload.type}&sort=failure${model.customDate}">Failure Count</a></th>
<th class="right"><a href="?op=historyGroupReport&domain=${model.domain}&date=${model.date}&group=${payload.group}&reportType=${model.reportType}&type=${payload.type}&sort=failurePercent${model.customDate}">Failure%</a></th>
<th class="right">Sample Link</th><th class="right"><a href="?op=historyGroupReport&domain=${model.domain}&date=${model.date}&group=${payload.group}&reportType=${model.reportType}&type=${payload.type}&sort=type${model.customDate}">QPS</a></th>
<th class="right"><a href="?op=historyGroupReport&domain=${model.domain}&date=${model.date}&group=${payload.group}&reportType=${model.reportType}&type=${payload.type}&sort=type${model.customDate}">Percent%</a></th>
</tr>
<c:forEach var="item" items="${model.displayNameReport.results}"
varStatus="status">
<c:set var="e" value="${item.detail}" />
<c:set var="lastIndex" value="${status.index}" />
<tr class="${status.index mod 2 != 0 ? 'odd' : 'even'} right">
<td style="text-align: left">
<a href="?op=historyGroupGraph&domain=${model.domain}&date=${model.date}&group=${payload.group}&reportType=${model.reportType}&type=${payload.type}&name=${e.id}${model.customDate}" class="history_graph_link" data-status="${status.index}">[:: show ::]</a>
&nbsp;&nbsp;&nbsp;${e.id}</td>
<td>${w:format(e.totalCount,'#,###,###,###,##0')}</td>
<td>${e.failCount}</td>
<td>${w:format(e.failPercent/100,'0.0000%')}</td>
<td><a href="${model.logViewBaseUri}/${empty e.failMessageUrl ? e.successMessageUrl : e.failMessageUrl}?domain=${model.domain}">Log View</a></td>
<td>${w:format(e.tps,'0.0')}</td>
<td>${w:format(e.totalPercent,'0.0000%')}</td>
</tr>
<tr class="graphs"><td colspan="5"><div id="${status.index}" style="display:none"></div></td></tr>
</c:forEach>
</c:otherwise>
</c:choose>
</table>
<font color="white">${lastIndex+1}</font>
</br>
<res:useJs value="${res.js.local.event_js}" target="bottom-js" />
<c:choose>
<c:when test="${not empty payload.type}">
<table>
<tr>
<td><div id="eventGraph" class="pieChart" ></div>
</td>
</tr>
</table>
<script type="text/javascript">
var data = ${model.pieChart};
graphPieChart(document.getElementById('eventGraph'), data );
</script>
</c:when>
</c:choose>
</jsp:body>
</a:historyReport>
\ No newline at end of file
......@@ -29,6 +29,19 @@
</th>
</tr>
</table>
<table class="groups">
<tr class="left">
<th>机器分组: &nbsp;&nbsp;
<c:forEach var="group" items="${model.groups}">
&nbsp;[&nbsp;
<a href="?op=historyGroupReport&domain=${model.domain}&date=${model.date}&group=${group}">${group}</a>
&nbsp;]&nbsp;
</c:forEach>
</th>
</tr>
</table>
<table class='data'>
<c:choose>
<c:when test="${empty payload.type}">
......
......@@ -143,5 +143,11 @@
</c:forEach>
</table>
<script type="text/javascript">
$(document).ready(function() {
$($('.text-error')[3]).hide();
});
</script>
</jsp:body>
</a:report>
\ No newline at end of file
</a:report>
......@@ -30,6 +30,7 @@
<div>
<a class="btn btn-small btn-primary" href="http://cat.qa.dianpingoa.com/cat/r">测试环境</a>
<a class="btn btn-small btn-primary" href="http://10.1.8.64:8080/cat/r">预发环境</a>
<a class="btn btn-small btn-primary" href="http://cat-ppe01.hm/cat/r">PPE环境</a>
<a class="btn btn-small btn-primary" href="http://cat.dianpingoa.com/cat/r">生产环境</a>
<a class="btn btn-small btn-primary" href="http://10.1.8.152:8080/cat/r">BA后台环境</a>
</div>
......@@ -43,6 +43,18 @@
</tr>
</table>
<table class="groups">
<tr class="left">
<th>机器分组: &nbsp;&nbsp;
<c:forEach var="group" items="${model.groups}">
&nbsp;[&nbsp;
<a href="?op=groupReport&domain=${model.domain}&date=${model.date}&group=${group}">${group}</a>
&nbsp;]&nbsp;
</c:forEach>
</th>
</tr>
</table>
<table class='data'>
<c:choose>
<c:when test="${empty payload.type}">
......@@ -53,9 +65,9 @@
<th>Sample Link</th>
<th>Min(ms)</th>
<th>Max(ms)</th>
<th><a href="?domain=${model.domain}&date=${model.date}&sort=avg">Avg</a>(ms)</th>
<th><a href="?domain=${model.domain}&date=${model.date}&sort=95line">95Line</a>(ms)</th>
<th><a href="?domain=${model.domain}&date=${model.date}&sort=99line">99.9Line</a>(ms)</th>
<th><a href="?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&sort=avg">Avg</a>(ms)</th>
<th><a href="?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&sort=95line">95Line</a>(ms)</th>
<th><a href="?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&sort=99line">99.9Line</a>(ms)</th>
<th>Std(ms)</th>
<th>QPS</th>
</tr>
......@@ -92,9 +104,9 @@
<th><a href="?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&type=${payload.type}&sort=failure&queryname=${model.queryName}">Failure Count</a></th>
<th><a href="?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&type=${payload.type}&sort=failurePercent&queryname=${model.queryName}">Failure%</a></th>
<th>Sample Link</th><th>Min(ms)</th><th>Max(ms)</th>
<th><a href="?domain=${model.domain}&date=${model.date}&type=${payload.type}&sort=avg&queryname=${model.queryName}">Avg</a>(ms)</th>
<th><a href="?domain=${model.domain}&date=${model.date}&type=${payload.type}&sort=95line&queryname=${model.queryName}">95Line</a>(ms)</th>
<th><a href="?domain=${model.domain}&date=${model.date}&type=${payload.type}&sort=99line&queryname=${model.queryName}">99.9Line</a>(ms)</th>
<th><a href="?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&type=${payload.type}&sort=avg&queryname=${model.queryName}">Avg</a>(ms)</th>
<th><a href="?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&type=${payload.type}&sort=95line&queryname=${model.queryName}">95Line</a>(ms)</th>
<th><a href="?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&type=${payload.type}&sort=99line&queryname=${model.queryName}">99.9Line</a>(ms)</th>
<th>Std(ms)</th>
<th><a href="?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&type=${payload.type}&sort=total&queryname=${model.queryName}">QPS</a></th>
<th><a href="?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&type=${payload.type}&sort=total&queryname=${model.queryName}">Percent%</a></th></tr>
......
<%@ page session="false" language="java" pageEncoding="UTF-8" %>
<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="a" uri="/WEB-INF/app.tld"%>
<%@ taglib prefix="w" uri="http://www.unidal.org/web/core"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="res" uri="http://www.unidal.org/webres"%>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<jsp:useBean id="ctx" type="com.dianping.cat.report.page.transaction.Context" scope="request" />
<jsp:useBean id="payload" type="com.dianping.cat.report.page.transaction.Payload" scope="request" />
<jsp:useBean id="model" type="com.dianping.cat.report.page.transaction.Model" scope="request" />
<c:set var="report" value="${model.report}"/>
<a:report title="Transaction Report${empty payload.type ? '' : ' :: '}<a href='?op=groupReport&group=${payload.group}&domain=${model.domain}&date=${model.date}&type=${payload.type}'>${payload.type}</a>"
navUrlPrefix="op=groupReport&group=${payload.group}&queryname=${model.queryName}&domain=${model.domain}${empty payload.type ? '' : '&type='}${payload.type}" timestamp="${w:format(model.creatTime,'yyyy-MM-dd HH:mm:ss')}">
<jsp:attribute name="subtitle">From ${w:format(report.startTime,'yyyy-MM-dd HH:mm:ss')} to ${w:format(report.endTime,'yyyy-MM-dd HH:mm:ss')}</jsp:attribute>
<jsp:body>
<res:useJs value="${res.js.local['highcharts.js']}" target="head-js"/>
<res:useJs value="${res.js.local['baseGraph.js']}" target="head-js"/>
<table class="machines">
<tr class="left">
<th>机器: &nbsp;[&nbsp; <c:choose>
<c:when test="${model.ipAddress eq 'All'}">
<a href="?op=view&domain=${model.domain}&date=${model.date}&type=${payload.type}&queryname=${model.queryName}"
>All</a>
</c:when>
<c:otherwise>
<a href="?op=view&domain=${model.domain}&date=${model.date}&type=${payload.type}&queryname=${model.queryName}">All</a>
</c:otherwise>
</c:choose> &nbsp;]&nbsp; <c:forEach var="ip" items="${model.ips}">
&nbsp;[&nbsp;
<c:choose>
<c:when test="${model.ipAddress eq ip}">
<a href="?op=view&domain=${model.domain}&ip=${ip}&date=${model.date}&type=${payload.type}&queryname=${model.queryName}"
>${ip}</a>
</c:when>
<c:otherwise>
<a href="?op=view&domain=${model.domain}&ip=${ip}&date=${model.date}&type=${payload.type}&queryname=${model.queryName}">${ip}</a>
</c:otherwise>
</c:choose>
&nbsp;]&nbsp;
</c:forEach>
</th>
</tr>
</table>
<table class="groups">
<tr class="left">
<th>机器分组: &nbsp;&nbsp;
<c:forEach var="group" items="${model.groups}">
<c:choose><c:when test="${payload.group eq group}">
&nbsp;[&nbsp;
<a class="current" href="?op=groupReport&domain=${model.domain}&group=${group}&date=${model.date}">${group}</a>
&nbsp;]&nbsp;
</c:when>
<c:otherwise>
&nbsp;[&nbsp;
<a href="?op=groupReport&domain=${model.domain}&group=${group}&date=${model.date}">${group}</a>
&nbsp;]&nbsp;
</c:otherwise></c:choose>
</c:forEach>
</th>
</tr>
</table>
<table class='data'>
<c:choose>
<c:when test="${empty payload.type}">
<tr><th class="left"><a href="?op=groupReport&domain=${model.domain}&date=${model.date}&group=${payload.group}&sort=type">Type</a></th>
<th><a href="?op=groupReport&domain=${model.domain}&date=${model.date}&group=${payload.group}&sort=total">Total Count</a></th>
<th><a href="?op=groupReport&domain=${model.domain}&date=${model.date}&group=${payload.group}&sort=failure">Failure Count</a></th>
<th><a href="?op=groupReport&domain=${model.domain}&date=${model.date}&group=${payload.group}&sort=failurePercent">Failure%</a></th>
<th>Sample Link</th>
<th>Min(ms)</th>
<th>Max(ms)</th>
<th><a href="?op=groupReport&domain=${model.domain}&date=${model.date}&group=${payload.group}&sort=avg">Avg</a>(ms)</th>
<th><a href="?op=groupReport&domain=${model.domain}&date=${model.date}&group=${payload.group}&sort=95line">95Line</a>(ms)</th>
<th><a href="?op=groupReport&domain=${model.domain}&date=${model.date}&group=${payload.group}&sort=99line">99.9Line</a>(ms)</th>
<th>Std(ms)</th>
<th>QPS</th>
</tr>
<c:forEach var="item" items="${model.displayTypeReport.results}" varStatus="status">
<c:set var="e" value="${item.detail}"/>
<c:set var="lastIndex" value="${status.index}"/>
<tr class="${status.index mod 2 != 0 ? 'odd' : 'even'} right">
<td class="left"><a href="?op=groupGraphs&domain=${report.domain}&date=${model.date}&group=${payload.group}&type=${item.type}" class="graph_link" data-status="${status.index}">[:: show ::]</a>
&nbsp;&nbsp;<a href="?op=groupReport&domain=${report.domain}&date=${model.date}&group=${payload.group}&type=${item.type}">${item.type}</a></td>
<td>${w:format(e.totalCount,'#,###,###,###,##0')}</td>
<td>${w:format(e.failCount,'#,###,###,###,##0')}</td>
<td>&nbsp;${w:format(e.failPercent/100,'0.0000%')}</td>
<td class="center"><a href="${model.logViewBaseUri}/${empty e.failMessageUrl ? e.successMessageUrl : e.failMessageUrl}?domain=${model.domain}">Log View</a></td>
<td>${w:format(e.min,'###,##0.#')}</td>
<td>${w:format(e.max,'###,##0.#')}</td>
<td>${w:format(e.avg,'###,##0.0')}</td>
<td>${w:format(e.line95Value,'###,##0.0')}</td>
<td>${w:format(e.line99Value,'###,##0.0')}</td>
<td>${w:format(e.std,'###,##0.0')}</td>
<td>${w:format(e.tps,'###,##0.0')}</td>
</tr>
<tr class="graphs"><td colspan="11"><div id="${status.index}" style="display:none"></div></td></tr>
</c:forEach>
</c:when>
<c:otherwise>
<tr><th class="left" colspan="13"><input type="text" name="queryname" id="queryname" size="40" value="${model.queryName}">
<input class="btn btn-primary btn-small" value="Filter" onclick="selectGroupByName('${model.date}','${model.domain}','${model.ipAddress}','${payload.type}')" type="submit">
支持多个字符串查询,例如sql|url|task,查询结果为包含任一sql、url、task的列。
</th></tr>
<tr>
<th style="text-align: left;"><a href="?op=groupGraphs&domain=${report.domain}&date=${model.date}&group=${payload.group}&type=${payload.type}" class="graph_link" data-status="-1">[:: show ::]</a>
<a href="?op=groupReport&domain=${model.domain}&date=${model.date}&group=${payload.group}&type=${payload.type}&sort=type&queryname=${model.queryName}">Name</a></th>
<th><a href="?op=groupReport&domain=${model.domain}&date=${model.date}&group=${payload.group}&type=${payload.type}&sort=total&queryname=${model.queryName}">Total Count</a></th>
<th><a href="?op=groupReport&domain=${model.domain}&date=${model.date}&group=${payload.group}&type=${payload.type}&sort=failure&queryname=${model.queryName}">Failure Count</a></th>
<th><a href="?op=groupReport&domain=${model.domain}&date=${model.date}&group=${payload.group}&type=${payload.type}&sort=failurePercent&queryname=${model.queryName}">Failure%</a></th>
<th>Sample Link</th><th>Min(ms)</th><th>Max(ms)</th>
<th><a href="?op=groupReport&domain=${model.domain}&date=${model.date}&group=${payload.group}&type=${payload.type}&sort=avg&queryname=${model.queryName}">Avg</a>(ms)</th>
<th><a href="?op=groupReport&domain=${model.domain}&date=${model.date}&group=${payload.group}&type=${payload.type}&sort=95line&queryname=${model.queryName}">95Line</a>(ms)</th>
<th><a href="?op=groupReport&domain=${model.domain}&date=${model.date}&group=${payload.group}&type=${payload.type}&sort=99line&queryname=${model.queryName}">99.9Line</a>(ms)</th>
<th>Std(ms)</th>
<th><a href="?op=groupReport&domain=${model.domain}&date=${model.date}&group=${payload.group}&type=${payload.type}&sort=total&queryname=${model.queryName}">QPS</a></th>
<th><a href="?op=groupReport&domain=${model.domain}&date=${model.date}&group=${payload.group}&type=${payload.type}&sort=total&queryname=${model.queryName}">Percent%</a></th></tr>
<tr class="graphs"><td colspan="12"><div id="-1" style="display:none"></div></td></tr>
<c:forEach var="item" items="${model.displayNameReport.results}" varStatus="status">
<c:set var="e" value="${item.detail}"/>
<c:set var="lastIndex" value="${status.index}"/>
<tr class="${status.index mod 2 != 0 ? 'odd' : 'even'} right">
<c:choose>
<c:when test="${status.index > 0}">
<td class="left longText" style="white-space:normal">
<a href="?op=groupGraphs&domain=${report.domain}&date=${model.date}&group=${payload.group}&type=${payload.type}&name=${e.id}" class="graph_link" data-status="${status.index}">[:: show ::]</a>
&nbsp;&nbsp;${w:shorten(e.id, 120)}</td>
</c:when>
<c:otherwise>
<td class="center" style="white-space:normal">${w:shorten(e.id, 120)}</td>
</c:otherwise>
</c:choose>
<td>${w:format(e.totalCount,'#,###,###,###,##0')}</td>
<td>${w:format(e.failCount,'#,###,###,###,##0')}</td>
<td>&nbsp;${w:format(e.failPercent/100,'0.0000%')}</td>
<td class="center"><a href="${model.logViewBaseUri}/${empty e.failMessageUrl ? e.successMessageUrl : e.failMessageUrl}?domain=${model.domain}">Log View</a></td>
<td>${w:format(e.min,'###,##0.#')}</td>
<td>${w:format(e.max,'###,##0.#')}</td>
<td>${w:format(e.avg,'###,##0.0')}</td>
<c:choose>
<c:when test="${status.index > 0}">
<td>${w:format(e.line95Value,'###,##0.0')}</td>
<td>${w:format(e.line99Value,'###,##0.0')}</td>
</c:when>
<c:otherwise>
<td class="center">-</td>
<td class="center">-</td>
</c:otherwise>
</c:choose>
<td>${w:format(e.std,'###,##0.0')}</td>
<td>${w:format(e.tps,'###,##0.0')}</td>
<td>${w:format(e.totalPercent,'0.00%')}</td>
</tr>
<tr class="graphs"><td colspan="11"><div id="${status.index}" style="display:none"></div></td></tr>
</c:forEach>
</c:otherwise>
</c:choose>
</table>
<font color="white">${lastIndex}</font>
<res:useJs value="${res.js.local.transaction_js}" target="bottom-js" />
<c:choose>
<c:when test="${not empty payload.type}">
<table>
<tr>
<td><div id="transactionGraph" class="pieChart"></div>
</td>
</tr>
</table>
<script type="text/javascript">
var data = ${model.pieChart};
graphPieChart(document.getElementById('transactionGraph'), data);
</script>
</c:when>
</c:choose>
</jsp:body>
</a:report>
<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="a" uri="/WEB-INF/app.tld"%>
<%@ taglib prefix="w" uri="http://www.unidal.org/web/core"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="res" uri="http://www.unidal.org/webres"%>
<jsp:useBean id="ctx" type="com.dianping.cat.report.page.transaction.Context" scope="request" />
<jsp:useBean id="payload" type="com.dianping.cat.report.page.transaction.Payload" scope="request" />
<jsp:useBean id="model" type="com.dianping.cat.report.page.transaction.Model" scope="request" />
<a:historyReport title="History Report" navUrlPrefix="type=${payload.type}&queryname=${model.queryName}">
<jsp:attribute name="subtitle">From ${w:format(payload.historyStartDate,'yyyy-MM-dd HH:mm:ss')} to ${w:format(payload.historyDisplayEndDate,'yyyy-MM-dd HH:mm:ss')}</jsp:attribute>
<jsp:body>
<res:useJs value="${res.js.local['highcharts.js']}" target="head-js"/>
<res:useJs value="${res.js.local['baseGraph.js']}" target="head-js"/>
<table class="machines">
<tr style="text-align: left">
<th>机器:
<c:forEach var="ip" items="${model.ips}">&nbsp;[&nbsp;
<c:choose>
<c:when test="${model.ipAddress eq ip}">
<a href="?op=history&domain=${model.domain}&date=${model.date}&ip=${ip}&type=${payload.type}&queryname=${model.queryName}&reportType=${model.reportType}${model.customDate}"
>${ip}</a>
</c:when>
<c:otherwise>
<a href="?op=history&domain=${model.domain}&date=${model.date}&ip=${ip}&type=${payload.type}&queryname=${model.queryName}&reportType=${model.reportType}${model.customDate}">${ip}</a>
</c:otherwise>
</c:choose>
&nbsp;]&nbsp;
</c:forEach>
</th>
</tr>
</table>
<table class="groups">
<tr class="left">
<th>机器分组: &nbsp;&nbsp;
<c:forEach var="group" items="${model.groups}">
<c:choose><c:when test="${payload.group eq group}">
&nbsp;[&nbsp;
<a class="current" href="?op=historyGroupReport&domain=${model.domain}&group=${group}&date=${model.date}">${group}</a>
&nbsp;]&nbsp;
</c:when>
<c:otherwise>
&nbsp;[&nbsp;
<a href="?op=historyGroupReport&domain=${model.domain}&group=${group}&date=${model.date}">${group}</a>
&nbsp;]&nbsp;
</c:otherwise></c:choose>
</c:forEach>
</th>
</tr>
</table>
<table class='data'>
<c:choose>
<c:when test="${empty payload.type}">
<tr>
<th style="text-align: left;"><a href="?op=historyGroupReport&domain=${model.domain}&date=${model.date}&group=${payload.group}&reportType=${model.reportType}&sort=type${model.customDate}">Type</a></th>
<th class="right"><a href="?op=historyGroupReport&domain=${model.domain}&date=${model.date}&group=${payload.group}&reportType=${model.reportType}&sort=total${model.customDate}">Total Count</a></th>
<th class="right"><a href="?op=historyGroupReport&domain=${model.domain}&date=${model.date}&group=${payload.group}&reportType=${model.reportType}&sort=failure${model.customDate}">Failure Count</a></th>
<th class="right"><a href="?op=historyGroupReport&domain=${model.domain}&date=${model.date}&group=${payload.group}&reportType=${model.reportType}&sort=failurePercent${model.customDate}">Failure%</a></th>
<th class="right">Sample Link</th>
<th class="right">Min(ms)</th>
<th class="right">Max(ms)</th>
<th class="right"><a href="?op=historyGroupReport&domain=${model.domain}&date=${model.date}&group=${payload.group}&reportType=${model.reportType}&sort=avg${model.customDate}">Avg</a>(ms)</th>
<th class="right"><a href="?op=historyGroupReport&domain=${model.domain}&date=${model.date}&group=${payload.group}&reportType=${model.reportType}&sort=95line${model.customDate}">95Line</a>(ms)</th>
<th class="right"><a href="?op=historyGroupReport&domain=${model.domain}&date=${model.date}&group=${payload.group}&reportType=${model.reportType}&sort=99line${model.customDate}">99Line</a>(ms)</th>
<th class="right">Std(ms)</th>
<th class="right">QPS</th>
</tr>
<c:forEach var="item" items="${model.displayTypeReport.results}"
varStatus="status">
<c:set var="e" value="${item.detail}" />
<c:set var="lastIndex" value="${status.index}" />
<tr class="${status.index mod 2 != 0 ? 'odd' : 'even'} right">
<td style="text-align: left">
<a href="?op=historyGroupGraph&domain=${model.domain}&date=${model.date}&group=${payload.group}&reportType=${model.reportType}&type=${item.type}${model.customDate}" class="history_graph_link" data-status="${status.index}">[:: show ::]</a>
&nbsp;&nbsp;&nbsp;<a href="?op=historyGroupReport&domain=${model.domain}&date=${model.date}&group=${payload.group}&reportType=${model.reportType}&type=${item.type}${model.customDate}">${item.type}</a></td>
<td>${w:format(e.totalCount,'#,###,###,###,##0')}</td>
<td>${e.failCount}</td>
<td>${w:format(e.failPercent/100,'0.0000%')}</td>
<td><a href="${model.logViewBaseUri}/${empty e.failMessageUrl ? e.successMessageUrl : e.failMessageUrl}?domain=${model.domain}">Log View</a></td>
<td>${w:format(e.min,'0.#')}</td>
<td>${w:format(e.max,'0.#')}</td>
<td>${w:format(e.avg,'0.0')}</td>
<td>${w:format(e.line95Value,'0.0')}</td>
<td>${w:format(e.line99Value,'0.0')}</td>
<td>${w:format(e.std,'0.0')}</td>
<td>${w:format(e.tps,'0.0')}</td>
</tr>
<tr class="graphs"><td colspan="11"><div id="${status.index}" style="display:none"></div></td></tr>
</c:forEach>
</c:when>
<c:otherwise>
<tr><th style="text-align:left;" colspan='13'>
<input type="text" id="queryname" size="40" value="${model.queryName}">
<input class="btn btn-primary btn-small" value="Filter" onclick="filterByName('${model.date}','${model.domain}','${model.ipAddress}','${payload.type}')" type="submit">
支持多个字符串查询,例如sql|url|task,查询结果为包含任一sql、url、task的列
</th></tr><script>
function filterByName(date,domain,ip,type){
var customDate ='${model.customDate}';
var reportType = '${model.reportType}';
var type = '${payload.type}';
var queryname=$("#queryname").val();
window.location.href="?op=historyGroupReport&domain="+domain+"&ip="+ip+"&date="+date+'&type='+type+'&reportType='+reportType+"&queryname="+queryname+customDate;
}
</script>
<tr>
<th style="text-align: left;">
<a href="?op=historyGroupReport&domain=${model.domain}&date=${model.date}&group=${payload.group}&reportType=${model.reportType}&type=${payload.type}&sort=type${model.customDate}&queryname=${model.queryName}">Name</a>
</th>
<th class="right"><a href="?op=historyGroupReport&domain=${model.domain}&date=${model.date}&group=${payload.group}&reportType=${model.reportType}&type=${payload.type}&sort=total${model.customDate}&queryname=${model.queryName}">Total Count</a></th>
<th class="right"><a href="?op=historyGroupReport&domain=${model.domain}&date=${model.date}&group=${payload.group}&reportType=${model.reportType}&type=${payload.type}&sort=failure${model.customDate}&queryname=${model.queryName}">Failure Count</a></th>
<th class="right"><a href="?op=historyGroupReport&domain=${model.domain}&date=${model.date}&group=${payload.group}&reportType=${model.reportType}&type=${payload.type}&sort=failurePercent${model.customDate}&queryname=${model.queryName}">Failure%</a></th>
<th class="right">Sample Link</th>
<th class="right">Min(ms)</th>
<th class="right">Max(ms)</th>
<th class="right"><a href="?op=historyGroupReport&domain=${model.domain}&date=${model.date}&group=${payload.group}&reportType=${model.reportType}&type=${payload.type}&sort=avg${model.customDate}&queryname=${model.queryName}">Avg</a>(ms)</th>
<th class="right"><a href="?op=historyGroupReport&domain=${model.domain}&date=${model.date}&group=${payload.group}&reportType=${model.reportType}&type=${payload.type}&sort=95line${model.customDate}&queryname=${model.queryName}">95Line</a>(ms)</th>
<th class="right"><a href="?op=historyGroupReport&domain=${model.domain}&date=${model.date}&group=${payload.group}&reportType=${model.reportType}&type=${payload.type}&sort=99line${model.customDate}&queryname=${model.queryName}">99.9Line</a>(ms)</th>
<th class="right">Std(ms)</th>
<th class="right"><a href="?op=historyGroupReport&domain=${model.domain}&date=${model.date}&group=${payload.group}&reportType=${model.reportType}&type=${payload.type}&sort=total${model.customDate}&queryname=${model.queryName}">QPS</a></th>
<th class="right"><a href="?op=historyGroupReport&domain=${model.domain}&date=${model.date}&group=${payload.group}&reportType=${model.reportType}&type=${payload.type}&sort=total${model.customDate}&queryname=${model.queryName}">Percent%</a></th>
</tr>
<c:forEach var="item" items="${model.displayNameReport.results}"
varStatus="status">
<c:set var="e" value="${item.detail}" />
<c:set var="lastIndex" value="${status.index}" />
<tr class="${status.index mod 2 != 0 ? 'odd' : 'even'} right">
<td class="longText" style="text-align:left;white-space:normal">
<c:choose>
<c:when test="${status.index > 0}">
<a href="?op=historyGroupGraph&domain=${model.domain}&date=${model.date}&group=${payload.group}&reportType=${model.reportType}&type=${payload.type}&name=${e.id}${model.customDate}" class="history_graph_link" data-status="${status.index}">[:: show ::]</a>
</c:when>
<c:otherwise></c:otherwise></c:choose>
&nbsp;&nbsp;&nbsp;${w:shorten(e.id, 120)}</td>
<td>${w:format(e.totalCount,'#,###,###,###,##0')}</td>
<td>${e.failCount}</td>
<td>${w:format(e.failPercent/100,'0.0000%')}</td>
<td><a href="${model.logViewBaseUri}/${empty e.failMessageUrl ? e.successMessageUrl : e.failMessageUrl}?domain=${model.domain}">Log View</a></td>
<td>${w:format(e.min,'0.#')}</td>
<td>${w:format(e.max,'0.#')}</td>
<td>${w:format(e.avg,'0.0')}</td>
<td>${w:format(e.line95Value,'0.0')}</td>
<td>${w:format(e.line99Value,'0.0')}</td>
<td>${w:format(e.std,'0.0')}</td>
<td>${w:format(e.tps,'0.0')}</td>
<td>${w:format(e.totalPercent,'0.00%')}</td>
</tr>
<tr class="graphs"><td colspan="12"><div id="${status.index}" style="display:none"></div></td></tr>
</c:forEach>
</c:otherwise>
</c:choose>
</table>
<font color="white">${lastIndex+1}</font>
<res:useJs value="${res.js.local.transaction_js}" target="bottom-js" />
<c:choose>
<c:when test="${not empty payload.type}">
<table>
<tr>
<td><div id="transactionGraph" class="pieChart"></div>
</td>
</tr>
</table>
<script type="text/javascript">
var data = ${model.pieChart};
graphPieChart(document.getElementById('transactionGraph'), data);
</script>
</c:when>
</c:choose>
</br>
</jsp:body>
</a:historyReport>
\ No newline at end of file
......@@ -30,6 +30,20 @@
</th>
</tr>
</table>
<table class="groups">
<tr class="left">
<th>机器分组: &nbsp;&nbsp;
<c:forEach var="group" items="${model.groups}">
&nbsp;[&nbsp;
<a href="?op=historyGroupReport&domain=${model.domain}&date=${model.date}&group=${group}">${group}</a>
&nbsp;]&nbsp;
</c:forEach>
</th>
</tr>
</table>
<table class='data'>
<c:choose>
<c:when test="${empty payload.type}">
......
......@@ -12,7 +12,7 @@
<li class="text-right" id="metricConfigList"><a href="?op=metricConfigList"><strong>业务监控规则</strong></a></li>
<li class="text-right" id="bugConfigUpdate"><a href="?op=bugConfigUpdate"><strong>异常规范配置</strong></a></li>
<li class="text-right" id="aggregationList"><a href="?op=aggregations"><strong>前端合并规则</strong></a></li>
<li class="text-right" id="utilizationConfigUpdate"><a href="?op=utilizationConfigUpdate"><strong>资源权重配置</strong></a></li>
<li class="text-right" id="domainGroupConfigUpdate"><a href="?op=domainGroupConfigUpdate"><strong>机器分组配置</strong></a></li>
</ul>
</div>
<style>
......
<%@ page contentType="text/html; charset=utf-8" %>
<%@ taglib prefix="a" uri="/WEB-INF/app.tld"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="res" uri="http://www.unidal.org/webres"%>
<%@ taglib prefix="w" uri="http://www.unidal.org/web/core"%>
<a:body>
<res:useJs value="${res.js.local['jquery.validate.min.js']}" target="head-js" />
<res:useJs value="${res.js.local['dependencyConfig.js']}" target="head-js" />
<res:useJs value="${res.js.local['alarm_js']}" target="head-js" />
<res:useCss value="${res.css.local['select2.css']}" target="head-css" />
<res:useJs value="${res.js.local['select2.min.js']}" target="head-js" />
<div class="row-fluid">
<div class="span2">
<%@include file="../configTree.jsp"%>
</div>
<div class="span10">
<form name="domainGroupConfigUpdate" id="form" method="post"
action="${model.pageUri}?op=domainGroupConfigUpdate">
<h4 class="text-center text-error" id="state">&nbsp;</h4>
<h4 class="text-center text-error">项目机器分组配置</h4>
<table class="table table-striped table-bordered table-condensed table-hover">
<tr>
<td><textarea name="content" style="width:auto" rows="20" cols="150">${model.content}</textarea></td>
</tr>
<tr>
<td style="text-align:center"><input class='btn btn-primary'
type="submit" name="submit" value="提交" /></td>
</tr>
</table>
</form>
</div>
</div>
</a:body>
<script type="text/javascript">
$(document).ready(function() {
$('#domainConfigUpdate').addClass('active');
var state = '${model.opState}';
if(state=='Success'){
$('#state').html('操作成功');
}else{
$('#state').html('操作失败');
}
setInterval(function(){
$('#state').html('&nbsp;');
},3000);
});
</script>
\ No newline at end of file
......@@ -13,6 +13,15 @@ public class TestBusinessMessage {
private static final String PayOrder = "PayOrder";
@Test
public void testEvent() throws Exception {
for (int i = 0; i < 1000; i++) {
Cat.logError(new NullPointerException());
}
Thread.sleep(10000);
}
@Test
public void test() throws Exception {
while (true) {
......
<domain-group>
<domain id="Cat">
<group id="weixin">
<ip>127.0.0.1</ip>
<ip>127.0.0.1</ip>
</group>
<group></group>
</domain>
<domain></domain>
</domain-group>
\ No newline at end of file
......@@ -4,7 +4,7 @@
<parent>
<groupId>com.dianping.cat</groupId>
<artifactId>parent</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>cat-maven-plugin</artifactId>
......
......@@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.dianping.cat</groupId>
<artifactId>parent</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
<name>CAT</name>
<description>Central Application Tracking</description>
<packaging>pom</packaging>
......@@ -177,7 +177,7 @@ org.eclipse.jdt.core.compiler.compliance=1.6
<plugin>
<groupId>com.dianping.cat</groupId>
<artifactId>cat-maven-plugin</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
</plugin>
</plugins>
</build>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册