eagle-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jinh...@apache.org
Subject eagle git commit: [MINOR] fix sla job timezone issue
Date Fri, 10 Mar 2017 03:11:33 GMT
Repository: eagle
Updated Branches:
  refs/heads/master b6165aab3 -> 1085dae69


[MINOR] fix sla job timezone issue

Author: wujinhu <wujinhu920@126.com>

Closes #863 from wujinhu/EAGLE-851.


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

Branch: refs/heads/master
Commit: 1085dae698371fd58f60c2aa728430edfef916b8
Parents: b6165aa
Author: wujinhu <wujinhu920@126.com>
Authored: Fri Mar 10 11:11:25 2017 +0800
Committer: wujinhu <wujinhu920@126.com>
Committed: Fri Mar 10 11:11:25 2017 +0800

----------------------------------------------------------------------
 .../eagle/jpm/analyzer/publisher/EmailPublisher.java  | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/eagle/blob/1085dae6/eagle-jpm/eagle-jpm-analyzer/src/main/java/org/apache/eagle/jpm/analyzer/publisher/EmailPublisher.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-analyzer/src/main/java/org/apache/eagle/jpm/analyzer/publisher/EmailPublisher.java
b/eagle-jpm/eagle-jpm-analyzer/src/main/java/org/apache/eagle/jpm/analyzer/publisher/EmailPublisher.java
index 85804ff..4ec946d 100644
--- a/eagle-jpm/eagle-jpm-analyzer/src/main/java/org/apache/eagle/jpm/analyzer/publisher/EmailPublisher.java
+++ b/eagle-jpm/eagle-jpm-analyzer/src/main/java/org/apache/eagle/jpm/analyzer/publisher/EmailPublisher.java
@@ -22,6 +22,7 @@ import com.typesafe.config.ConfigFactory;
 import org.apache.eagle.alert.engine.publisher.PublishConstants;
 import org.apache.eagle.app.service.ApplicationEmailService;
 import org.apache.eagle.common.DateTimeUtil;
+import org.apache.eagle.common.config.EagleConfigConstants;
 import org.apache.eagle.common.mail.AlertEmailConstants;
 import org.apache.eagle.common.mail.AlertEmailContext;
 import org.apache.eagle.jpm.analyzer.meta.model.AnalyzerEntity;
@@ -33,21 +34,22 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 public class EmailPublisher implements Publisher, Serializable {
     private static final Logger LOG = LoggerFactory.getLogger(EmailPublisher.class);
 
     private Config config;
     private List<Class<?>> publishResult4Evaluators = new ArrayList<>();
+    private TimeZone timeZone;
 
     public EmailPublisher(Config config) {
         this.config = config;
         //TODO
         publishResult4Evaluators.add(SLAJobEvaluator.class);
+        timeZone = TimeZone.getTimeZone((config.hasPath(EagleConfigConstants.EAGLE_TIME_ZONE)
+                ? config.getString(EagleConfigConstants.EAGLE_TIME_ZONE)
+                : EagleConfigConstants.DEFAULT_EAGLE_TIME_ZONE));
     }
 
     @Override
@@ -76,10 +78,10 @@ public class EmailPublisher implements Publisher, Serializable {
         basic.put("user", analyzerJobEntity.getUserId());
         basic.put("status", analyzerJobEntity.getCurrentState());
         basic.put("duration", analyzerJobEntity.getDurationTime() * 1.0 / 1000 + "s");
-        basic.put("start", DateTimeUtil.millisecondsToHumanDateWithSeconds(analyzerJobEntity.getStartTime()));
+        basic.put("start", DateTimeUtil.secondsToHumanDate(analyzerJobEntity.getStartTime()
/ 1000, timeZone));
         basic.put("end", analyzerJobEntity.getEndTime() == 0
                 ? "0"
-                : DateTimeUtil.millisecondsToHumanDateWithSeconds(analyzerJobEntity.getEndTime()));
+                : DateTimeUtil.secondsToHumanDate(analyzerJobEntity.getEndTime() / 1000,
timeZone));
         double progress = analyzerJobEntity.getCurrentState().equalsIgnoreCase(org.apache.eagle.jpm.util.Constants.JobState.RUNNING.toString())
? analyzerJobEntity.getProgress() : 100;
         basic.put("progress", progress + "%");
         basic.put("detail", getJobLink(analyzerJobEntity));


Mime
View raw message