提交 5242a35a 编写于 作者: Y youyong205

fix code bug

上级 e7519703
......@@ -270,7 +270,7 @@ public class MetricGraphCreator extends AbstractGraphCreator {
if (containMetric(alertKeys, metricId)) {
chart.setHtmlTitle("<span style='color:red'>" + title + "<br><small>" + contactInfo + "</small></span>");
} else {
chart.setHtmlTitle(title + "<br><small>" + contactInfo + "</small>");
chart.setHtmlTitle(title);
}
}
}
......
......@@ -60,31 +60,31 @@ public class NetGraphBuilder {
String group = inter.getGroup();
MetricReport report = reports.get(group);
String domain = inter.getDomain();
String key = inter.getKey();
String prefix = inter.getKey();
updateInterface(inter, report, minute);
if (containsAlert(alertKeys, group, domain, key, "-flow-in")) {
if (containsAlert(alertKeys, group, domain, prefix, "-flow-in")) {
inter.setInstate(ERROR);
inState = ERROR;
}
if (containsAlert(alertKeys, group, domain, key, "-discard/error-indiscards")) {
if (containsAlert(alertKeys, group, domain, prefix, "-discard/error-indiscards")) {
inter.setInDiscardsState(ERROR);
inDiscardsState = ERROR;
}
if (containsAlert(alertKeys, group, domain, key, "-discard/error-inerrors")) {
if (containsAlert(alertKeys, group, domain, prefix, "-discard/error-inerrors")) {
inter.setInErrorsState(ERROR);
inErrorsState = ERROR;
}
if (containsAlert(alertKeys, group, domain, key, "-flow-out")) {
if (containsAlert(alertKeys, group, domain, prefix, "-flow-out")) {
inter.setOutstate(ERROR);
outState = ERROR;
}
if (containsAlert(alertKeys, group, domain, key, "-discard/error-outdiscards")) {
if (containsAlert(alertKeys, group, domain, prefix, "-discard/error-outdiscards")) {
inter.setOutDiscardsState(ERROR);
outDiscardsState = ERROR;
}
if (containsAlert(alertKeys, group, domain, key, "-discard/error-outerrors")) {
if (containsAlert(alertKeys, group, domain, prefix, "-discard/error-outerrors")) {
inter.setOutErrorsState(ERROR);
outErrorsState = ERROR;
}
......@@ -115,15 +115,14 @@ public class NetGraphBuilder {
}
}
private boolean containsAlert(List<AlertMetric> alertKeys, String group, String domain, String key, String suffix) {
String actualKey = domain + ":Metric:" + key + suffix;
private boolean containsAlert(List<AlertMetric> alertKeys, String group, String domain, String prefix, String suffix) {
String actualKey = domain + ":Metric:" + prefix + suffix;
for (AlertMetric metric : alertKeys) {
if (metric.getGroup().equals(group) && metric.getMetricId().equals(actualKey)) {
return true;
}
}
return false;
}
......
......@@ -49,8 +49,8 @@ public class AlertInfo implements Initializable {
private String m_metricId;
public AlertMetric(String group, String metricId) {
this.m_group = group;
this.m_metricId = metricId;
m_group = group;
m_metricId = metricId;
}
public String getGroup() {
......@@ -61,6 +61,25 @@ public class AlertInfo implements Initializable {
return m_metricId;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((m_group == null) ? 0 : m_group.hashCode());
result = prime * result + ((m_metricId == null) ? 0 : m_metricId.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
AlertMetric other = (AlertMetric) obj;
if (m_group.equals(other.getGroup()) && m_metricId.equals(other.getMetricId())) {
return true;
} else {
return false;
}
}
}
}
......@@ -5,7 +5,7 @@ import java.util.List;
import com.dianping.cat.Cat;
public class SmsSender extends BaseSender {
@Override
protected void sendLog(String title, String content, List<String> receivers) {
StringBuilder builder = new StringBuilder();
......
......@@ -34,7 +34,7 @@ public class AlertSummaryGenerator {
alert.setAlertTime(date);
alert.setContext(edge.getDes());
alert.setMetric(edge.getKey());
alert.setType("long call");
alert.setType("slow "+edge.getType());
alert.setDomain(edge.getSelf());
return alert;
......
......@@ -21,7 +21,7 @@ public class AlertSummaryVisitor extends BaseVisitor {
private List<Map<Object, Object>> m_alertList;
private DateFormat m_fmt = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
private DateFormat m_fmt = new SimpleDateFormat("HH:mm:ss");
public Map<Object, Object> getResult() {
return m_result;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册