This is an automated email from the ASF dual-hosted git repository.

akshayrai09 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new 8c3edbb  [TE] Clean up logging messages; remove default ref links 
(#4059)
8c3edbb is described below

commit 8c3edbbe69297581fa81c61c1cc33a61694c3adf
Author: Akshay Rai <[email protected]>
AuthorDate: Wed Apr 3 10:18:06 2019 -0700

    [TE] Clean up logging messages; remove default ref links (#4059)
---
 thirdeye/thirdeye-frontend/app/utils/constants.js              |  4 ++--
 .../org/apache/pinot/thirdeye/anomaly/task/TaskDriver.java     |  6 +++---
 .../pinot/thirdeye/detection/DetectionPipelineScheduler.java   |  2 +-
 .../pinot/thirdeye/detection/alert/DetectionAlertJob.java      | 10 +++++-----
 .../thirdeye/detection/alert/DetectionAlertScheduler.java      |  8 +++++---
 .../thirdeye/detection/alert/DetectionAlertTaskRunner.java     |  2 +-
 .../detection/yaml/YamlDetectionAlertConfigTranslator.java     |  6 ++++--
 .../detection/yaml/YamlDetectionAlertConfigTranslatorTest.java |  2 +-
 8 files changed, 22 insertions(+), 18 deletions(-)

diff --git a/thirdeye/thirdeye-frontend/app/utils/constants.js 
b/thirdeye/thirdeye-frontend/app/utils/constants.js
index 454d4a6..afbc378 100644
--- a/thirdeye/thirdeye-frontend/app/utils/constants.js
+++ b/thirdeye/thirdeye-frontend/app/utils/constants.js
@@ -71,8 +71,8 @@ active: true
 
 # The below links will appear in the email alerts. This will help alert 
recipients to quickly refer and act on.
 referenceLinks:
-- "Oncall Runbook": "http://go/oncall";
-- "Thirdeye FAQs": "http://go/thirdeyefaqs";
+  "Oncall Runbook": "http://go/oncall";
+  "Thirdeye FAQs": "http://go/thirdeyefaqs";
 
 `;
 
diff --git 
a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/anomaly/task/TaskDriver.java
 
b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/anomaly/task/TaskDriver.java
index 73672b3..8273437 100644
--- 
a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/anomaly/task/TaskDriver.java
+++ 
b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/anomaly/task/TaskDriver.java
@@ -95,7 +95,7 @@ public class TaskDriver {
               ThirdeyeMetricsUtil.taskCounter.inc();
 
               try {
-                LOG.info("Thread {} : Executing task: {} {}", 
Thread.currentThread().getId(), anomalyTaskSpec.getId(),
+                LOG.info("Thread {} : Executing task: {} {}", 
Thread.currentThread().getId(), anomalyTaskSpec.getJobName(),
                     anomalyTaskSpec.getTaskInfo());
 
                 // execute the selected task
@@ -104,7 +104,6 @@ public class TaskDriver {
                 TaskInfo taskInfo = 
TaskInfoFactory.getTaskInfoFromTaskType(taskType, 
anomalyTaskSpec.getTaskInfo());
 
                 updateTaskStartTime(anomalyTaskSpec.getId());
-                LOG.info("Thread {} : Task Info {}", 
Thread.currentThread().getId(), taskInfo);
                 List<TaskResult> taskResults = taskRunner.execute(taskInfo, 
taskContext);
                 LOG.info("Thread {} : DONE Executing task: {}", 
Thread.currentThread().getId(), anomalyTaskSpec.getId());
                 // update status to COMPLETED
@@ -125,7 +124,8 @@ public class TaskDriver {
 
               } finally {
                 long elapsedTime = System.nanoTime() - tStart;
-                LOG.info("Thread {} : Took {} nano seconds", 
Thread.currentThread().getId(), elapsedTime);
+                LOG.info("Thread {} : Task {} took {} nano seconds", 
Thread.currentThread().getId(),
+                    anomalyTaskSpec.getId(), elapsedTime);
                 ThirdeyeMetricsUtil.taskDurationCounter.inc(elapsedTime);
               }
             }
diff --git 
a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/DetectionPipelineScheduler.java
 
b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/DetectionPipelineScheduler.java
index 3114d53..5ac9f2c 100644
--- 
a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/DetectionPipelineScheduler.java
+++ 
b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/DetectionPipelineScheduler.java
@@ -82,7 +82,7 @@ public class DetectionPipelineScheduler implements Runnable {
 
         try {
           if (scheduler.checkExists(key)) {
-            LOG.info("Detection config  " + key + " is already scheduled.");
+            LOG.info("Detection config  " + key.getName() + " is already 
scheduled");
             if (jobUpdated(config, key)) {
               // restart job
               stopJob(key);
diff --git 
a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/alert/DetectionAlertJob.java
 
b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/alert/DetectionAlertJob.java
index f0b448e..bf89932 100644
--- 
a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/alert/DetectionAlertJob.java
+++ 
b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/alert/DetectionAlertJob.java
@@ -53,12 +53,12 @@ public class DetectionAlertJob implements Job {
 
   @Override
   public void execute(JobExecutionContext jobExecutionContext) throws 
JobExecutionException {
-    LOG.info("Running " + 
jobExecutionContext.getJobDetail().getKey().toString());
+    LOG.debug("Running " + 
jobExecutionContext.getJobDetail().getKey().getName());
     String jobKey = jobExecutionContext.getJobDetail().getKey().getName();
     long detectionAlertConfigId = getIdFromJobKey(jobKey);
     DetectionAlertConfigDTO configDTO = 
alertConfigDAO.findById(detectionAlertConfigId);
     if (configDTO == null) {
-      LOG.error("Alert config with id {} does not exist", 
detectionAlertConfigId);
+      LOG.error("Subscription config {} does not exist", 
detectionAlertConfigId);
     }
 
     DetectionAlertTaskInfo taskInfo = new 
DetectionAlertTaskInfo(detectionAlertConfigId);
@@ -72,12 +72,12 @@ public class DetectionAlertJob implements Job {
             Predicate.EQ("status", TaskConstants.TaskStatus.WAITING.toString())
         ))
     );
-
     if (!scheduledTasks.isEmpty()){
       // if a task is pending and not time out yet, don't schedule more
-      LOG.info("Skip scheduling detection alerter task for {}. Task is already 
in the queue.", jobName);
+      LOG.info("Skip scheduling subscription task {}. Already queued.", 
jobName);
       return;
     }
+
     String taskInfoJson = null;
     try {
       taskInfoJson = OBJECT_MAPPER.writeValueAsString(taskInfo);
@@ -92,7 +92,7 @@ public class DetectionAlertJob implements Job {
     taskDTO.setTaskInfo(taskInfoJson);
 
     long taskId = taskDAO.save(taskDTO);
-    LOG.info("Created detection pipeline task {} with taskId {}", taskDTO, 
taskId);
+    LOG.info("Created subscription task {} with settings {}", taskId, taskDTO);
   }
 
   private Long getIdFromJobKey(String jobKey) {
diff --git 
a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/alert/DetectionAlertScheduler.java
 
b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/alert/DetectionAlertScheduler.java
index a95f057..6554a7a 100644
--- 
a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/alert/DetectionAlertScheduler.java
+++ 
b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/alert/DetectionAlertScheduler.java
@@ -19,6 +19,7 @@
 
 package org.apache.pinot.thirdeye.detection.alert;
 
+import java.util.stream.Collectors;
 import org.apache.pinot.thirdeye.anomaly.alert.v2.AlertJobSchedulerV2;
 import org.apache.pinot.thirdeye.anomaly.task.TaskConstants;
 import org.apache.pinot.thirdeye.anomaly.utils.AnomalyUtils;
@@ -42,6 +43,7 @@ import org.quartz.Trigger;
 import org.quartz.TriggerBuilder;
 import org.quartz.impl.StdSchedulerFactory;
 import org.quartz.impl.matchers.GroupMatcher;
+import org.quartz.utils.Key;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -90,12 +92,12 @@ public class DetectionAlertScheduler implements Runnable {
   public void run() {
     try {
       // read all alert configs
-      LOG.info("Reading all alert configs..");
+      LOG.info("Scheduling all the subscription configs");
       List<DetectionAlertConfigDTO> alertConfigs = alertConfigDAO.findAll();
 
       // get active jobs
       Set<JobKey> scheduledJobs = getScheduledJobs();
-      LOG.info("Scheduled jobs {}", scheduledJobs);
+      LOG.info("Scheduled jobs {}", 
scheduledJobs.stream().map(Key::getName).collect(Collectors.toList()));
 
       for (DetectionAlertConfigDTO alertConfig : alertConfigs) {
         try {
@@ -144,7 +146,7 @@ public class DetectionAlertScheduler implements Runnable {
         
TriggerBuilder.newTrigger().withSchedule(CronScheduleBuilder.cronSchedule(config.getCronExpression())).build();
     JobDetail job = 
JobBuilder.newJob(DetectionAlertJob.class).withIdentity(key).build();
     this.scheduler.scheduleJob(job, trigger);
-    LOG.info(String.format("scheduled detection pipeline job %s.", 
key.getName()));
+    LOG.info(String.format("scheduled detection pipeline job %s", 
key.getName()));
   }
 
   private void createOrUpdateAlertJob(Set<JobKey> scheduledJobs, 
DetectionAlertConfigDTO alertConfig)
diff --git 
a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/alert/DetectionAlertTaskRunner.java
 
b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/alert/DetectionAlertTaskRunner.java
index 20d9d2b..b4fba8f 100644
--- 
a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/alert/DetectionAlertTaskRunner.java
+++ 
b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/alert/DetectionAlertTaskRunner.java
@@ -91,7 +91,7 @@ public class DetectionAlertTaskRunner implements TaskRunner {
         AlertUtils.makeVectorClock(result.getAllAnomalies()))
     );
 
-    LOG.info("Saving watermarks for alertConfigDAO : {}", 
alertConfig.toString());
+    LOG.info("Updating watermarks for alertConfigDAO : {}", 
alertConfig.getId());
     this.alertConfigDAO.save(alertConfig);
   }
 
diff --git 
a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/yaml/YamlDetectionAlertConfigTranslator.java
 
b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/yaml/YamlDetectionAlertConfigTranslator.java
index ba3eede..9d36de9 100644
--- 
a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/yaml/YamlDetectionAlertConfigTranslator.java
+++ 
b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/yaml/YamlDetectionAlertConfigTranslator.java
@@ -182,8 +182,10 @@ public class YamlDetectionAlertConfigTranslator {
       refLinks = new HashMap<>();
       yamlAlertConfig.put(PROP_REFERENCE_LINKS, refLinks);
     }
-    refLinks.put("ThirdEye User Guide", "https://go/thirdeyeuserguide";);
-    refLinks.put("Add Reference Links", "https://go/thirdeyealertreflink";);
+    if (refLinks.isEmpty()) {
+      refLinks.put("ThirdEye User Guide", "https://go/thirdeyeuserguide";);
+      refLinks.put("Add Reference Links", "https://go/thirdeyealertreflink";);
+    }
     alertConfigDTO.setReferenceLinks(MapUtils.getMap(yamlAlertConfig, 
PROP_REFERENCE_LINKS));
 
     alertConfigDTO.setAlertSchemes(buildAlertSchemes(yamlAlertConfig));
diff --git 
a/thirdeye/thirdeye-pinot/src/test/java/org/apache/pinot/thirdeye/detection/yaml/YamlDetectionAlertConfigTranslatorTest.java
 
b/thirdeye/thirdeye-pinot/src/test/java/org/apache/pinot/thirdeye/detection/yaml/YamlDetectionAlertConfigTranslatorTest.java
index 08f089d..e9eb0b0 100644
--- 
a/thirdeye/thirdeye-pinot/src/test/java/org/apache/pinot/thirdeye/detection/yaml/YamlDetectionAlertConfigTranslatorTest.java
+++ 
b/thirdeye/thirdeye-pinot/src/test/java/org/apache/pinot/thirdeye/detection/yaml/YamlDetectionAlertConfigTranslatorTest.java
@@ -74,7 +74,7 @@ public class YamlDetectionAlertConfigTranslatorTest {
     Assert.assertEquals(alertConfig.getFrom(), "thirdeye@thirdeye");
     Assert.assertEquals(alertConfig.getCronExpression(), "0 0/5 * * * ? *");
     Assert.assertEquals(alertConfig.getSubjectType(), 
AlertConfigBean.SubjectType.METRICS);
-    Assert.assertEquals(alertConfig.getReferenceLinks().size(), 3);
+    Assert.assertEquals(alertConfig.getReferenceLinks().size(), 1);
     Assert.assertEquals(alertConfig.getReferenceLinks().get("Test Link"), 
"test_url");
 
     Assert.assertEquals(alertConfig.getAlertSchemes().size(), 1);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to