提交 fa3f35b7 编写于 作者: Y youyong205

modify the business alert

上级 1fc303b4
package com.dianping.cat.report.task.alert.business;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
......@@ -53,16 +54,16 @@ public class BusinessAlert extends BaseAlert implements Task, LogEnabled {
String domain = config.getDomain();
String metric = config.getMetricKey();
String metricKey = m_metricConfigManager.buildMetricKey(domain, config.getType(), metric);
List<AlertResultEntity> alertResults = null;
List<AlertResultEntity> alertResults = new ArrayList<AlertResultEntity>();
if (config.isShowAvg()) {
alertResults = computeAlertInfo(minute, product, metricKey, MetricType.AVG);
alertResults.addAll(computeAlertInfo(minute, product, metricKey, MetricType.AVG));
}
if (config.isShowCount()) {
alertResults = computeAlertInfo(minute, product, metricKey, MetricType.COUNT);
alertResults.addAll(computeAlertInfo(minute, product, metricKey, MetricType.COUNT));
}
if (config.isShowSum()) {
alertResults = computeAlertInfo(minute, product, metricKey, MetricType.SUM);
alertResults.addAll(computeAlertInfo(minute, product, metricKey, MetricType.SUM));
}
for (AlertResultEntity alertResult : alertResults) {
......@@ -70,8 +71,9 @@ public class BusinessAlert extends BaseAlert implements Task, LogEnabled {
String metricName = buildMetricName(metricKey);
AlertEntity entity = new AlertEntity();
entity.setDate(alertResult.getAlertTime()).setContent(alertResult.getContent()).setLevel(alertResult.getAlertLevel());
entity.setDate(alertResult.getAlertTime()).setContent(alertResult.getContent())
.setLevel(alertResult.getAlertLevel());
entity.setMetric(metricName).setType(getName()).setGroup(product);
m_sendManager.addAlert(entity);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册