提交 9d4d022b 编写于 作者: J jialinsun

reslove conflicts

上级 96ad7b97
......@@ -102,6 +102,7 @@ public class TcpSocketSender implements Task, MessageSender, LogEnabled {
m_logger.error("Error when sending message over TCP socket!", t);
}
} else {
System.out.println("check write false");
try {
Thread.sleep(5);
} catch (Exception e) {
......
......@@ -6,7 +6,9 @@
</entity>
<entity name="aggregation-rule">
<attribute name="pattern" value-type="String" key="true"/>
<attribute name="type" value-type="int" />
<attribute name="type" value-type="int" primitive="true"/>
<attribute name="warn" value-type="int" primitive="true"/>
<attribute name="mails" value-type="String" />
<attribute name="domain" value-type="String" />
<attribute name="sample" value-type="String" />
<attribute name="display-name" value-type="String" />
......
......@@ -13,6 +13,7 @@ import org.unidal.lookup.configuration.Component;
import com.dianping.cat.CatHomeModule;
import com.dianping.cat.ServerConfigManager;
import com.dianping.cat.config.aggregation.AggregationConfigManager;
import com.dianping.cat.config.app.AppDataCommandTableProvider;
import com.dianping.cat.config.app.AppDataService;
import com.dianping.cat.consumer.dependency.DependencyAnalyzer;
......@@ -202,7 +203,7 @@ public class ComponentsConfigurator extends AbstractResourceConfigurator {
all.add(C(SystemAlert.class).req(ProductLineConfigManager.class, BaselineService.class, AlertInfo.class).req(
RemoteMetricReportService.class, SystemRuleConfigManager.class, DataChecker.class, AlertManager.class));
all.add(C(AlertExceptionBuilder.class).req(ExceptionConfigManager.class));
all.add(C(AlertExceptionBuilder.class).req(ExceptionConfigManager.class, AggregationConfigManager.class));
all.add(C(ExceptionAlert.class)
.req(ExceptionConfigManager.class, AlertExceptionBuilder.class, AlertManager.class).req(ModelService.class,
......@@ -344,8 +345,6 @@ public class ComponentsConfigurator extends AbstractResourceConfigurator {
all.add(C(AlertEntityService.class).req(AlertDao.class));
all.add(C(AlertExceptionBuilder.class).req(ExceptionConfigManager.class));
all.add(C(AlertSummaryExecutor.class).req(AlertSummaryGenerator.class, AlertSummaryManager.class, MailSMS.class)
.req(AlertSummaryDecorator.class, AlertSummaryFTLDecorator.ID));
......
......@@ -11,6 +11,8 @@ import java.util.Map.Entry;
import org.unidal.lookup.annotation.Inject;
import org.unidal.tuple.Pair;
import com.dianping.cat.Constants;
import com.dianping.cat.config.aggregation.AggregationConfigManager;
import com.dianping.cat.home.dependency.exception.entity.ExceptionExclude;
import com.dianping.cat.home.dependency.exception.entity.ExceptionLimit;
import com.dianping.cat.report.page.top.TopMetric.Item;
......@@ -21,20 +23,39 @@ public class AlertExceptionBuilder {
@Inject
private ExceptionConfigManager m_exceptionConfigManager;
@Inject
private AggregationConfigManager m_aggregationConfigManager;
public Map<String, List<AlertException>> buildAlertExceptions(List<Item> items) {
Map<String, List<AlertException>> alertExceptions = new LinkedHashMap<String, List<AlertException>>();
for (Item item : items) {
List<AlertException> domainAlertExceptions = buildDomainAlertExceptionList(item);
String domain = item.getDomain();
if (Constants.FRONT_END.equalsIgnoreCase(domain)) {
List<AlertException> frontEndAlertExceptions = buildFrontEndAlertExceptions(item);
if (!frontEndAlertExceptions.isEmpty()) {
alertExceptions.put(domain, frontEndAlertExceptions);
}
} else {
List<AlertException> domainAlertExceptions = buildDomainAlertExceptions(item);
if (!domainAlertExceptions.isEmpty()) {
alertExceptions.put(item.getDomain(), domainAlertExceptions);
if (!domainAlertExceptions.isEmpty()) {
alertExceptions.put(domain, domainAlertExceptions);
}
}
}
return alertExceptions;
}
private List<AlertException> buildDomainAlertExceptionList(Item item) {
private List<AlertException> buildFrontEndAlertExceptions(Item item) {
String domain = item.getDomain();
List<AlertException> alertExceptions = new ArrayList<AlertException>();
return null;
}
private List<AlertException> buildDomainAlertExceptions(Item item) {
String domain = item.getDomain();
List<AlertException> alertExceptions = new ArrayList<AlertException>();
Pair<Double, Double> totalLimitPair = queryDomainTotalLimit(domain);
......
......@@ -110,15 +110,9 @@ public class ExceptionAlert implements Task {
for (AlertException exception : exceptions) {
String metricName = exception.getName();
AlertEntity entity = new AlertEntity();
entity.setDate(new Date()).setContent(exception.toString()).setLevel(exception.getType());
entity.setMetric(metricName).setType(getName()).setGroup(domain);
AlertExceptionBuilder builder = new AlertEntity().new AlertExceptionBuilder();
builder.buildDate(new Date()).buildLevel(exception.getType()).buildContent(exception.toString());
builder.buildMetric(metricName).buildProductline(domain).buildType(getName()).buildGroup(domain);
AlertEntity alertEntity = builder.getAlertEntity();
m_sendManager.addAlert(entity);
}
} catch (Exception e) {
......
<?xml version="1.0" encoding="UTF-8"?>
<model>
<entity name="aggregation" root="true">
<entity-ref name="aggregation-rule" type="list" names="aggregation-rules" />
</entity>
<entity name="aggregation-rule">
<attribute name="type" value-type="int" />
<attribute name="domain" value-type="String" />
<attribute name="pattern" value-type="String" />
<attribute name="sample" value-type="String" />
<attribute name="display-name" value-type="String" />
<attribute name="creation-date" value-type="Date" format="yyyy-MM-dd HH:mm:ss" />
</entity>
</model>
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<file path="aggreation-codegen.xml" />
<file path="aggreation-model.xml" />
</manifest>
<?xml version="1.0" encoding="UTF-8"?>
<model model-package="com.dianping.cat.home.aggreation" enable-merger="false" enable-sax-parser="true"
enable-base-visitor="false" >
<entity name="aggregation" root="true">
<entity-ref name="aggregation-rule" type="map" names="aggregation-rules" method-find-or-create="true"/>
</entity>
<entity name="aggregation-rule">
<attribute name="pattern" value-type="String" key="true"/>
<attribute name="type" value-type="int" />
<attribute name="domain" value-type="String" />
<attribute name="sample" value-type="String" />
<attribute name="display-name" value-type="String" />
<attribute name="creation-date" value-type="Date" format="yyyy-MM-dd HH:mm:ss" />
</entity>
</model>
<?xml version="1.0" encoding="utf-8"?>
<aggregation>
<aggregation-rule type="3" domain="FrontEnd" pattern="http://w.51ping.com/shop/{shopId}" sample="http://w.51ping.com/shop/5722322" display-name="http://w.51ping.com/shop/{shopId}" creation-date="2013-06-05 15:42:03"/>
<aggregation-rule type="3" domain="FrontEnd" pattern="http://w.51ping.com/shop/{shopId}" sample="http://w.51ping.com/shop/5722322" display-name="http://w.51ping.com/shop/{shopId}" warn="10" email="jialin.sun@dianping.com" creation-date="2013-06-05 15:42:03"/>
<aggregation-rule type="3" domain="FrontEnd" pattern="http://i{x}.dpfile.com/{*}" sample="http://i1.dpfile.com/s/j" display-name="http://i{x}.dpfile.com/{*}" creation-date="2013-05-20 13:34:00"/>
<aggregation-rule type="3" domain="FrontEnd" pattern="http://www.dianping.com/{City}/food " display-name="http://www.dianping.com/{City}/food " creation-date="2013-05-20 13:34:00"/>
<aggregation-rule type="3" domain="FrontEnd" pattern="http://www.dianping.com/{City}/wedding" display-name="http://www.dianping.com/{City}/wedding" creation-date="2013-05-20 13:34:00"/>
......
......@@ -30,7 +30,9 @@
<tr class="odd">
<th width="15%">报表类型</th>
<th width="10%">域名</th>
<th width="70%">规则</th>
<th width="60%">规则</th>
<th width="10%">告警阈值</th>
<th width="15%">联系邮件</th>
<!-- <th width="15%">显示名称</th>
<th width="8%">示例</th> -->
<th width="5%">操作&nbsp;&nbsp; <a class='btn btn-primary btn-small' href="?op=aggregationUpdate">新增</a></th>
......@@ -51,7 +53,9 @@
</c:when>
</c:choose>
<td>${item.domain}</td>
<td>${item.pattern}</td><%--
<td>${item.pattern}</td>
<td>${item.warn}</td>
<td>${item.mails}</td><%--
<td>${item.displayName}</td>
<td>${item.sample}</td> --%>
<td><a class='btn btn-small btn-primary'href="?op=aggregationUpdate&pattern=${item.pattern}">编辑</a>
......
......@@ -54,6 +54,15 @@
<td>模板</td>
<td><input type="text" class="input-xlarge" placeholder="选择被聚合对象的模板" name="aggregation.pattern" required value="${model.aggregationRule.pattern}"/></td>
</tr>
<tr>
<td>告警阈值</td>
<td><input type="text" class="input-xlarge" placeholder="告警阈值" name="aggregation.warn" required value="${model.aggregationRule.warn}"/></td>
</tr>
<tr>
<td>联系邮件</td>
<td><input type="text" class="input-xlarge" placeholder="联系邮件" name="aggregation.mails" required value="${model.aggregationRule.mails}"/></td>
</tr>
<%-- <tr>
<td>显示名称</td>
<td><input type="text" class="input-xlarge" placeholder="聚合显示的名称" name="aggregation.displayName" required value="${model.aggregationRule.displayName}"/></td>
......
......@@ -6,6 +6,7 @@ public class ExceptionBuilder {
public static void main(String args[]) {
while (true) {
Cat.logError(new RuntimeException("just test for FrontEnd"));
System.out.println("log error");
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册