eagle-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jinh...@apache.org
Subject incubator-eagle git commit: [MINOR] fix email format and change default delay time
Date Thu, 24 Nov 2016 12:19:41 GMT
Repository: incubator-eagle
Updated Branches:
  refs/heads/master 65de7b0ac -> 8042f9e44


[MINOR] fix email format and change default delay time

Author: wujinhu <wujinhu920@126.com>

Closes #681 from wujinhu/EAGLE-788.


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/8042f9e4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/8042f9e4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/8042f9e4

Branch: refs/heads/master
Commit: 8042f9e44201b485537ac7a96d729dc9e4f1d694
Parents: 65de7b0
Author: wujinhu <wujinhu920@126.com>
Authored: Thu Nov 24 20:19:35 2016 +0800
Committer: wujinhu <wujinhu920@126.com>
Committed: Thu Nov 24 20:19:35 2016 +0800

----------------------------------------------------------------------
 .../eagle/app/service/ApplicationHealthCheckPublisher.java  | 2 +-
 .../service/impl/ApplicationHealthCheckEmailPublisher.java  | 4 ++--
 .../app/service/impl/ApplicationHealthCheckServiceImpl.java | 9 ++++++++-
 .../src/main/resources/HealthCheckTemplate.vm               | 4 ++--
 .../queue/HadoopQueueRunningApplicationHealthCheck.java     | 5 +++--
 .../eagle/topology/TopologyCheckApplicationHealthCheck.java | 5 +++--
 6 files changed, 19 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/8042f9e4/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/ApplicationHealthCheckPublisher.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/ApplicationHealthCheckPublisher.java
b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/ApplicationHealthCheckPublisher.java
index 4a8d2e7..8e91029 100644
--- a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/ApplicationHealthCheckPublisher.java
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/ApplicationHealthCheckPublisher.java
@@ -22,5 +22,5 @@ import com.codahale.metrics.health.HealthCheck;
 import java.util.Map;
 
 public interface ApplicationHealthCheckPublisher {
-    void onUnHealthApplication(Map<String, HealthCheck.Result> results);
+    void onUnHealthApplication(String type, Map<String, HealthCheck.Result> results);
 }

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/8042f9e4/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationHealthCheckEmailPublisher.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationHealthCheckEmailPublisher.java
b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationHealthCheckEmailPublisher.java
index 8374b38..9c700bf 100644
--- a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationHealthCheckEmailPublisher.java
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationHealthCheckEmailPublisher.java
@@ -51,7 +51,7 @@ public class ApplicationHealthCheckEmailPublisher implements ApplicationHealthCh
     }
 
     @Override
-    public void onUnHealthApplication(Map<String, HealthCheck.Result> results) {
+    public void onUnHealthApplication(String type, Map<String, HealthCheck.Result>
results) {
         if (results.size() == 0) {
             return;
         }
@@ -110,7 +110,7 @@ public class ApplicationHealthCheckEmailPublisher implements ApplicationHealthCh
                         System.getProperty("user.name") + "@" + hostname,
                         recipients,
                         config.hasPath(CONF_MAIL_CC) ? config.getString(CONF_MAIL_CC) : null,
-                        subject,
+                        type + subject,
                         config.getString(CONF_MAIL_TEMPLATE),
                         context,
                         null);

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/8042f9e4/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationHealthCheckServiceImpl.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationHealthCheckServiceImpl.java
b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationHealthCheckServiceImpl.java
index fb2a1b4..cc8a8d7 100644
--- a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationHealthCheckServiceImpl.java
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationHealthCheckServiceImpl.java
@@ -57,6 +57,9 @@ public class ApplicationHealthCheckServiceImpl extends ApplicationHealthCheckSer
     private static final String SERVICE_PATH = "service";
     private static final String TIMEZONE_PATH = "service.timezone";
     private static final String HEALTHY = "OK";
+    private static final String DAILY_TYPE = "[DAILY] - ";
+    private static final String ERROR_TYPE = "[ERROR] - ";
+
     private boolean hasSendDaily = false;
 
     private TimeZone timeZone;
@@ -184,9 +187,13 @@ public class ApplicationHealthCheckServiceImpl extends ApplicationHealthCheckSer
             }
         }
 
+        String type = ERROR_TYPE;
         if (this.applicationHealthCheckPublisher != null) {
             try {
-                this.applicationHealthCheckPublisher.onUnHealthApplication(results);
+                if (isDaily) {
+                    type = DAILY_TYPE;
+                }
+                this.applicationHealthCheckPublisher.onUnHealthApplication(type, results);
                 if (isDaily) {
                     hasSendDaily = true;
                 }

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/8042f9e4/eagle-core/eagle-app/eagle-app-base/src/main/resources/HealthCheckTemplate.vm
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/resources/HealthCheckTemplate.vm
b/eagle-core/eagle-app/eagle-app-base/src/main/resources/HealthCheckTemplate.vm
index 74f401a..bdc4339 100644
--- a/eagle-core/eagle-app/eagle-app-base/src/main/resources/HealthCheckTemplate.vm
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/resources/HealthCheckTemplate.vm
@@ -24,8 +24,8 @@
     #set ( $elem = $unHealthyContext )
 
 
-<p><b>Health Check: </b>$elem["healthCheckUrl"]</p>
-<p><b>Appliaction Management: </b>$elem["appMgmtUrl"]</p>
+<p><b>Health Check: </b><a href=$elem["healthCheckUrl"]>$elem["healthCheckUrl"]</a></p>
+<p><b>Appliaction Management: </b><a href=$elem["appMgmtUrl"]>$elem["appMgmtUrl"]</a></p>
 
 <table border="1">
     <tr>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/8042f9e4/eagle-jpm/eagle-hadoop-queue/src/main/java/org/apache/eagle/hadoop/queue/HadoopQueueRunningApplicationHealthCheck.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-hadoop-queue/src/main/java/org/apache/eagle/hadoop/queue/HadoopQueueRunningApplicationHealthCheck.java
b/eagle-jpm/eagle-hadoop-queue/src/main/java/org/apache/eagle/hadoop/queue/HadoopQueueRunningApplicationHealthCheck.java
index bc5b7c4..61c7687 100644
--- a/eagle-jpm/eagle-hadoop-queue/src/main/java/org/apache/eagle/hadoop/queue/HadoopQueueRunningApplicationHealthCheck.java
+++ b/eagle-jpm/eagle-hadoop-queue/src/main/java/org/apache/eagle/hadoop/queue/HadoopQueueRunningApplicationHealthCheck.java
@@ -34,6 +34,7 @@ import java.util.Map;
 
 public class HadoopQueueRunningApplicationHealthCheck extends ApplicationHealthCheckBase
{
     private static final Logger LOG = LoggerFactory.getLogger(HadoopQueueRunningApplicationHealthCheck.class);
+    private static final long DEFAULT_MAX_DELAY_TIME = 10 * 60 * 1000L;
 
     private HadoopQueueRunningAppConfig hadoopQueueRunningAppConfig;
 
@@ -81,8 +82,8 @@ public class HadoopQueueRunningApplicationHealthCheck extends ApplicationHealthC
             }
 
             if (!message.isEmpty() || currentTimeStamp - currentProcessTimeStamp > maxDelayTime)
{
-                message += String.format("Current process time is %sms, delay %s hours.",
-                        currentProcessTimeStamp, (currentTimeStamp - currentProcessTimeStamp)
* 1.0 / 60000L / 60);
+                message += String.format("Current process time is %sms, delay %s minutes.",
+                        currentProcessTimeStamp, (currentTimeStamp - currentProcessTimeStamp)
* 1.0 / 60000L);
                 return Result.unhealthy(message);
             } else {
                 return Result.healthy();

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/8042f9e4/eagle-topology-check/eagle-topology-app/src/main/java/org/apache/eagle/topology/TopologyCheckApplicationHealthCheck.java
----------------------------------------------------------------------
diff --git a/eagle-topology-check/eagle-topology-app/src/main/java/org/apache/eagle/topology/TopologyCheckApplicationHealthCheck.java
b/eagle-topology-check/eagle-topology-app/src/main/java/org/apache/eagle/topology/TopologyCheckApplicationHealthCheck.java
index 4b740db..5115af6 100644
--- a/eagle-topology-check/eagle-topology-app/src/main/java/org/apache/eagle/topology/TopologyCheckApplicationHealthCheck.java
+++ b/eagle-topology-check/eagle-topology-app/src/main/java/org/apache/eagle/topology/TopologyCheckApplicationHealthCheck.java
@@ -32,6 +32,7 @@ import java.util.Map;
 
 public class TopologyCheckApplicationHealthCheck extends ApplicationHealthCheckBase {
     private static final Logger LOG = LoggerFactory.getLogger(TopologyCheckApplicationHealthCheck.class);
+    private static final long DEFAULT_MAX_DELAY_TIME = 10 * 60 * 1000L;
 
     private TopologyCheckAppConfig topologyCheckAppConfig;
 
@@ -78,8 +79,8 @@ public class TopologyCheckApplicationHealthCheck extends ApplicationHealthCheckB
             }
 
             if (!message.isEmpty() || currentTimeStamp - currentProcessTimeStamp > maxDelayTime)
{
-                message += String.format("Current process time is %sms, delay %s hours.",
-                        currentProcessTimeStamp, (currentTimeStamp - currentProcessTimeStamp)
* 1.0 / 60000L / 60);
+                message += String.format("Current process time is %sms, delay %s minutes.",
+                        currentProcessTimeStamp, (currentTimeStamp - currentProcessTimeStamp)
* 1.0 / 60000L);
                 return Result.unhealthy(message);
             } else {
                 return Result.healthy();


Mime
View raw message