private Alert buildAlert( String domainName, String metricTitle, String mailTitle, AlertResultEntity alertResult) { Alert alert = new Alert(); alert.setDomain(domainName); alert.setAlertTime(alertResult.getAlertTime()); alert.setCategory(getName()); alert.setType(alertResult.getAlertType()); alert.setContent(mailTitle + "<br/>" + alertResult.getContent()); alert.setMetric(metricTitle); return alert; }
private void processMetricItem(int minute, ProductLine productLine, String metricKey) { for (MetricType type : MetricType.values()) { String productlineName = productLine.getId(); AlertResultEntity alertResult = computeAlertInfo(minute, productlineName, metricKey, type); if (alertResult != null && alertResult.isTriggered()) { String metricTitle = buildMetricTitle(metricKey); String mailTitle = getAlertConfig().buildMailTitle(productLine.getTitle(), metricTitle); m_alertInfo.addAlertInfo(metricKey, new Date().getTime()); storeAlert(productlineName, metricTitle, mailTitle, alertResult); sendAlertInfo(productLine, mailTitle, alertResult.getContent(), alertResult.getAlertType()); } } }