You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kylin.apache.org by GitBox <gi...@apache.org> on 2021/03/02 11:50:45 UTC

[GitHub] [kylin] chenjie-sau opened a new pull request #1596: [KYLIN-4780] support dingtalk notify

chenjie-sau opened a new pull request #1596:
URL: https://github.com/apache/kylin/pull/1596


   ## Proposed changes
   
   Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request. If it fixes a bug or resolves a feature request, be sure to link to that issue.
   
   ## Types of changes
   
   What types of changes does your code introduce to Kylin?
   _Put an `x` in the boxes that apply_
   
   - [ ] Bugfix (non-breaking change which fixes an issue)
   - [ ] New feature (non-breaking change which adds functionality)
   - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
   - [ ] Documentation Update (if none of the other choices apply)
   
   ## Checklist
   
   _Put an `x` in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code._
   
   - [ ] I have create an issue on [Kylin's jira](https://issues.apache.org/jira/browse/KYLIN), and have described the bug/feature there in detail
   - [ ] Commit messages in my PR start with the related jira ID, like "KYLIN-0000 Make Kylin project open-source"
   - [ ] Compiling and unit tests pass locally with my changes
   - [ ] I have added tests that prove my fix is effective or that my feature works
   - [ ] If this change need a document change, I will prepare another pr against the `document` branch
   - [ ] Any dependent changes have been merged
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at user@kylin or dev@kylin by explaining why you chose the solution you did and what alternatives you considered, etc...
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kylin] yanghua commented on a change in pull request #1596: [KYLIN-4780] support dingtalk notify

Posted by GitBox <gi...@apache.org>.
yanghua commented on a change in pull request #1596:
URL: https://github.com/apache/kylin/pull/1596#discussion_r612261129



##########
File path: core-job/src/main/java/org/apache/kylin/job/execution/AbstractExecutable.java
##########
@@ -311,76 +317,59 @@ public final void setSubmitter(String submitter) {
         setParam(SUBMITTER, submitter);
     }
 
-    public final List<String> getNotifyList() {
-        final String str = getParam(NOTIFY_LIST);
+    public final List<String> getNotificationList(String key) {
+        final String str = getParam(key);
         if (str != null) {
             return Lists.newArrayList(StringUtils.split(str, ","));
         } else {
             return Collections.emptyList();
         }
     }
 
-    public final void setNotifyList(String notifications) {
-        setParam(NOTIFY_LIST, notifications);
+    public final void setNotificationList(String key, String notifications) {
+        setParam(key, notifications);
     }
 
-    public final void setNotifyList(List<String> notifications) {
-        setNotifyList(StringUtils.join(notifications, ","));
+    public final void setNotificationList(String key, List<String> notifications) {
+        setNotificationList(key, StringUtils.join(notifications, ","));
     }
 
-    protected Pair<String, String> formatNotifications(ExecutableContext executableContext, ExecutableState state) {
+    protected Pair<String[], Map<String, Object>>  formatNotifications(ExecutableContext executableContext, ExecutableState state) {
         return null;
     }
 
     protected final void notifyUserStatusChange(ExecutableContext context, ExecutableState state) {
         try {
-            List<String> users = getAllNofifyUsers(config);
+            Map<String, List<String>> users = getAllNofificationUsers(config);
             if (users.isEmpty()) {
                 logger.debug(NO_NEED_TO_SEND_EMAIL_USER_LIST_IS_EMPTY);
                 return;
             }
-            final Pair<String, String> email = formatNotifications(context, state);
-            doSendMail(config, users, email);
+            final Pair<String[], Map<String, Object>> notification = formatNotifications(context, state);
+            doSendNotification(config, users, state.name(), notification);
         } catch (Exception e) {
-            logger.error("error send email", e);
+            logger.error("error send notification", e);
         }
     }
 
-    private List<String> getAllNofifyUsers(KylinConfig kylinConfig) {
-        List<String> users = Lists.newArrayList();
-        users.addAll(getNotifyList());
+    private Map<String, List<String>> getAllNofificationUsers(KylinConfig kylinConfig) {
+        Map<String, List<String>> users = Maps.newHashMap();
+        users.put(NotificationConstants.NOTIFY_EMAIL_LIST, getNotificationList(NotificationConstants.NOTIFY_EMAIL_LIST));
+        users.put(NotificationConstants.NOTIFY_DINGTALK_LIST, getNotificationList(NotificationConstants.NOTIFY_DINGTALK_LIST));
         final String[] adminDls = kylinConfig.getAdminDls();
         if (null != adminDls) {
             for (String adminDl : adminDls) {
-                users.add(adminDl);
+                users.get(NotificationConstants.NOTIFY_EMAIL_LIST).add(adminDl);
             }
         }
         return users;
     }
 
-    private void doSendMail(KylinConfig kylinConfig, List<String> users, Pair<String, String> email) {
-        if (email == null) {
-            logger.warn("no need to send email, content is null");
-            return;
-        }
-        logger.info("prepare to send email to:{}", users);
+    private void doSendNotification(KylinConfig kylinConfig, Map<String, List<String>> receivers, String state, Pair<String[], Map<String, Object>> content) {

Review comment:
       too long...

##########
File path: core-common/src/main/java/org/apache/kylin/common/notify/NotificationContext.java
##########
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.kylin.common.notify;
+
+import org.apache.kylin.common.KylinConfig;
+import org.apache.kylin.common.util.Pair;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * All basic information of the notification.
+ */
+public class NotificationContext {
+    private KylinConfig config;
+
+    /**
+     * Notification recipient,include email and dingTalk
+     */
+    private Map<String, List<String>> receivers;
+
+    /**
+     * state of job
+     */
+    private String state;
+
+    /**
+     * content of notification, include title and detail
+     */
+    private Pair<String[], Map<String, Object>> content;
+
+    /**
+     * Send in HTML
+     */
+    private boolean isHtmlMsg = true;
+
+    /**
+     * when isHtmlMsg is false, subject and info will be sended as text
+     */
+    private String subject = "";
+
+    private String info = "";
+
+    public NotificationContext(KylinConfig config, Map<String, List<String>> receivers, String state, Pair<String[], Map<String, Object>> content) {
+        this.config = config;
+        this.receivers = receivers;
+        this.state = state;
+        this.content = content;
+    }
+
+    public NotificationContext(KylinConfig config, Map<String, List<String>> receivers, String subject, String info, boolean isHtmlMsg) {
+        this.config = config;
+        this.receivers = receivers;
+        this.subject = subject;
+        this.info = info;
+        this.isHtmlMsg = isHtmlMsg;
+    }
+
+    public KylinConfig getConfig() {
+        return config;
+    }
+
+    public void setConfig(KylinConfig config) {

Review comment:
       If we inject the property via constructors, we can remove these `setter`.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kylin] hit-lacus commented on pull request #1596: [KYLIN-4780] Support dingtalk notify

Posted by GitBox <gi...@apache.org>.
hit-lacus commented on pull request #1596:
URL: https://github.com/apache/kylin/pull/1596#issuecomment-828891154


     I wish this patch could be well designed for extensible purpose, and a **notification framework** should be developed from my side. 
     So, if other guys want to add support for We-chat or Slack, it should be very easy because he/her should only provided some implementation depend on this **notification framework** .


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kylin] chenjie-sau commented on a change in pull request #1596: [KYLIN-4780] support dingtalk notify

Posted by GitBox <gi...@apache.org>.
chenjie-sau commented on a change in pull request #1596:
URL: https://github.com/apache/kylin/pull/1596#discussion_r587421975



##########
File path: core-common/src/main/java/org/apache/kylin/common/KylinConfigBase.java
##########
@@ -933,7 +933,7 @@ public String getHiveDependencyFilterList() {
                 + "[^,]*hive-metastore[^,]*?\\.jar" + "|" + "[^,]*hive-hcatalog-core[^,]*?\\.jar");
     }
 
-    public boolean isMailEnabled() {
+    public boolean isNotifyEnabled() {

Review comment:
       notification is a noun, notify is a verb, I think it’s better to use verbs here, What do you think




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kylin] lgtm-com[bot] commented on pull request #1596: [KYLIN-4780] support dingtalk notify

Posted by GitBox <gi...@apache.org>.
lgtm-com[bot] commented on pull request #1596:
URL: https://github.com/apache/kylin/pull/1596#issuecomment-791206206


   This pull request **introduces 3 alerts** when merging 41f2c01d9b2e3669768e6660266ccf6308befeb5 into 9d7ee863304220c5fb53a4c88cb798ed3edb0891 - [view on LGTM.com](https://lgtm.com/projects/g/apache/kylin/rev/pr-64cfab64df1376b39cacc49a8e41d89ae5dacdcf)
   
   **new alerts:**
   
   * 3 for Dereferenced variable may be null


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kylin] lgtm-com[bot] commented on pull request #1596: [KYLIN-4780] Support dingtalk notify

Posted by GitBox <gi...@apache.org>.
lgtm-com[bot] commented on pull request #1596:
URL: https://github.com/apache/kylin/pull/1596#issuecomment-818858759


   This pull request **introduces 3 alerts** when merging 77656aa2edfe2c600c7a8df29983c33ca00b8a21 into 69368b08a770f6e54c4ecf43c538331e13cb03b2 - [view on LGTM.com](https://lgtm.com/projects/g/apache/kylin/rev/pr-a74e7c0552a8d3f18d2a79eb9eec72743bf873fe)
   
   **new alerts:**
   
   * 3 for Dereferenced variable may be null


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kylin] coveralls edited a comment on pull request #1596: [KYLIN-4780] Support dingtalk notify

Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #1596:
URL: https://github.com/apache/kylin/pull/1596#issuecomment-791204373


   ## Pull Request Test Coverage Report for [Build 7065](https://coveralls.io/builds/38770165)
   
   * **57** of **333**   **(17.12%)**  changed or added relevant lines in **20** files are covered.
   * **35** unchanged lines in **10** files lost coverage.
   * Overall coverage decreased (**-0.02%**) to **28.073%**
   
   ---
   
   |  Changes Missing Coverage | Covered Lines | Changed/Added Lines | % |
   | :-----|--------------|--------|---: |
   | [core-common/src/main/java/org/apache/kylin/common/notify/util/NotificationConstants.java](https://coveralls.io/builds/38770165/source?filename=core-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fcommon%2Fnotify%2Futil%2FNotificationConstants.java#L21) | 0 | 1 | 0.0%
   | [engine-mr/src/main/java/org/apache/kylin/engine/mr/LookupSnapshotBuildJob.java](https://coveralls.io/builds/38770165/source?filename=engine-mr%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fengine%2Fmr%2FLookupSnapshotBuildJob.java#L69) | 0 | 2 | 0.0%
   | [server-base/src/main/java/org/apache/kylin/rest/constant/NotifyType.java](https://coveralls.io/builds/38770165/source?filename=server-base%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fconstant%2FNotifyType.java#L21) | 0 | 2 | 0.0%
   | [core-cube/src/main/java/org/apache/kylin/cube/model/CubeDesc.java](https://coveralls.io/builds/38770165/source?filename=core-cube%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fcube%2Fmodel%2FCubeDesc.java#L537) | 10 | 13 | 76.92%
   | [core-common/src/main/java/org/apache/kylin/common/notify/util/SecretKeyUtil.java](https://coveralls.io/builds/38770165/source?filename=core-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fcommon%2Fnotify%2Futil%2FSecretKeyUtil.java#L30) | 8 | 12 | 66.67%
   | [core-common/src/main/java/org/apache/kylin/common/notify/NotifyServiceBase.java](https://coveralls.io/builds/38770165/source?filename=core-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fcommon%2Fnotify%2FNotifyServiceBase.java#L31) | 0 | 5 | 0.0%
   | [core-common/src/main/java/org/apache/kylin/common/notify/util/DingTalkNotificationUtil.java](https://coveralls.io/builds/38770165/source?filename=core-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fcommon%2Fnotify%2Futil%2FDingTalkNotificationUtil.java#L26) | 12 | 17 | 70.59%
   | [server-base/src/main/java/org/apache/kylin/rest/job/KylinHealthCheckJob.java](https://coveralls.io/builds/38770165/source?filename=server-base%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fjob%2FKylinHealthCheckJob.java#L140) | 0 | 5 | 0.0%
   | [cube-migration/src/main/java/org/apache/kylin/rest/service/MigrationRuleSet.java](https://coveralls.io/builds/38770165/source?filename=cube-migration%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fservice%2FMigrationRuleSet.java#L84) | 0 | 6 | 0.0%
   | [server-base/src/main/java/org/apache/kylin/rest/service/CubeService.java](https://coveralls.io/builds/38770165/source?filename=server-base%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fservice%2FCubeService.java#L582) | 0 | 6 | 0.0%
   <!-- | **Total:** | **57** | **333** | **17.12%** | -->
   
   |  Files with Coverage Reduction | New Missed Lines | % |
   | :-----|--------------|--: |
   | [cube-migration/src/main/java/org/apache/kylin/rest/service/MigrationService.java](https://coveralls.io/builds/38770165/source?filename=cube-migration%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fservice%2FMigrationService.java#L236) | 1 | 0% |
   | [engine-mr/src/main/java/org/apache/kylin/engine/mr/CubingJob.java](https://coveralls.io/builds/38770165/source?filename=engine-mr%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fengine%2Fmr%2FCubingJob.java#L167) | 1 | 1.48% |
   | [engine-mr/src/main/java/org/apache/kylin/engine/mr/LookupSnapshotBuildJob.java](https://coveralls.io/builds/38770165/source?filename=engine-mr%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fengine%2Fmr%2FLookupSnapshotBuildJob.java#L71) | 1 | 0% |
   | [server-base/src/main/java/org/apache/kylin/rest/job/KylinHealthCheckJob.java](https://coveralls.io/builds/38770165/source?filename=server-base%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fjob%2FKylinHealthCheckJob.java#L143) | 1 | 0% |
   | [stream-core/src/main/java/org/apache/kylin/stream/core/storage/columnar/GeneralColumnDataReader.java](https://coveralls.io/builds/38770165/source?filename=stream-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fstream%2Fcore%2Fstorage%2Fcolumnar%2FGeneralColumnDataReader.java#L43) | 1 | 92.11% |
   | [cube-migration/src/main/java/org/apache/kylin/rest/service/MigrationRuleSet.java](https://coveralls.io/builds/38770165/source?filename=cube-migration%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fservice%2FMigrationRuleSet.java#L216) | 2 | 0% |
   | [tool/src/main/java/org/apache/kylin/tool/query/ProbabilityGenerator.java](https://coveralls.io/builds/38770165/source?filename=tool%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Ftool%2Fquery%2FProbabilityGenerator.java#L51) | 2 | 76.32% |
   | [core-cube/src/main/java/org/apache/kylin/cube/inmemcubing/MemDiskStore.java](https://coveralls.io/builds/38770165/source?filename=core-cube%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fcube%2Finmemcubing%2FMemDiskStore.java#L439) | 5 | 77.81% |
   | [core-job/src/main/java/org/apache/kylin/job/execution/AbstractExecutable.java](https://coveralls.io/builds/38770165/source?filename=core-job%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fjob%2Fexecution%2FAbstractExecutable.java#L240) | 5 | 61.18% |
   | [engine-spark/src/main/java/org/apache/kylin/engine/spark/SparkCubingByLayer.java](https://coveralls.io/builds/38770165/source?filename=engine-spark%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fengine%2Fspark%2FSparkCubingByLayer.java#L531) | 16 | 0% |
   <!-- | **Total:** | **35** |  | -->
   
   |  Totals | [![Coverage Status](https://coveralls.io/builds/38770165/badge)](https://coveralls.io/builds/38770165) |
   | :-- | --: |
   | Change from base [Build 7032](https://coveralls.io/builds/38574273): |  -0.02% |
   | Covered Lines: | 26752 |
   | Relevant Lines: | 95296 |
   
   ---
   ##### 💛  - [Coveralls](https://coveralls.io)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kylin] coveralls edited a comment on pull request #1596: [KYLIN-4780] support dingtalk notify

Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #1596:
URL: https://github.com/apache/kylin/pull/1596#issuecomment-791204373


   ## Pull Request Test Coverage Report for [Build 7008](https://coveralls.io/builds/38321943)
   
   * **55** of **322**   **(17.08%)**  changed or added relevant lines in **21** files are covered.
   * **1106** unchanged lines in **27** files lost coverage.
   * Overall coverage increased (+**0.2%**) to **28.108%**
   
   ---
   
   |  Changes Missing Coverage | Covered Lines | Changed/Added Lines | % |
   | :-----|--------------|--------|---: |
   | [core-common/src/main/java/org/apache/kylin/common/notify/util/DingTalkNotificationUtil.java](https://coveralls.io/builds/38321943/source?filename=core-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fcommon%2Fnotify%2Futil%2FDingTalkNotificationUtil.java#L25) | 3 | 4 | 75.0%
   | [core-common/src/main/java/org/apache/kylin/common/notify/util/NotificationConstants.java](https://coveralls.io/builds/38321943/source?filename=core-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fcommon%2Fnotify%2Futil%2FNotificationConstants.java#L21) | 0 | 1 | 0.0%
   | [engine-mr/src/main/java/org/apache/kylin/engine/mr/LookupSnapshotBuildJob.java](https://coveralls.io/builds/38321943/source?filename=engine-mr%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fengine%2Fmr%2FLookupSnapshotBuildJob.java#L69) | 0 | 2 | 0.0%
   | [server-base/src/main/java/org/apache/kylin/rest/constant/NotifyType.java](https://coveralls.io/builds/38321943/source?filename=server-base%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fconstant%2FNotifyType.java#L21) | 0 | 2 | 0.0%
   | [core-cube/src/main/java/org/apache/kylin/cube/model/CubeDesc.java](https://coveralls.io/builds/38321943/source?filename=core-cube%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fcube%2Fmodel%2FCubeDesc.java#L536) | 10 | 13 | 76.92%
   | [core-common/src/main/java/org/apache/kylin/common/notify/util/DingTalkTemplateProvider.java](https://coveralls.io/builds/38321943/source?filename=core-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fcommon%2Fnotify%2Futil%2FDingTalkTemplateProvider.java#L50) | 12 | 16 | 75.0%
   | [core-common/src/main/java/org/apache/kylin/common/notify/util/SecretKeyUtil.java](https://coveralls.io/builds/38321943/source?filename=core-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fcommon%2Fnotify%2Futil%2FSecretKeyUtil.java#L30) | 8 | 12 | 66.67%
   | [core-common/src/main/java/org/apache/kylin/common/notify/NotifyServiceBase.java](https://coveralls.io/builds/38321943/source?filename=core-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fcommon%2Fnotify%2FNotifyServiceBase.java#L31) | 0 | 5 | 0.0%
   | [server-base/src/main/java/org/apache/kylin/rest/job/KylinHealthCheckJob.java](https://coveralls.io/builds/38321943/source?filename=server-base%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fjob%2FKylinHealthCheckJob.java#L140) | 0 | 5 | 0.0%
   | [cube-migration/src/main/java/org/apache/kylin/rest/service/MigrationRuleSet.java](https://coveralls.io/builds/38321943/source?filename=cube-migration%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fservice%2FMigrationRuleSet.java#L84) | 0 | 6 | 0.0%
   <!-- | **Total:** | **55** | **322** | **17.08%** | -->
   
   |  Files with Coverage Reduction | New Missed Lines | % |
   | :-----|--------------|--: |
   | [cube-migration/src/main/java/org/apache/kylin/rest/service/MigrationService.java](https://coveralls.io/builds/38321943/source?filename=cube-migration%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fservice%2FMigrationService.java#L236) | 1 | 0% |
   | [engine-mr/src/main/java/org/apache/kylin/engine/mr/CubingJob.java](https://coveralls.io/builds/38321943/source?filename=engine-mr%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fengine%2Fmr%2FCubingJob.java#L167) | 1 | 1.48% |
   | [engine-mr/src/main/java/org/apache/kylin/engine/mr/LookupSnapshotBuildJob.java](https://coveralls.io/builds/38321943/source?filename=engine-mr%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fengine%2Fmr%2FLookupSnapshotBuildJob.java#L71) | 1 | 0% |
   | [server-base/src/main/java/org/apache/kylin/rest/job/KylinHealthCheckJob.java](https://coveralls.io/builds/38321943/source?filename=server-base%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fjob%2FKylinHealthCheckJob.java#L143) | 1 | 0% |
   | [core-job/src/main/java/org/apache/kylin/job/impl/threadpool/DefaultScheduler.java](https://coveralls.io/builds/38321943/source?filename=core-job%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fjob%2Fimpl%2Fthreadpool%2FDefaultScheduler.java#L193) | 2 | 79.07% |
   | [cube-migration/src/main/java/org/apache/kylin/rest/service/MigrationRuleSet.java](https://coveralls.io/builds/38321943/source?filename=cube-migration%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fservice%2FMigrationRuleSet.java#L216) | 2 | 0% |
   | [stream-core/src/main/java/org/apache/kylin/stream/core/storage/CheckPointStore.java](https://coveralls.io/builds/38321943/source?filename=stream-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fstream%2Fcore%2Fstorage%2FCheckPointStore.java#L98) | 2 | 73.74% |
   | [tool/src/main/java/org/apache/kylin/tool/query/ProbabilityGenerator.java](https://coveralls.io/builds/38321943/source?filename=tool%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Ftool%2Fquery%2FProbabilityGenerator.java#L42) | 3 | 76.32% |
   | [core-job/src/main/java/org/apache/kylin/job/execution/AbstractExecutable.java](https://coveralls.io/builds/38321943/source?filename=core-job%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fjob%2Fexecution%2FAbstractExecutable.java#L233) | 5 | 61.54% |
   | [stream-source-kafka/src/main/java/org/apache/kylin/stream/source/kafka/TimedJsonStreamParser.java](https://coveralls.io/builds/38321943/source?filename=stream-source-kafka%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fstream%2Fsource%2Fkafka%2FTimedJsonStreamParser.java#L157) | 9 | 76.09% |
   <!-- | **Total:** | **1106** |  | -->
   
   |  Totals | [![Coverage Status](https://coveralls.io/builds/38321943/badge)](https://coveralls.io/builds/38321943) |
   | :-- | --: |
   | Change from base [Build 6921](https://coveralls.io/builds/37585214): |  0.2% |
   | Covered Lines: | 26748 |
   | Relevant Lines: | 95161 |
   
   ---
   ##### 💛  - [Coveralls](https://coveralls.io)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kylin] lgtm-com[bot] commented on pull request #1596: [KYLIN-4780] support dingtalk notify

Posted by GitBox <gi...@apache.org>.
lgtm-com[bot] commented on pull request #1596:
URL: https://github.com/apache/kylin/pull/1596#issuecomment-809049765


   This pull request **introduces 3 alerts** when merging 439fb975937b9ab420cb66446f40f8b72758af23 into 5be135c61c80b9241ac7632dec41cc7209b9d23a - [view on LGTM.com](https://lgtm.com/projects/g/apache/kylin/rev/pr-5bcc02bae5a777344622193c229c2bbd00a33813)
   
   **new alerts:**
   
   * 3 for Dereferenced variable may be null


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kylin] chenjie-sau commented on pull request #1596: [KYLIN-4780] support dingtalk notify

Posted by GitBox <gi...@apache.org>.
chenjie-sau commented on pull request #1596:
URL: https://github.com/apache/kylin/pull/1596#issuecomment-788934131


   Hi @yanghua could you please take a look when free


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kylin] yanghua commented on a change in pull request #1596: [KYLIN-4780] support dingtalk notify

Posted by GitBox <gi...@apache.org>.
yanghua commented on a change in pull request #1596:
URL: https://github.com/apache/kylin/pull/1596#discussion_r587396384



##########
File path: core-common/src/main/java/org/apache/kylin/common/KylinConfigBase.java
##########
@@ -933,7 +933,7 @@ public String getHiveDependencyFilterList() {
                 + "[^,]*hive-metastore[^,]*?\\.jar" + "|" + "[^,]*hive-hcatalog-core[^,]*?\\.jar");
     }
 
-    public boolean isMailEnabled() {
+    public boolean isNotifyEnabled() {

Review comment:
       IMO, `isNotificationEnabled` looks better?

##########
File path: core-common/src/main/java/org/apache/kylin/common/notify/MailService.java
##########
@@ -40,8 +42,9 @@
     private String password;
     private String sender;
 
+

Review comment:
       Revert these changes.

##########
File path: core-common/src/main/java/org/apache/kylin/common/notify/MailService.java
##########
@@ -6,30 +6,32 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 

Review comment:
       Please do not change the unnecessary lines.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kylin] shaofengshi commented on pull request #1596: [KYLIN-4780] Support dingtalk notify

Posted by GitBox <gi...@apache.org>.
shaofengshi commented on pull request #1596:
URL: https://github.com/apache/kylin/pull/1596#issuecomment-828909043


   Hello chenjie @chenjie-sau ,
   
   Thanks for raising this PR! 
   
   I think this is a good feature, but for the implementation, it can be improved a little bit. Firstly, the dingding sdk's license is unknown, so it is not okya for Kylin to bundle it in the release. Secondly, the notification module can be designed as pluggable. For example, user can implement an interface and then config the implementation class in kylin.properties. Kylin then will load the class at runtime by name, and then send the notification. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kylin] lgtm-com[bot] commented on pull request #1596: [KYLIN-4780] support dingtalk notify

Posted by GitBox <gi...@apache.org>.
lgtm-com[bot] commented on pull request #1596:
URL: https://github.com/apache/kylin/pull/1596#issuecomment-818626226


   This pull request **introduces 3 alerts** when merging d84c139af8b97e6e360365bf3de1ade602300735 into 69368b08a770f6e54c4ecf43c538331e13cb03b2 - [view on LGTM.com](https://lgtm.com/projects/g/apache/kylin/rev/pr-8339c1ea84ce3123a9b109f78fdfa90db3d642db)
   
   **new alerts:**
   
   * 3 for Dereferenced variable may be null


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kylin] lgtm-com[bot] commented on pull request #1596: [KYLIN-4780] support dingtalk notify

Posted by GitBox <gi...@apache.org>.
lgtm-com[bot] commented on pull request #1596:
URL: https://github.com/apache/kylin/pull/1596#issuecomment-794913881


   This pull request **introduces 3 alerts** when merging 6440cda759b05e2325da1b8d33f6e311a2168ca1 into 3f3f114400e49cf8bd9ec48c888b253c81994f79 - [view on LGTM.com](https://lgtm.com/projects/g/apache/kylin/rev/pr-7bf3a5bd825570c0f62e117d25bb022780ec3939)
   
   **new alerts:**
   
   * 3 for Dereferenced variable may be null


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kylin] yanghua commented on pull request #1596: [KYLIN-4780] Support dingtalk notify

Posted by GitBox <gi...@apache.org>.
yanghua commented on pull request #1596:
URL: https://github.com/apache/kylin/pull/1596#issuecomment-820021671


   @zhangayqian Would you please review this PR?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kylin] codecov-io edited a comment on pull request #1596: [KYLIN-4780] Support dingtalk notify

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #1596:
URL: https://github.com/apache/kylin/pull/1596#issuecomment-799678944


   # [Codecov](https://codecov.io/gh/apache/kylin/pull/1596?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#1596](https://codecov.io/gh/apache/kylin/pull/1596?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (d84c139) into [master](https://codecov.io/gh/apache/kylin/commit/02500818d85955b1125340eaa19ab88a634a5181?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (0250081) will **decrease** coverage by `0.10%`.
   > The diff coverage is `10.01%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/kylin/pull/1596/graphs/tree.svg?width=650&height=150&src=pr&token=JawVgbgsVo&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/kylin/pull/1596?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #1596      +/-   ##
   ============================================
   - Coverage     25.42%   25.32%   -0.11%     
   - Complexity     6765     6774       +9     
   ============================================
     Files          1508     1516       +8     
     Lines         93918    94422     +504     
     Branches      13158    13233      +75     
   ============================================
   + Hits          23877    23910      +33     
   - Misses        67662    68126     +464     
   - Partials       2379     2386       +7     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/kylin/pull/1596?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | [.../java/org/apache/kylin/common/KylinConfigBase.java](https://codecov.io/gh/apache/kylin/pull/1596/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29yZS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2t5bGluL2NvbW1vbi9LeWxpbkNvbmZpZ0Jhc2UuamF2YQ==) | `12.42% <0.00%> (-0.05%)` | `51.00 <0.00> (ø)` | |
   | [...rg/apache/kylin/common/notify/DingTalkService.java](https://codecov.io/gh/apache/kylin/pull/1596/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29yZS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2t5bGluL2NvbW1vbi9ub3RpZnkvRGluZ1RhbGtTZXJ2aWNlLmphdmE=) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (?)` | |
   | [...va/org/apache/kylin/common/notify/MailService.java](https://codecov.io/gh/apache/kylin/pull/1596/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29yZS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2t5bGluL2NvbW1vbi9ub3RpZnkvTWFpbFNlcnZpY2UuamF2YQ==) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (?)` | |
   | [...pache/kylin/common/notify/NotificationContext.java](https://codecov.io/gh/apache/kylin/pull/1596/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29yZS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2t5bGluL2NvbW1vbi9ub3RpZnkvTm90aWZpY2F0aW9uQ29udGV4dC5qYXZh) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (?)` | |
   | [...e/kylin/common/notify/NotificationTransmitter.java](https://codecov.io/gh/apache/kylin/pull/1596/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29yZS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2t5bGluL2NvbW1vbi9ub3RpZnkvTm90aWZpY2F0aW9uVHJhbnNtaXR0ZXIuamF2YQ==) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (?)` | |
   | [.../apache/kylin/common/notify/NotifyServiceBase.java](https://codecov.io/gh/apache/kylin/pull/1596/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29yZS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2t5bGluL2NvbW1vbi9ub3RpZnkvTm90aWZ5U2VydmljZUJhc2UuamF2YQ==) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (?)` | |
   | [...ylin/common/notify/util/NotificationConstants.java](https://codecov.io/gh/apache/kylin/pull/1596/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29yZS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2t5bGluL2NvbW1vbi9ub3RpZnkvdXRpbC9Ob3RpZmljYXRpb25Db25zdGFudHMuamF2YQ==) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (?)` | |
   | [...in/java/org/apache/kylin/cube/CubeDescManager.java](https://codecov.io/gh/apache/kylin/pull/1596/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29yZS1jdWJlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9reWxpbi9jdWJlL0N1YmVEZXNjTWFuYWdlci5qYXZh) | `32.41% <0.00%> (-1.16%)` | `12.00 <0.00> (ø)` | |
   | [...c/main/java/org/apache/kylin/cube/CubeManager.java](https://codecov.io/gh/apache/kylin/pull/1596/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29yZS1jdWJlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9reWxpbi9jdWJlL0N1YmVNYW5hZ2VyLmphdmE=) | `35.83% <0.00%> (-0.81%)` | `44.00 <0.00> (ø)` | |
   | [...c/main/java/org/apache/kylin/cube/CubeSegment.java](https://codecov.io/gh/apache/kylin/pull/1596/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29yZS1jdWJlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9reWxpbi9jdWJlL0N1YmVTZWdtZW50LmphdmE=) | `41.97% <0.00%> (-0.31%)` | `65.00 <0.00> (ø)` | |
   | ... and [94 more](https://codecov.io/gh/apache/kylin/pull/1596/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/kylin/pull/1596?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/kylin/pull/1596?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [ca08012...d84c139](https://codecov.io/gh/apache/kylin/pull/1596?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kylin] chenjie-sau commented on pull request #1596: [KYLIN-4780] support dingtalk notify

Posted by GitBox <gi...@apache.org>.
chenjie-sau commented on pull request #1596:
URL: https://github.com/apache/kylin/pull/1596#issuecomment-793656572


   @yanghua The modification has been completed with reference to your suggestion, please review when you are free


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kylin] yanghua commented on a change in pull request #1596: [KYLIN-4780] support dingtalk notify

Posted by GitBox <gi...@apache.org>.
yanghua commented on a change in pull request #1596:
URL: https://github.com/apache/kylin/pull/1596#discussion_r595094580



##########
File path: core-common/src/main/java/org/apache/kylin/common/notify/util/NotificationConstants.java
##########
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.kylin.common.notify.util;
+
+public class NotificationConstants {
+    public static final String NOTIFY_EMAIL_LIST = "notify_email_list";
+    public static final String NOTIFY_DINGTALK_LIST = "notify_dingtalk_list";

Review comment:
       Can we use one constant(config option) to represent different services?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kylin] coveralls edited a comment on pull request #1596: [KYLIN-4780] support dingtalk notify

Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #1596:
URL: https://github.com/apache/kylin/pull/1596#issuecomment-791204373


   ## Pull Request Test Coverage Report for [Build 6972](https://coveralls.io/builds/37949501)
   
   * **62** of **342**   **(18.13%)**  changed or added relevant lines in **22** files are covered.
   * **258** unchanged lines in **13** files lost coverage.
   * Overall coverage increased (+**0.2%**) to **28.165%**
   
   ---
   
   |  Changes Missing Coverage | Covered Lines | Changed/Added Lines | % |
   | :-----|--------------|--------|---: |
   | [core-common/src/main/java/org/apache/kylin/common/notify/util/DingTalkNotificationUtil.java](https://coveralls.io/builds/37949501/source?filename=core-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fcommon%2Fnotify%2Futil%2FDingTalkNotificationUtil.java#L25) | 3 | 4 | 75.0%
   | [core-common/src/main/java/org/apache/kylin/common/notify/util/NotificationConstants.java](https://coveralls.io/builds/37949501/source?filename=core-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fcommon%2Fnotify%2Futil%2FNotificationConstants.java#L21) | 0 | 1 | 0.0%
   | [server-base/src/main/java/org/apache/kylin/rest/controller/StreamingV2Controller.java](https://coveralls.io/builds/37949501/source?filename=server-base%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fcontroller%2FStreamingV2Controller.java#L520) | 0 | 1 | 0.0%
   | [engine-mr/src/main/java/org/apache/kylin/engine/mr/LookupSnapshotBuildJob.java](https://coveralls.io/builds/37949501/source?filename=engine-mr%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fengine%2Fmr%2FLookupSnapshotBuildJob.java#L69) | 0 | 2 | 0.0%
   | [server-base/src/main/java/org/apache/kylin/rest/constant/NotifyType.java](https://coveralls.io/builds/37949501/source?filename=server-base%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fconstant%2FNotifyType.java#L21) | 0 | 2 | 0.0%
   | [core-cube/src/main/java/org/apache/kylin/cube/model/CubeDesc.java](https://coveralls.io/builds/37949501/source?filename=core-cube%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fcube%2Fmodel%2FCubeDesc.java#L536) | 10 | 13 | 76.92%
   | [core-common/src/main/java/org/apache/kylin/common/notify/util/DingTalkTemplateProvider.java](https://coveralls.io/builds/37949501/source?filename=core-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fcommon%2Fnotify%2Futil%2FDingTalkTemplateProvider.java#L55) | 19 | 23 | 82.61%
   | [core-common/src/main/java/org/apache/kylin/common/notify/util/SecretKeyUtil.java](https://coveralls.io/builds/37949501/source?filename=core-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fcommon%2Fnotify%2Futil%2FSecretKeyUtil.java#L30) | 8 | 12 | 66.67%
   | [cube-migration/src/main/java/org/apache/kylin/rest/service/MigrationRuleSet.java](https://coveralls.io/builds/37949501/source?filename=cube-migration%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fservice%2FMigrationRuleSet.java#L84) | 0 | 6 | 0.0%
   | [server-base/src/main/java/org/apache/kylin/rest/job/KylinHealthCheckJob.java](https://coveralls.io/builds/37949501/source?filename=server-base%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fjob%2FKylinHealthCheckJob.java#L141) | 0 | 6 | 0.0%
   <!-- | **Total:** | **62** | **342** | **18.13%** | -->
   
   |  Files with Coverage Reduction | New Missed Lines | % |
   | :-----|--------------|--: |
   | [cube-migration/src/main/java/org/apache/kylin/rest/service/MigrationService.java](https://coveralls.io/builds/37949501/source?filename=cube-migration%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fservice%2FMigrationService.java#L235) | 1 | 0% |
   | [engine-mr/src/main/java/org/apache/kylin/engine/mr/CubingJob.java](https://coveralls.io/builds/37949501/source?filename=engine-mr%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fengine%2Fmr%2FCubingJob.java#L166) | 1 | 1.47% |
   | [engine-mr/src/main/java/org/apache/kylin/engine/mr/LookupSnapshotBuildJob.java](https://coveralls.io/builds/37949501/source?filename=engine-mr%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fengine%2Fmr%2FLookupSnapshotBuildJob.java#L71) | 1 | 0% |
   | [server-base/src/main/java/org/apache/kylin/rest/job/KylinHealthCheckJob.java](https://coveralls.io/builds/37949501/source?filename=server-base%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fjob%2FKylinHealthCheckJob.java#L145) | 1 | 0% |
   | [cube-migration/src/main/java/org/apache/kylin/rest/service/MigrationRuleSet.java](https://coveralls.io/builds/37949501/source?filename=cube-migration%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fservice%2FMigrationRuleSet.java#L216) | 2 | 0% |
   | [core-job/src/main/java/org/apache/kylin/job/execution/AbstractExecutable.java](https://coveralls.io/builds/37949501/source?filename=core-job%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fjob%2Fexecution%2FAbstractExecutable.java#L235) | 5 | 58.3% |
   | [stream-source-kafka/src/main/java/org/apache/kylin/stream/source/kafka/TimedJsonStreamParser.java](https://coveralls.io/builds/37949501/source?filename=stream-source-kafka%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fstream%2Fsource%2Fkafka%2FTimedJsonStreamParser.java#L157) | 9 | 76.09% |
   | [query/src/main/java/org/apache/kylin/query/util/QueryUtil.java](https://coveralls.io/builds/37949501/source?filename=query%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fquery%2Futil%2FQueryUtil.java#L44) | 12 | 75.0% |
   | [server-base/src/main/java/org/apache/kylin/rest/metrics/QueryMetrics2Facade.java](https://coveralls.io/builds/37949501/source?filename=server-base%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fmetrics%2FQueryMetrics2Facade.java#L43) | 17 | 0% |
   | [stream-core/src/main/java/org/apache/kylin/stream/core/query/StreamingTupleConverter.java](https://coveralls.io/builds/37949501/source?filename=stream-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fstream%2Fcore%2Fquery%2FStreamingTupleConverter.java#L82) | 19 | 0% |
   <!-- | **Total:** | **258** |  | -->
   
   |  Totals | [![Coverage Status](https://coveralls.io/builds/37949501/badge)](https://coveralls.io/builds/37949501) |
   | :-- | --: |
   | Change from base [Build 6921](https://coveralls.io/builds/37585214): |  0.2% |
   | Covered Lines: | 26766 |
   | Relevant Lines: | 95032 |
   
   ---
   ##### 💛  - [Coveralls](https://coveralls.io)
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kylin] yanghua commented on a change in pull request #1596: [KYLIN-4780] support dingtalk notify

Posted by GitBox <gi...@apache.org>.
yanghua commented on a change in pull request #1596:
URL: https://github.com/apache/kylin/pull/1596#discussion_r603032595



##########
File path: core-common/src/main/java/org/apache/kylin/common/notify/DingTalkService.java
##########
@@ -0,0 +1,132 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.kylin.common.notify;
+
+import com.dingtalk.api.DefaultDingTalkClient;
+import com.dingtalk.api.DingTalkClient;
+import com.dingtalk.api.request.OapiRobotSendRequest;
+import com.dingtalk.api.response.OapiRobotSendResponse;
+import com.taobao.api.ApiException;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.kylin.common.notify.util.DingTalkNotificationUtil;
+import org.apache.kylin.common.notify.util.NotificationConstants;
+import org.apache.kylin.common.notify.util.SecretKeyUtil;
+import org.apache.kylin.common.util.Pair;
+import org.apache.kylin.common.util.StringUtil;
+import org.apache.kylin.shaded.com.google.common.base.Strings;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class DingTalkService extends NotifyServiceBase {
+    private static final org.slf4j.Logger logger = LoggerFactory.getLogger(DingTalkService.class);
+
+    private static final Pattern TOKEN_REGEX = Pattern.compile("(^[a-z0-9A-Z]*):?([a-z0-9A-Z]*)@?(.*)?");
+    private static final Pattern PHONE_REGEX = Pattern.compile("1[3456789]\\d{9}");
+
+    private Boolean enabled = Boolean.TRUE;
+
+    private String url = "https://oapi.dingtalk.com/robot/send?access_token=%s";
+    private String secretParam = "&timestamp=%s&sign=%s";
+
+    public DingTalkService(NotificationContext notificationContext) {
+        super(notificationContext);
+        this.enabled = getNotificationContext().getConfig().isNotificationEnabled();
+    }
+    
+    public boolean sendNotification() {
+        if (!enabled) {
+            logger.info("DingTalk service is disabled; this DingTalk will not be delivered");
+            logger.info("To enable notify service, set 'kylin.job.notification-enabled=true' in kylin.properties");
+            return false;
+        }
+
+        if (CollectionUtils.isEmpty(getNotificationContext().getReceivers().get(NotificationConstants.NOTIFY_DINGTALK_LIST))) {
+            logger.warn("no need to send dingtalk, receivers is empty");
+            return false;
+        } else {
+            logger.info("prepare to send dingtalk to:{}", getNotificationContext().getReceivers().get(NotificationConstants.NOTIFY_DINGTALK_LIST));
+            String title = DingTalkNotificationUtil.getTitle(getNotificationContext().getContent().getFirst());
+            String contentDingTalk = DingTalkNotificationUtil.getContent(getNotificationContext().getState(), title, getNotificationContext().getContent().getSecond());
+            return sendContent(getNotificationContext().getReceivers().get(NotificationConstants.NOTIFY_DINGTALK_LIST), title, contentDingTalk);
+        }
+    }
+
+    private boolean sendContent(List<String> infos, String title, String contentDingTalk) {
+        boolean res = false;
+        for (String dingTalkInfo : infos) {
+            if (StringUtil.isEmpty(dingTalkInfo)) {
+                logger.warn("dingtalk service is disabled; this notify will not be delivered, Please check the information {}", dingTalkInfo);

Review comment:
       wrong warning message?

##########
File path: core-common/src/main/java/org/apache/kylin/common/notify/NotificationContext.java
##########
@@ -0,0 +1,130 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.kylin.common.notify;
+
+import org.apache.kylin.common.KylinConfig;
+import org.apache.kylin.common.util.Pair;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * All basic information of the notification.
+ */
+public class NotificationContext {
+    private KylinConfig config;
+
+    /**
+     * Notification recipient,include email and dingTalk
+     */
+    private Map<String, List<String>> receivers;
+
+    /**
+     * state of job
+     */
+    private String state;
+
+    /**
+     * content of notification, include title and detail
+     */
+    private Pair<String[], Map<String, Object>> content;
+
+    /**
+     * Send in HTML
+     */
+    private boolean isHtmlMsg = true;
+
+    /**
+     * when isHtmlMsg is false, subject and info will be sended as text 
+     */
+    private String subject = "";
+    
+    private String info = "";
+
+    public NotificationContext(KylinConfig config, Map<String, List<String>> receivers, String state, Pair<String[], Map<String, Object>> content) {
+        this.config = config;
+        this.receivers = receivers;
+        this.state = state;
+        this.content = content;
+    }
+
+    public NotificationContext(KylinConfig config, Map<String, List<String>> receivers, String subject, String info, boolean isHtmlMsg) {
+        this.config = config;
+        this.receivers = receivers;
+        this.subject = subject;
+        this.info = info;
+        this.isHtmlMsg = isHtmlMsg;
+    }
+
+    public KylinConfig getConfig() {
+        return config;
+    }
+
+    public void setConfig(KylinConfig config) {
+        this.config = config;
+    }
+
+    public Map<String, List<String>> getReceivers() {
+        return receivers;
+    }
+
+    public void setReceivers(Map<String, List<String>> receivers) {
+        this.receivers = receivers;
+    }
+
+    public String getState() {
+        return state;
+    }
+
+    public void setState(String state) {
+        this.state = state;
+    }
+
+    public Pair<String[], Map<String, Object>> getContent() {
+        return content;
+    }
+
+    public void setContent(Pair<String[], Map<String, Object>> content) {
+        this.content = content;
+    }
+
+    public boolean isHtmlMsg() {
+        return isHtmlMsg;
+    }
+
+    public void setHtmlMsg(boolean htmlMsg) {
+        isHtmlMsg = htmlMsg;
+    }
+
+    public String getSubject() {
+        return subject;
+    }
+
+    public void setSubject(String subject) {
+        this.subject = subject;
+    }
+
+    public String getInfo() {
+        return info;
+    }
+
+    public void setInfo(String info) {
+        this.info = info;
+    }
+}

Review comment:
       It would be better to override the `equals` and `hashcode` for a model class.

##########
File path: core-common/src/main/java/org/apache/kylin/common/notify/MailService.java
##########
@@ -78,12 +73,17 @@ public boolean sendMail(List<String> receivers, String subject, String content)
      * @return true or false indicating whether the email was delivered successfully
      * @throws IOException
      */
-    public boolean sendMail(List<String> receivers, String subject, String content, boolean isHtmlMsg) {
+    private boolean sendMail(List<String> receivers, String subject, String content, boolean isHtmlMsg) {
 
         if (!enabled) {
             logger.info("Email service is disabled; this mail will not be delivered: " + subject);
             logger.info("To enable mail service, set 'kylin.job.notification-enabled=true' in kylin.properties");
             return false;
+        } else {
+            if (host.isEmpty()) {

Review comment:
       Can we extract this if block?  There is no need to have the `else` at line No.82.

##########
File path: core-common/src/test/java/org/apache/kylin/common/notify/DingTalkServiceTest.java
##########
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+package org.apache.kylin.common.notify;
+
+import org.apache.kylin.common.KylinConfig;
+import org.apache.kylin.common.notify.util.NotificationConstants;
+import org.apache.kylin.common.util.LocalFileMetadataTestCase;
+import org.apache.kylin.common.util.Pair;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Ignore("convenient trial tool for dev")
+public class DingTalkServiceTest extends LocalFileMetadataTestCase {
+
+    @Before
+    public void setup() throws Exception {
+        this.createTestMetadata();
+    }
+
+    @After
+    public void after() throws Exception {
+        this.cleanupTestMetadata();
+    }
+
+    @Test
+    public void testSendDingTalk() throws IOException {
+        KylinConfig config = KylinConfig.getInstanceFromEnv();
+        List<String> receivers = new ArrayList<String>(1);
+        receivers.add("98a3994aecc22763b135b91e953fd32eec60e1bf10190f7af4eca77049c433e@13675555555");
+        Map<String, List<String>> receiversMap = new HashMap();
+        receiversMap.put(NotificationConstants.NOTIFY_DINGTALK_LIST, receivers);
+
+        Map<String, Object> content = new HashMap();
+        content.put("info", "dingtalk notification");
+
+        Pair<String[], Map<String, Object>> mapPair = Pair.newPair(new String[]{"test"}, content);
+        NotificationContext notificationInfo = new NotificationContext(config, receiversMap, NotificationConstants.JOB_ERROR, mapPair);
+
+        DingTalkService dingTalkservice = new DingTalkService(notificationInfo);
+        boolean sent = sendTestDingTalk(dingTalkservice);
+        assert !sent;
+
+        System.setProperty("kylin.job.notification-enabled", "false");
+        // set kylin.job.notification-enabled=false, and run again, this time should be no mail delivered
+        dingTalkservice = new DingTalkService(notificationInfo);
+        sent = sendTestDingTalk(dingTalkservice);

Review comment:
       just call `dingTalkService.sendNotification()` here?

##########
File path: core-common/src/main/java/org/apache/kylin/common/notify/util/MailTemplateProvider.java
##########
@@ -36,8 +34,6 @@
  */
 public class MailTemplateProvider {

Review comment:
       ditto, we can merge this class and `MailNotificationUtil `.

##########
File path: core-common/src/main/java/org/apache/kylin/common/notify/NotificationTransmitter.java
##########
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.kylin.common.notify;
+
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.kylin.common.notify.util.NotificationConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Entity class for notification sending.
+ */
+public class NotificationTransmitter {
+    private static final Logger logger = LoggerFactory.getLogger(NotificationTransmitter.class);
+
+    private List<NotifyServiceBase> notifyServices = new ArrayList<>();
+
+    private ExecutorService pool = Executors.newCachedThreadPool();
+
+    private List<Future> futureList = new ArrayList<>();
+
+    public NotificationTransmitter(NotificationContext notificationInfo) {

Review comment:
       Should this class be  a singleton class?

##########
File path: core-common/src/test/java/org/apache/kylin/common/notify/MailServiceTest.java
##########
@@ -44,25 +48,30 @@ public void after() throws Exception {
 
     @Test
     public void testSendEmail() throws IOException {
-
         KylinConfig config = KylinConfig.getInstanceFromEnv();
+        List<String> receivers = new ArrayList<String>(1);
+        receivers.add("foobar@foobar.com");
+        Map<String, List<String>> receiversMap = new HashMap();
+        receiversMap.put(NotificationConstants.NOTIFY_EMAIL_LIST, receivers);
+
+        Map<String, Object> content = new HashMap();
+        content.put("info", "email notification");
+        Pair<String[], Map<String, Object>> mapPair = Pair.newPair(new String[]{"test"}, content);
+
+        NotificationContext notificationInfo = new NotificationContext(config, receiversMap, NotificationConstants.JOB_ERROR, mapPair);
 
-        MailService mailservice = new MailService(config);
+        MailService mailservice = new MailService(notificationInfo);
         boolean sent = sendTestEmail(mailservice);
-        assert sent;
+        assert !sent;
 
         System.setProperty("kylin.job.notification-enabled", "false");
         // set kylin.job.notification-enabled=false, and run again, this time should be no mail delivered
-        mailservice = new MailService(config);
+        mailservice = new MailService(notificationInfo);
         sent = sendTestEmail(mailservice);

Review comment:
       just call `mailservice.sendNotification()`?

##########
File path: core-common/src/main/java/org/apache/kylin/common/notify/util/DingTalkTemplateProvider.java
##########
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.kylin.common.notify.util;
+
+import org.apache.kylin.shaded.com.google.common.base.Strings;
+
+import java.util.Map;
+
+public class DingTalkTemplateProvider {
+
+    private static DingTalkTemplateProvider DEFAULT_INSTANCE = new DingTalkTemplateProvider();
+
+    public static DingTalkTemplateProvider getInstance() {
+        return DEFAULT_INSTANCE;
+    }
+
+    public String buildDingTalkContent(String state, String title, Map<String, Object> data) {

Review comment:
       IMO, we can merge `DingTalkNotificationUtil ` and this class. WDYT?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kylin] codecov-io edited a comment on pull request #1596: [KYLIN-4780] support dingtalk notify

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #1596:
URL: https://github.com/apache/kylin/pull/1596#issuecomment-799678944


   # [Codecov](https://codecov.io/gh/apache/kylin/pull/1596?src=pr&el=h1) Report
   > Merging [#1596](https://codecov.io/gh/apache/kylin/pull/1596?src=pr&el=desc) (6969865) into [master](https://codecov.io/gh/apache/kylin/commit/02500818d85955b1125340eaa19ab88a634a5181?el=desc) (0250081) will **decrease** coverage by `0.09%`.
   > The diff coverage is `9.82%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/kylin/pull/1596/graphs/tree.svg?width=650&height=150&src=pr&token=JawVgbgsVo)](https://codecov.io/gh/apache/kylin/pull/1596?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #1596      +/-   ##
   ============================================
   - Coverage     25.42%   25.32%   -0.10%     
   - Complexity     6765     6774       +9     
   ============================================
     Files          1508     1516       +8     
     Lines         93918    94436     +518     
     Branches      13158    13233      +75     
   ============================================
   + Hits          23877    23916      +39     
   - Misses        67662    68136     +474     
   - Partials       2379     2384       +5     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/kylin/pull/1596?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | [.../java/org/apache/kylin/common/KylinConfigBase.java](https://codecov.io/gh/apache/kylin/pull/1596/diff?src=pr&el=tree#diff-Y29yZS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2t5bGluL2NvbW1vbi9LeWxpbkNvbmZpZ0Jhc2UuamF2YQ==) | `12.42% <0.00%> (-0.05%)` | `51.00 <0.00> (ø)` | |
   | [...rg/apache/kylin/common/notify/DingTalkService.java](https://codecov.io/gh/apache/kylin/pull/1596/diff?src=pr&el=tree#diff-Y29yZS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2t5bGluL2NvbW1vbi9ub3RpZnkvRGluZ1RhbGtTZXJ2aWNlLmphdmE=) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (?)` | |
   | [...va/org/apache/kylin/common/notify/MailService.java](https://codecov.io/gh/apache/kylin/pull/1596/diff?src=pr&el=tree#diff-Y29yZS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2t5bGluL2NvbW1vbi9ub3RpZnkvTWFpbFNlcnZpY2UuamF2YQ==) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (?)` | |
   | [...pache/kylin/common/notify/NotificationContext.java](https://codecov.io/gh/apache/kylin/pull/1596/diff?src=pr&el=tree#diff-Y29yZS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2t5bGluL2NvbW1vbi9ub3RpZnkvTm90aWZpY2F0aW9uQ29udGV4dC5qYXZh) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (?)` | |
   | [...e/kylin/common/notify/NotificationTransmitter.java](https://codecov.io/gh/apache/kylin/pull/1596/diff?src=pr&el=tree#diff-Y29yZS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2t5bGluL2NvbW1vbi9ub3RpZnkvTm90aWZpY2F0aW9uVHJhbnNtaXR0ZXIuamF2YQ==) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (?)` | |
   | [.../apache/kylin/common/notify/NotifyServiceBase.java](https://codecov.io/gh/apache/kylin/pull/1596/diff?src=pr&el=tree#diff-Y29yZS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2t5bGluL2NvbW1vbi9ub3RpZnkvTm90aWZ5U2VydmljZUJhc2UuamF2YQ==) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (?)` | |
   | [...ylin/common/notify/util/NotificationConstants.java](https://codecov.io/gh/apache/kylin/pull/1596/diff?src=pr&el=tree#diff-Y29yZS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2t5bGluL2NvbW1vbi9ub3RpZnkvdXRpbC9Ob3RpZmljYXRpb25Db25zdGFudHMuamF2YQ==) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (?)` | |
   | [...in/java/org/apache/kylin/cube/CubeDescManager.java](https://codecov.io/gh/apache/kylin/pull/1596/diff?src=pr&el=tree#diff-Y29yZS1jdWJlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9reWxpbi9jdWJlL0N1YmVEZXNjTWFuYWdlci5qYXZh) | `32.41% <0.00%> (-1.16%)` | `12.00 <0.00> (ø)` | |
   | [...c/main/java/org/apache/kylin/cube/CubeManager.java](https://codecov.io/gh/apache/kylin/pull/1596/diff?src=pr&el=tree#diff-Y29yZS1jdWJlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9reWxpbi9jdWJlL0N1YmVNYW5hZ2VyLmphdmE=) | `35.83% <0.00%> (-0.81%)` | `44.00 <0.00> (ø)` | |
   | [...c/main/java/org/apache/kylin/cube/CubeSegment.java](https://codecov.io/gh/apache/kylin/pull/1596/diff?src=pr&el=tree#diff-Y29yZS1jdWJlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9reWxpbi9jdWJlL0N1YmVTZWdtZW50LmphdmE=) | `41.97% <0.00%> (-0.31%)` | `65.00 <0.00> (ø)` | |
   | ... and [94 more](https://codecov.io/gh/apache/kylin/pull/1596/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/kylin/pull/1596?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/kylin/pull/1596?src=pr&el=footer). Last update [ca08012...6969865](https://codecov.io/gh/apache/kylin/pull/1596?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kylin] hit-lacus commented on pull request #1596: [KYLIN-4780] Support dingtalk notify

Posted by GitBox <gi...@apache.org>.
hit-lacus commented on pull request #1596:
URL: https://github.com/apache/kylin/pull/1596#issuecomment-824026897


   Thanks for contribution, it does takes some time to review your patch.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kylin] chenjie-sau commented on a change in pull request #1596: [KYLIN-4780] support dingtalk notify

Posted by GitBox <gi...@apache.org>.
chenjie-sau commented on a change in pull request #1596:
URL: https://github.com/apache/kylin/pull/1596#discussion_r587421817



##########
File path: core-common/src/main/java/org/apache/kylin/common/notify/MailService.java
##########
@@ -40,8 +42,9 @@
     private String password;
     private String sender;
 
+

Review comment:
        I will  revert these changes




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kylin] coveralls commented on pull request #1596: [KYLIN-4780] support dingtalk notify

Posted by GitBox <gi...@apache.org>.
coveralls commented on pull request #1596:
URL: https://github.com/apache/kylin/pull/1596#issuecomment-791204373


   ## Pull Request Test Coverage Report for [Build 6937](https://coveralls.io/builds/37678250)
   
   * **57** of **273**   **(20.88%)**  changed or added relevant lines in **20** files are covered.
   * **25** unchanged lines in **9** files lost coverage.
   * Overall coverage decreased (**-0.003%**) to **27.952%**
   
   ---
   
   |  Changes Missing Coverage | Covered Lines | Changed/Added Lines | % |
   | :-----|--------------|--------|---: |
   | [core-common/src/main/java/org/apache/kylin/common/notify/util/DingTalkNotificationUtil.java](https://coveralls.io/builds/37678250/source?filename=core-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fcommon%2Fnotify%2Futil%2FDingTalkNotificationUtil.java#L25) | 3 | 4 | 75.0%
   | [server-base/src/main/java/org/apache/kylin/rest/controller/StreamingV2Controller.java](https://coveralls.io/builds/37678250/source?filename=server-base%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fcontroller%2FStreamingV2Controller.java#L520) | 0 | 1 | 0.0%
   | [engine-mr/src/main/java/org/apache/kylin/engine/mr/LookupSnapshotBuildJob.java](https://coveralls.io/builds/37678250/source?filename=engine-mr%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fengine%2Fmr%2FLookupSnapshotBuildJob.java#L69) | 0 | 2 | 0.0%
   | [server-base/src/main/java/org/apache/kylin/rest/constant/NotifyType.java](https://coveralls.io/builds/37678250/source?filename=server-base%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fconstant%2FNotifyType.java#L21) | 0 | 2 | 0.0%
   | [server-base/src/main/java/org/apache/kylin/rest/job/KylinHealthCheckJob.java](https://coveralls.io/builds/37678250/source?filename=server-base%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fjob%2FKylinHealthCheckJob.java#L269) | 0 | 2 | 0.0%
   | [core-cube/src/main/java/org/apache/kylin/cube/model/CubeDesc.java](https://coveralls.io/builds/37678250/source?filename=core-cube%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fcube%2Fmodel%2FCubeDesc.java#L536) | 10 | 13 | 76.92%
   | [core-common/src/main/java/org/apache/kylin/common/notify/util/DingTalkTemplateProvider.java](https://coveralls.io/builds/37678250/source?filename=core-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fcommon%2Fnotify%2Futil%2FDingTalkTemplateProvider.java#L55) | 19 | 23 | 82.61%
   | [core-common/src/main/java/org/apache/kylin/common/notify/util/SecretKeyUtil.java](https://coveralls.io/builds/37678250/source?filename=core-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fcommon%2Fnotify%2Futil%2FSecretKeyUtil.java#L30) | 8 | 12 | 66.67%
   | [core-common/src/main/java/org/apache/kylin/common/notify/NotifyServiceBase.java](https://coveralls.io/builds/37678250/source?filename=core-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fcommon%2Fnotify%2FNotifyServiceBase.java#L27) | 0 | 6 | 0.0%
   | [cube-migration/src/main/java/org/apache/kylin/rest/service/MigrationRuleSet.java](https://coveralls.io/builds/37678250/source?filename=cube-migration%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fservice%2FMigrationRuleSet.java#L84) | 0 | 6 | 0.0%
   <!-- | **Total:** | **57** | **273** | **20.88%** | -->
   
   |  Files with Coverage Reduction | New Missed Lines | % |
   | :-----|--------------|--: |
   | [cube-migration/src/main/java/org/apache/kylin/rest/service/MigrationService.java](https://coveralls.io/builds/37678250/source?filename=cube-migration%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fservice%2FMigrationService.java#L234) | 1 | 0% |
   | [engine-mr/src/main/java/org/apache/kylin/engine/mr/LookupSnapshotBuildJob.java](https://coveralls.io/builds/37678250/source?filename=engine-mr%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fengine%2Fmr%2FLookupSnapshotBuildJob.java#L71) | 1 | 0% |
   | [tool/src/main/java/org/apache/kylin/tool/query/ProbabilityGenerator.java](https://coveralls.io/builds/37678250/source?filename=tool%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Ftool%2Fquery%2FProbabilityGenerator.java#L42) | 1 | 81.58% |
   | [core-job/src/main/java/org/apache/kylin/job/impl/threadpool/DefaultScheduler.java](https://coveralls.io/builds/37678250/source?filename=core-job%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fjob%2Fimpl%2Fthreadpool%2FDefaultScheduler.java#L193) | 2 | 79.07% |
   | [cube-migration/src/main/java/org/apache/kylin/rest/service/MigrationRuleSet.java](https://coveralls.io/builds/37678250/source?filename=cube-migration%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fservice%2FMigrationRuleSet.java#L216) | 2 | 0% |
   | [engine-mr/src/main/java/org/apache/kylin/engine/mr/CubingJob.java](https://coveralls.io/builds/37678250/source?filename=engine-mr%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fengine%2Fmr%2FCubingJob.java#L166) | 2 | 1.47% |
   | [core-job/src/main/java/org/apache/kylin/job/execution/AbstractExecutable.java](https://coveralls.io/builds/37678250/source?filename=core-job%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fjob%2Fexecution%2FAbstractExecutable.java#L320) | 4 | 58.78% |
   | [server-base/src/main/java/org/apache/kylin/rest/controller/StreamingV2Controller.java](https://coveralls.io/builds/37678250/source?filename=server-base%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fcontroller%2FStreamingV2Controller.java#L515) | 5 | 0% |
   | [core-cube/src/main/java/org/apache/kylin/cube/inmemcubing/MemDiskStore.java](https://coveralls.io/builds/37678250/source?filename=core-cube%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fcube%2Finmemcubing%2FMemDiskStore.java#L193) | 7 | 76.29% |
   <!-- | **Total:** | **25** |  | -->
   
   |  Totals | [![Coverage Status](https://coveralls.io/builds/37678250/badge)](https://coveralls.io/builds/37678250) |
   | :-- | --: |
   | Change from base [Build 6921](https://coveralls.io/builds/37585214): |  -0.003% |
   | Covered Lines: | 26305 |
   | Relevant Lines: | 94107 |
   
   ---
   ##### 💛  - [Coveralls](https://coveralls.io)
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kylin] lgtm-com[bot] commented on pull request #1596: [KYLIN-4780] support dingtalk notify

Posted by GitBox <gi...@apache.org>.
lgtm-com[bot] commented on pull request #1596:
URL: https://github.com/apache/kylin/pull/1596#issuecomment-793628013


   This pull request **introduces 3 alerts** when merging 73cdd58ab4a02b43a7c8f20f2f8673d0cc9a0332 into 3f3f114400e49cf8bd9ec48c888b253c81994f79 - [view on LGTM.com](https://lgtm.com/projects/g/apache/kylin/rev/pr-ab4eebd9c689ee2e97a9f69ccb1731772fdc3d5b)
   
   **new alerts:**
   
   * 3 for Dereferenced variable may be null


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kylin] lgtm-com[bot] commented on pull request #1596: [KYLIN-4780] support dingtalk notify

Posted by GitBox <gi...@apache.org>.
lgtm-com[bot] commented on pull request #1596:
URL: https://github.com/apache/kylin/pull/1596#issuecomment-802602879


   This pull request **introduces 3 alerts** when merging b2a10f441917e90192372fb8a68944879a23c070 into 49d7b9bd6c022bf842c731c0521f0898e16566bf - [view on LGTM.com](https://lgtm.com/projects/g/apache/kylin/rev/pr-34e706b56451eba46fc4dc329f8b0bdc72f29770)
   
   **new alerts:**
   
   * 3 for Dereferenced variable may be null


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kylin] yanghua commented on a change in pull request #1596: [KYLIN-4780] support dingtalk notify

Posted by GitBox <gi...@apache.org>.
yanghua commented on a change in pull request #1596:
URL: https://github.com/apache/kylin/pull/1596#discussion_r589291800



##########
File path: core-common/src/test/java/org/apache/kylin/common/notify/MailServiceTest.java
##########
@@ -16,18 +16,19 @@
  * limitations under the License.
 */
 
-package org.apache.kylin.common.util;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
+package org.apache.kylin.common.notify;
 
 import org.apache.kylin.common.KylinConfig;
+import org.apache.kylin.common.util.LocalFileMetadataTestCase;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
 
+import java.io.IOException;

Review comment:
       We should not change the position of the existed imports.

##########
File path: core-common/src/main/java/org/apache/kylin/common/notify/util/Notify.java
##########
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.kylin.common.notify.util;
+
+public interface Notify {

Review comment:
       Can we define the constants into a base class?

##########
File path: core-common/src/main/java/org/apache/kylin/common/notify/NotifyServiceBase.java
##########
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.kylin.common.notify;
+
+import org.apache.kylin.common.util.Pair;
+
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.Callable;
+
+public abstract class NotifyServiceBase implements Callable<Boolean> {
+
+    public Map<String, List<String>> receivers;
+    public String state;
+    public Pair<String[], Map<String, Object>> content;
+
+    public abstract boolean sendNotify();
+
+    public void sendNotify(Map<String, List<String>> receivers, String state, Pair<String[], Map<String, Object>> content){

Review comment:
       IMO, `sendNotification` sounds better?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kylin] coveralls edited a comment on pull request #1596: [KYLIN-4780] support dingtalk notify

Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #1596:
URL: https://github.com/apache/kylin/pull/1596#issuecomment-791204373


   ## Pull Request Test Coverage Report for [Build 6985](https://coveralls.io/builds/38076867)
   
   * **62** of **335**   **(18.51%)**  changed or added relevant lines in **21** files are covered.
   * **856** unchanged lines in **22** files lost coverage.
   * Overall coverage increased (+**0.2%**) to **28.147%**
   
   ---
   
   |  Changes Missing Coverage | Covered Lines | Changed/Added Lines | % |
   | :-----|--------------|--------|---: |
   | [core-common/src/main/java/org/apache/kylin/common/notify/util/DingTalkNotificationUtil.java](https://coveralls.io/builds/38076867/source?filename=core-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fcommon%2Fnotify%2Futil%2FDingTalkNotificationUtil.java#L25) | 3 | 4 | 75.0%
   | [core-common/src/main/java/org/apache/kylin/common/notify/util/NotificationConstants.java](https://coveralls.io/builds/38076867/source?filename=core-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fcommon%2Fnotify%2Futil%2FNotificationConstants.java#L21) | 0 | 1 | 0.0%
   | [engine-mr/src/main/java/org/apache/kylin/engine/mr/LookupSnapshotBuildJob.java](https://coveralls.io/builds/38076867/source?filename=engine-mr%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fengine%2Fmr%2FLookupSnapshotBuildJob.java#L69) | 0 | 2 | 0.0%
   | [server-base/src/main/java/org/apache/kylin/rest/constant/NotifyType.java](https://coveralls.io/builds/38076867/source?filename=server-base%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fconstant%2FNotifyType.java#L21) | 0 | 2 | 0.0%
   | [core-cube/src/main/java/org/apache/kylin/cube/model/CubeDesc.java](https://coveralls.io/builds/38076867/source?filename=core-cube%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fcube%2Fmodel%2FCubeDesc.java#L536) | 10 | 13 | 76.92%
   | [core-common/src/main/java/org/apache/kylin/common/notify/util/DingTalkTemplateProvider.java](https://coveralls.io/builds/38076867/source?filename=core-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fcommon%2Fnotify%2Futil%2FDingTalkTemplateProvider.java#L55) | 19 | 23 | 82.61%
   | [core-common/src/main/java/org/apache/kylin/common/notify/util/SecretKeyUtil.java](https://coveralls.io/builds/38076867/source?filename=core-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fcommon%2Fnotify%2Futil%2FSecretKeyUtil.java#L30) | 8 | 12 | 66.67%
   | [core-common/src/main/java/org/apache/kylin/common/notify/NotifyServiceBase.java](https://coveralls.io/builds/38076867/source?filename=core-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fcommon%2Fnotify%2FNotifyServiceBase.java#L31) | 0 | 5 | 0.0%
   | [server-base/src/main/java/org/apache/kylin/rest/job/KylinHealthCheckJob.java](https://coveralls.io/builds/38076867/source?filename=server-base%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fjob%2FKylinHealthCheckJob.java#L140) | 0 | 5 | 0.0%
   | [cube-migration/src/main/java/org/apache/kylin/rest/service/MigrationRuleSet.java](https://coveralls.io/builds/38076867/source?filename=cube-migration%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fservice%2FMigrationRuleSet.java#L84) | 0 | 6 | 0.0%
   <!-- | **Total:** | **62** | **335** | **18.51%** | -->
   
   |  Files with Coverage Reduction | New Missed Lines | % |
   | :-----|--------------|--: |
   | [cube-migration/src/main/java/org/apache/kylin/rest/service/MigrationService.java](https://coveralls.io/builds/38076867/source?filename=cube-migration%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fservice%2FMigrationService.java#L235) | 1 | 0% |
   | [engine-mr/src/main/java/org/apache/kylin/engine/mr/CubingJob.java](https://coveralls.io/builds/38076867/source?filename=engine-mr%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fengine%2Fmr%2FCubingJob.java#L166) | 1 | 1.47% |
   | [engine-mr/src/main/java/org/apache/kylin/engine/mr/LookupSnapshotBuildJob.java](https://coveralls.io/builds/38076867/source?filename=engine-mr%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fengine%2Fmr%2FLookupSnapshotBuildJob.java#L71) | 1 | 0% |
   | [server-base/src/main/java/org/apache/kylin/rest/job/KylinHealthCheckJob.java](https://coveralls.io/builds/38076867/source?filename=server-base%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fjob%2FKylinHealthCheckJob.java#L143) | 1 | 0% |
   | [cube-migration/src/main/java/org/apache/kylin/rest/service/MigrationRuleSet.java](https://coveralls.io/builds/38076867/source?filename=cube-migration%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fservice%2FMigrationRuleSet.java#L216) | 2 | 0% |
   | [tool/src/main/java/org/apache/kylin/tool/query/ProbabilityGenerator.java](https://coveralls.io/builds/38076867/source?filename=tool%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Ftool%2Fquery%2FProbabilityGenerator.java#L42) | 3 | 76.32% |
   | [core-job/src/main/java/org/apache/kylin/job/execution/AbstractExecutable.java](https://coveralls.io/builds/38076867/source?filename=core-job%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fjob%2Fexecution%2FAbstractExecutable.java#L234) | 5 | 58.54% |
   | [stream-source-kafka/src/main/java/org/apache/kylin/stream/source/kafka/TimedJsonStreamParser.java](https://coveralls.io/builds/38076867/source?filename=stream-source-kafka%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fstream%2Fsource%2Fkafka%2FTimedJsonStreamParser.java#L157) | 9 | 76.09% |
   | [query/src/main/java/org/apache/kylin/query/util/QueryUtil.java](https://coveralls.io/builds/38076867/source?filename=query%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fquery%2Futil%2FQueryUtil.java#L44) | 12 | 75.0% |
   | [server-base/src/main/java/org/apache/kylin/rest/service/CacheService.java](https://coveralls.io/builds/38076867/source?filename=server-base%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fservice%2FCacheService.java#L135) | 12 | 0% |
   <!-- | **Total:** | **856** |  | -->
   
   |  Totals | [![Coverage Status](https://coveralls.io/builds/38076867/badge)](https://coveralls.io/builds/38076867) |
   | :-- | --: |
   | Change from base [Build 6921](https://coveralls.io/builds/37585214): |  0.2% |
   | Covered Lines: | 26759 |
   | Relevant Lines: | 95069 |
   
   ---
   ##### 💛  - [Coveralls](https://coveralls.io)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kylin] lgtm-com[bot] commented on pull request #1596: [KYLIN-4780] support dingtalk notify

Posted by GitBox <gi...@apache.org>.
lgtm-com[bot] commented on pull request #1596:
URL: https://github.com/apache/kylin/pull/1596#issuecomment-788935493


   This pull request **introduces 4 alerts** when merging 2deeb026968a68c87a998b72c0dffad29bb1d69e into 9d7ee863304220c5fb53a4c88cb798ed3edb0891 - [view on LGTM.com](https://lgtm.com/projects/g/apache/kylin/rev/pr-752fdc5e5d205ee4db482645833f3ff2f3a6ba81)
   
   **new alerts:**
   
   * 3 for Dereferenced variable may be null
   * 1 for Boxed variable is never null


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kylin] hit-lacus edited a comment on pull request #1596: [KYLIN-4780] Support dingtalk notify

Posted by GitBox <gi...@apache.org>.
hit-lacus edited a comment on pull request #1596:
URL: https://github.com/apache/kylin/pull/1596#issuecomment-828891154


     I wish this patch could be well designed for extensible purpose, and a **notification framework** should be developed from my side. 
     So, if other guys want to add support for We-chat or Slack, it should be very easy because he/her should only provided some implementation depend on this **notification framework** .
   
     I found that you provided a simple framework with some base classes : `NotifyServiceBase`, `NotificationContext`, `NotificationTransmitter`. I am not really sure if it is enough extensible. What do you think ?
   
     Besides, the `alibaba-dingtalk-service-sdk` is not maintained by apache software foundation or and other open source org, and the source code didn't have a proper license at all. It is a another serious problem .


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kylin] yanghua commented on a change in pull request #1596: [KYLIN-4780] support dingtalk notify

Posted by GitBox <gi...@apache.org>.
yanghua commented on a change in pull request #1596:
URL: https://github.com/apache/kylin/pull/1596#discussion_r593102391



##########
File path: core-common/src/main/java/org/apache/kylin/common/notify/MailService.java
##########
@@ -134,4 +135,17 @@ public boolean sendMail(List<String> receivers, String subject, String content,
             return false;
         }
     }
+
+    public boolean sendNotification() {
+        if (receivers.get(NotificationConstant.NOTIFY_EMAIL_LIST) == null) {
+            logger.warn("no need to send email, content is null");

Review comment:
       The **content** is null?

##########
File path: core-common/src/main/java/org/apache/kylin/common/notify/MailService.java
##########
@@ -134,4 +135,17 @@ public boolean sendMail(List<String> receivers, String subject, String content,
             return false;
         }
     }
+
+    public boolean sendNotification() {
+        if (receivers.get(NotificationConstant.NOTIFY_EMAIL_LIST) == null) {

Review comment:
       Can we judge if it's empty("")?

##########
File path: core-common/src/main/java/org/apache/kylin/common/notify/MailService.java
##########
@@ -134,4 +135,17 @@ public boolean sendMail(List<String> receivers, String subject, String content,
             return false;
         }
     }
+
+    public boolean sendNotification() {
+        if (receivers.get(NotificationConstant.NOTIFY_EMAIL_LIST) == null) {
+            logger.warn("no need to send email, content is null");
+            return false;
+        } else {
+            logger.info("prepare to send email to:{}", receivers.get(NotificationConstant.NOTIFY_EMAIL_LIST));
+            String contentEmail = MailNotificationUtil.getMailContent(state, content.getSecond());
+            String title = MailNotificationUtil.getMailTitle(content.getFirst());
+            return sendMail(receivers.get(NotificationConstant.NOTIFY_EMAIL_LIST), title, contentEmail);

Review comment:
       So, can we change the access modifier of `sendMail` to be `private`?

##########
File path: core-common/src/test/java/org/apache/kylin/common/notify/DingTalkServiceTest.java
##########
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+package org.apache.kylin.common.notify;
+
+import org.apache.kylin.common.KylinConfig;
+import org.apache.kylin.common.util.LocalFileMetadataTestCase;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+@Ignore("convenient trial tool for dev")
+public class DingTalkServiceTest extends LocalFileMetadataTestCase {
+
+    @Before
+    public void setup() throws Exception {
+        this.createTestMetadata();
+

Review comment:
       Why we need this empty line?

##########
File path: core-common/src/main/java/org/apache/kylin/common/notify/NotifyService.java
##########
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.kylin.common.notify;
+
+import org.apache.kylin.common.KylinConfig;
+import org.apache.kylin.common.util.Pair;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.function.Consumer;
+
+
+public class NotifyService {
+    private static final Logger logger = LoggerFactory.getLogger(NotifyService.class);
+
+    private NotifyServiceBase[] notifyServices;
+
+    private ExecutorService pool = Executors.newCachedThreadPool();
+
+    private List<Future> futureList = new ArrayList<>();
+
+    public NotifyService(KylinConfig config) {
+        notifyServices = new NotifyServiceBase[]{
+                new MailService(config),
+                new DingTalkService(config)
+        };
+    }
+
+    public boolean sendNotification(Map<String, List<String>> receivers, String state, Pair<String[], Map<String, Object>> content) {
+        boolean res = Boolean.TRUE;
+
+        Consumer<NotifyServiceBase> action = new Consumer<NotifyServiceBase>() {
+
+            @Override
+            public void accept(NotifyServiceBase notifyServiceBase) {
+                notifyServiceBase.sendNotificationInfo(receivers, state, content);
+            }
+        };
+        Arrays.stream(notifyServices).forEach(action);
+
+        for (Callable callable : notifyServices) {
+            Future f = pool.submit(callable);
+            futureList.add(f);
+        }
+
+        for (Future f : futureList) {
+            try {
+                if (f.get(1, TimeUnit.MINUTES).toString().equalsIgnoreCase("false")) {
+                    res = false;
+                }
+            } catch (Exception e) {
+                res = false;
+                logger.error("push notification for email or dingtalk occurred exception");

Review comment:
       Can we log the detail of the exception?

##########
File path: core-common/src/main/java/org/apache/kylin/common/notify/util/NotificationConstant.java
##########
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.kylin.common.notify.util;
+
+public class NotificationConstant {

Review comment:
       `NotificationConstants` looks better?

##########
File path: core-common/src/main/java/org/apache/kylin/common/notify/util/NotificationConstant.java
##########
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.kylin.common.notify.util;
+
+public class NotificationConstant {
+    public static final String NOTIFY_EMAIL_LIST = "notify_email_list";
+    public static final String NOTIFY_DINGTALK_LIST = "notify_dingtalk_list";
+
+    public static final String ERROR = "ERROR";

Review comment:
       Does it mean the status or result of sending? If yes, can we rename it to `STATUS_ERROR`?

##########
File path: core-common/src/test/java/org/apache/kylin/common/notify/DingTalkServiceTest.java
##########
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+package org.apache.kylin.common.notify;
+
+import org.apache.kylin.common.KylinConfig;
+import org.apache.kylin.common.util.LocalFileMetadataTestCase;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+@Ignore("convenient trial tool for dev")
+public class DingTalkServiceTest extends LocalFileMetadataTestCase {
+
+    @Before
+    public void setup() throws Exception {
+        this.createTestMetadata();
+
+    }
+
+    @After
+    public void after() throws Exception {
+        this.cleanupTestMetadata();
+    }
+
+    @Test
+    public void testSendEmail() throws IOException {
+

Review comment:
       ditto

##########
File path: core-common/src/test/java/org/apache/kylin/common/notify/DingTalkServiceTest.java
##########
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+package org.apache.kylin.common.notify;
+
+import org.apache.kylin.common.KylinConfig;
+import org.apache.kylin.common.util.LocalFileMetadataTestCase;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+@Ignore("convenient trial tool for dev")
+public class DingTalkServiceTest extends LocalFileMetadataTestCase {
+
+    @Before
+    public void setup() throws Exception {
+        this.createTestMetadata();
+
+    }
+
+    @After
+    public void after() throws Exception {
+        this.cleanupTestMetadata();
+    }
+
+    @Test
+    public void testSendEmail() throws IOException {
+
+        KylinConfig config = KylinConfig.getInstanceFromEnv();
+
+        DingTalkService dingTalkservice = new DingTalkService(config);
+        boolean sent = sendTestEmail(dingTalkservice);
+        assert !sent;
+
+        System.setProperty("kylin.job.notification-enabled", "false");
+        // set kylin.job.notification-enabled=false, and run again, this time should be no mail delivered
+        dingTalkservice = new DingTalkService(config);
+        sent = sendTestEmail(dingTalkservice);
+        assert !sent;
+

Review comment:
       ditto

##########
File path: core-common/src/main/java/org/apache/kylin/common/notify/util/SecretKeyUtil.java
##########
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.kylin.common.notify.util;
+
+import org.apache.commons.codec.binary.Base64;
+import org.apache.kylin.common.util.Pair;
+import org.slf4j.LoggerFactory;
+
+import javax.crypto.Mac;
+import javax.crypto.spec.SecretKeySpec;
+import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
+
+public class SecretKeyUtil {
+    private static final org.slf4j.Logger logger = LoggerFactory.getLogger(SecretKeyUtil.class);
+
+    public static Pair<Long, String> createSecretKey(String secret) {
+        long timestamp = System.currentTimeMillis();
+
+        String stringToSign = timestamp + "\n" + secret;
+        try {
+            Mac mac = Mac.getInstance("HmacSHA256");
+            mac.init(new SecretKeySpec(secret.getBytes(StandardCharsets.UTF_8), "HmacSHA256"));
+            byte[] signData = mac.doFinal(stringToSign.getBytes(StandardCharsets.UTF_8));
+            String sign = URLEncoder.encode(new String(Base64.encodeBase64(signData), StandardCharsets.UTF_8), "UTF-8");
+            return Pair.newPair(timestamp, sign);
+        } catch (Exception e) {
+            logger.error("create mac of dingtalk occurred error, please check.");

Review comment:
       We can give users more detail about the exception.

##########
File path: core-common/src/main/java/org/apache/kylin/common/notify/NotifyServiceBase.java
##########
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.kylin.common.notify;
+
+import org.apache.kylin.common.util.Pair;
+
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.Callable;
+
+public abstract class NotifyServiceBase implements Callable<Boolean> {
+
+    public Map<String, List<String>> receivers;
+    public String state;
+    public Pair<String[], Map<String, Object>> content;
+
+    public abstract boolean sendNotification();

Review comment:
       This design is not very graceful. IMO, we can define a NotificationContext Model to box these details and the context will be the parameter of the constructor. Then, there is not necessary to add the next method, right?

##########
File path: core-common/src/test/java/org/apache/kylin/common/notify/DingTalkServiceTest.java
##########
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+package org.apache.kylin.common.notify;
+
+import org.apache.kylin.common.KylinConfig;
+import org.apache.kylin.common.util.LocalFileMetadataTestCase;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+@Ignore("convenient trial tool for dev")
+public class DingTalkServiceTest extends LocalFileMetadataTestCase {
+
+    @Before
+    public void setup() throws Exception {
+        this.createTestMetadata();
+
+    }
+
+    @After
+    public void after() throws Exception {
+        this.cleanupTestMetadata();
+    }
+
+    @Test
+    public void testSendEmail() throws IOException {
+
+        KylinConfig config = KylinConfig.getInstanceFromEnv();
+
+        DingTalkService dingTalkservice = new DingTalkService(config);
+        boolean sent = sendTestEmail(dingTalkservice);
+        assert !sent;
+
+        System.setProperty("kylin.job.notification-enabled", "false");
+        // set kylin.job.notification-enabled=false, and run again, this time should be no mail delivered
+        dingTalkservice = new DingTalkService(config);
+        sent = sendTestEmail(dingTalkservice);
+        assert !sent;
+
+    }
+
+    private boolean sendTestEmail(DingTalkService dingTalkService) {
+

Review comment:
       ditto




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kylin] yanghua commented on a change in pull request #1596: [KYLIN-4780] support dingtalk notify

Posted by GitBox <gi...@apache.org>.
yanghua commented on a change in pull request #1596:
URL: https://github.com/apache/kylin/pull/1596#discussion_r595086240



##########
File path: core-common/src/main/java/org/apache/kylin/common/notify/NotifyServiceBase.java
##########
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.kylin.common.notify;
+
+import org.apache.kylin.common.KylinConfig;
+import org.apache.kylin.common.util.Pair;
+
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.Callable;
+
+public abstract class NotifyServiceBase implements Callable<Boolean> {
+    
+    private NotificationContext notificationContext;
+
+    private KylinConfig config;
+
+    /**
+     * Notification recipient,include email and dingTalk
+     */
+    private Map<String, List<String>> receivers;
+
+    /**
+     * state of job
+     */
+    private String state;
+
+    /**
+     * content of notification, include title and detail
+     */
+    private Pair<String[], Map<String, Object>> content;
+
+    /**
+     * only when send email and isHtmlMsg is false, subject and info will be used
+     */
+    private String subject;
+
+    private String info;

Review comment:
       IMO, the context object contains these fields, right? Let's reduce the duplicated definition.

##########
File path: core-common/src/main/java/org/apache/kylin/common/notify/util/NotificationConstants.java
##########
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.kylin.common.notify.util;
+
+public class NotificationConstants {
+    public static final String NOTIFY_EMAIL_LIST = "notify_email_list";
+    public static final String NOTIFY_DINGTALK_LIST = "notify_dingtalk_list";

Review comment:
       Can we use one constant(config option) to represent different services?

##########
File path: core-common/src/main/java/org/apache/kylin/common/notify/NotifyServiceBase.java
##########
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.kylin.common.notify;
+
+import org.apache.kylin.common.KylinConfig;
+import org.apache.kylin.common.util.Pair;
+
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.Callable;
+
+public abstract class NotifyServiceBase implements Callable<Boolean> {
+    
+    private NotificationContext notificationContext;
+
+    private KylinConfig config;
+
+    /**
+     * Notification recipient,include email and dingTalk
+     */
+    private Map<String, List<String>> receivers;
+
+    /**
+     * state of job
+     */
+    private String state;
+
+    /**
+     * content of notification, include title and detail
+     */
+    private Pair<String[], Map<String, Object>> content;
+
+    /**
+     * only when send email and isHtmlMsg is false, subject and info will be used
+     */
+    private String subject;
+
+    private String info;
+
+    public abstract boolean sendNotification();
+
+    public NotifyServiceBase(NotificationContext notificationContext) {
+        this.notificationContext = notificationContext;
+        this.config = notificationContext.getConfig();
+        this.receivers = notificationContext.getReceivers();
+        this.state = notificationContext.getState();
+        this.content = notificationContext.getContent();
+        this.subject = notificationContext.getSubject();

Review comment:
       If the fields exist in the context, we do not need to extract them into this class.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kylin] yanghua commented on pull request #1596: [KYLIN-4780] Support dingtalk notify

Posted by GitBox <gi...@apache.org>.
yanghua commented on pull request #1596:
URL: https://github.com/apache/kylin/pull/1596#issuecomment-819151203


   @chenjie-sau Can you check why the Java CI failed?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kylin] hit-lacus edited a comment on pull request #1596: [KYLIN-4780] Support dingtalk notify

Posted by GitBox <gi...@apache.org>.
hit-lacus edited a comment on pull request #1596:
URL: https://github.com/apache/kylin/pull/1596#issuecomment-828891154


     I wish this patch could be well designed for extensible purpose, and a **notification framework** should be developed from my side. 
     So, if other guys want to add support for We-chat or Slack, it should be very easy because he/her should only provided some implementation depend on this **notification framework** .
   
     I found that you provided a simple framework with some base classes : `NotifyServiceBase`, `NotificationContext`, `NotificationTransmitter`. I am not really sure if it is enough extensible. What do you think ?
   
     Besides, the [alibaba-dingtalk-service-sdk](https://repo1.maven.org/maven2/com/aliyun/alibaba-dingtalk-service-sdk/1.0.1/]) is not maintained by apache software foundation or and other open source organization, and the source code didn't have a proper asf-compatible license at all.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kylin] hit-lacus edited a comment on pull request #1596: [KYLIN-4780] Support dingtalk notify

Posted by GitBox <gi...@apache.org>.
hit-lacus edited a comment on pull request #1596:
URL: https://github.com/apache/kylin/pull/1596#issuecomment-828891154


     I wish this patch could be well designed for extensible purpose, and a **notification framework** should be developed from my side. 
     So, if other guys want to add support for We-chat or Slack, it should be very easy because he/her should only provided some implementation depend on this **notification framework** .
   
     I found that you provided a simple framework with some base classes : `NotifyServiceBase`, `NotificationContext`, `NotificationTransmitter`. I am not really sure if it is enough extensible. What do you think ?
   
     Besides, the (alibaba-dingtalk-service-sdk)[https://repo1.maven.org/maven2/com/aliyun/alibaba-dingtalk-service-sdk/1.0.1/] is not maintained by apache software foundation or and other open source org, and the source code didn't have a proper license at all. It is an another serious problem .


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kylin] hit-lacus edited a comment on pull request #1596: [KYLIN-4780] Support dingtalk notify

Posted by GitBox <gi...@apache.org>.
hit-lacus edited a comment on pull request #1596:
URL: https://github.com/apache/kylin/pull/1596#issuecomment-828891154


     I wish this patch could be well designed for extensible purpose, and a **notification framework** should be developed from my side. 
     So, if other guys want to add support for We-chat or Slack, it should be very easy because he/her should only provided some implementation depend on this **notification framework** .
   
     I found that you provided a simple framework with some base classes : `NotifyServiceBase`, `NotificationContext`, `NotificationTransmitter`. I am not really sure if it is enough extensible. What do you think ?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kylin] coveralls edited a comment on pull request #1596: [KYLIN-4780] support dingtalk notify

Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #1596:
URL: https://github.com/apache/kylin/pull/1596#issuecomment-791204373


   ## Pull Request Test Coverage Report for [Build 7049](https://coveralls.io/builds/38707212)
   
   * **57** of **347**   **(16.43%)**  changed or added relevant lines in **20** files are covered.
   * **14** unchanged lines in **8** files lost coverage.
   * Overall coverage decreased (**-0.02%**) to **28.073%**
   
   ---
   
   |  Changes Missing Coverage | Covered Lines | Changed/Added Lines | % |
   | :-----|--------------|--------|---: |
   | [core-common/src/main/java/org/apache/kylin/common/notify/util/NotificationConstants.java](https://coveralls.io/builds/38707212/source?filename=core-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fcommon%2Fnotify%2Futil%2FNotificationConstants.java#L21) | 0 | 1 | 0.0%
   | [engine-mr/src/main/java/org/apache/kylin/engine/mr/LookupSnapshotBuildJob.java](https://coveralls.io/builds/38707212/source?filename=engine-mr%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fengine%2Fmr%2FLookupSnapshotBuildJob.java#L69) | 0 | 2 | 0.0%
   | [server-base/src/main/java/org/apache/kylin/rest/constant/NotifyType.java](https://coveralls.io/builds/38707212/source?filename=server-base%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fconstant%2FNotifyType.java#L21) | 0 | 2 | 0.0%
   | [core-cube/src/main/java/org/apache/kylin/cube/model/CubeDesc.java](https://coveralls.io/builds/38707212/source?filename=core-cube%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fcube%2Fmodel%2FCubeDesc.java#L537) | 10 | 13 | 76.92%
   | [core-common/src/main/java/org/apache/kylin/common/notify/util/SecretKeyUtil.java](https://coveralls.io/builds/38707212/source?filename=core-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fcommon%2Fnotify%2Futil%2FSecretKeyUtil.java#L30) | 8 | 12 | 66.67%
   | [core-common/src/main/java/org/apache/kylin/common/notify/NotifyServiceBase.java](https://coveralls.io/builds/38707212/source?filename=core-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fcommon%2Fnotify%2FNotifyServiceBase.java#L31) | 0 | 5 | 0.0%
   | [core-common/src/main/java/org/apache/kylin/common/notify/util/DingTalkNotificationUtil.java](https://coveralls.io/builds/38707212/source?filename=core-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fcommon%2Fnotify%2Futil%2FDingTalkNotificationUtil.java#L26) | 12 | 17 | 70.59%
   | [server-base/src/main/java/org/apache/kylin/rest/job/KylinHealthCheckJob.java](https://coveralls.io/builds/38707212/source?filename=server-base%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fjob%2FKylinHealthCheckJob.java#L140) | 0 | 5 | 0.0%
   | [cube-migration/src/main/java/org/apache/kylin/rest/service/MigrationRuleSet.java](https://coveralls.io/builds/38707212/source?filename=cube-migration%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fservice%2FMigrationRuleSet.java#L84) | 0 | 6 | 0.0%
   | [server-base/src/main/java/org/apache/kylin/rest/service/CubeService.java](https://coveralls.io/builds/38707212/source?filename=server-base%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fservice%2FCubeService.java#L582) | 0 | 6 | 0.0%
   <!-- | **Total:** | **57** | **347** | **16.43%** | -->
   
   |  Files with Coverage Reduction | New Missed Lines | % |
   | :-----|--------------|--: |
   | [cube-migration/src/main/java/org/apache/kylin/rest/service/MigrationService.java](https://coveralls.io/builds/38707212/source?filename=cube-migration%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fservice%2FMigrationService.java#L236) | 1 | 0% |
   | [engine-mr/src/main/java/org/apache/kylin/engine/mr/CubingJob.java](https://coveralls.io/builds/38707212/source?filename=engine-mr%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fengine%2Fmr%2FCubingJob.java#L167) | 1 | 1.48% |
   | [engine-mr/src/main/java/org/apache/kylin/engine/mr/LookupSnapshotBuildJob.java](https://coveralls.io/builds/38707212/source?filename=engine-mr%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fengine%2Fmr%2FLookupSnapshotBuildJob.java#L71) | 1 | 0% |
   | [server-base/src/main/java/org/apache/kylin/rest/job/KylinHealthCheckJob.java](https://coveralls.io/builds/38707212/source?filename=server-base%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fjob%2FKylinHealthCheckJob.java#L143) | 1 | 0% |
   | [stream-core/src/main/java/org/apache/kylin/stream/core/storage/columnar/GeneralColumnDataReader.java](https://coveralls.io/builds/38707212/source?filename=stream-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fstream%2Fcore%2Fstorage%2Fcolumnar%2FGeneralColumnDataReader.java#L43) | 1 | 92.11% |
   | [cube-migration/src/main/java/org/apache/kylin/rest/service/MigrationRuleSet.java](https://coveralls.io/builds/38707212/source?filename=cube-migration%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fservice%2FMigrationRuleSet.java#L216) | 2 | 0% |
   | [tool/src/main/java/org/apache/kylin/tool/query/ProbabilityGenerator.java](https://coveralls.io/builds/38707212/source?filename=tool%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Ftool%2Fquery%2FProbabilityGenerator.java#L51) | 2 | 76.32% |
   | [core-job/src/main/java/org/apache/kylin/job/execution/AbstractExecutable.java](https://coveralls.io/builds/38707212/source?filename=core-job%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fjob%2Fexecution%2FAbstractExecutable.java#L240) | 5 | 61.18% |
   <!-- | **Total:** | **14** |  | -->
   
   |  Totals | [![Coverage Status](https://coveralls.io/builds/38707212/badge)](https://coveralls.io/builds/38707212) |
   | :-- | --: |
   | Change from base [Build 7032](https://coveralls.io/builds/38574273): |  -0.02% |
   | Covered Lines: | 26756 |
   | Relevant Lines: | 95310 |
   
   ---
   ##### 💛  - [Coveralls](https://coveralls.io)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kylin] codecov-io commented on pull request #1596: [KYLIN-4780] support dingtalk notify

Posted by GitBox <gi...@apache.org>.
codecov-io commented on pull request #1596:
URL: https://github.com/apache/kylin/pull/1596#issuecomment-799678944


   # [Codecov](https://codecov.io/gh/apache/kylin/pull/1596?src=pr&el=h1) Report
   > Merging [#1596](https://codecov.io/gh/apache/kylin/pull/1596?src=pr&el=desc) (b6d8bbb) into [master](https://codecov.io/gh/apache/kylin/commit/02500818d85955b1125340eaa19ab88a634a5181?el=desc) (0250081) will **decrease** coverage by `0.01%`.
   > The diff coverage is `16.85%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/kylin/pull/1596/graphs/tree.svg?width=650&height=150&src=pr&token=JawVgbgsVo)](https://codecov.io/gh/apache/kylin/pull/1596?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #1596      +/-   ##
   ============================================
   - Coverage     25.42%   25.41%   -0.02%     
   - Complexity     6765     6781      +16     
   ============================================
     Files          1508     1517       +9     
     Lines         93918    94158     +240     
     Branches      13158    13178      +20     
   ============================================
   + Hits          23877    23927      +50     
   - Misses        67662    67848     +186     
   - Partials       2379     2383       +4     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/kylin/pull/1596?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | [.../java/org/apache/kylin/common/KylinConfigBase.java](https://codecov.io/gh/apache/kylin/pull/1596/diff?src=pr&el=tree#diff-Y29yZS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2t5bGluL2NvbW1vbi9LeWxpbkNvbmZpZ0Jhc2UuamF2YQ==) | `12.46% <0.00%> (ø)` | `51.00 <0.00> (ø)` | |
   | [...rg/apache/kylin/common/notify/DingTalkService.java](https://codecov.io/gh/apache/kylin/pull/1596/diff?src=pr&el=tree#diff-Y29yZS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2t5bGluL2NvbW1vbi9ub3RpZnkvRGluZ1RhbGtTZXJ2aWNlLmphdmE=) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (?)` | |
   | [...va/org/apache/kylin/common/notify/MailService.java](https://codecov.io/gh/apache/kylin/pull/1596/diff?src=pr&el=tree#diff-Y29yZS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2t5bGluL2NvbW1vbi9ub3RpZnkvTWFpbFNlcnZpY2UuamF2YQ==) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (?)` | |
   | [...pache/kylin/common/notify/NotificationContext.java](https://codecov.io/gh/apache/kylin/pull/1596/diff?src=pr&el=tree#diff-Y29yZS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2t5bGluL2NvbW1vbi9ub3RpZnkvTm90aWZpY2F0aW9uQ29udGV4dC5qYXZh) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (?)` | |
   | [...e/kylin/common/notify/NotificationTransmitter.java](https://codecov.io/gh/apache/kylin/pull/1596/diff?src=pr&el=tree#diff-Y29yZS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2t5bGluL2NvbW1vbi9ub3RpZnkvTm90aWZpY2F0aW9uVHJhbnNtaXR0ZXIuamF2YQ==) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (?)` | |
   | [.../apache/kylin/common/notify/NotifyServiceBase.java](https://codecov.io/gh/apache/kylin/pull/1596/diff?src=pr&el=tree#diff-Y29yZS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2t5bGluL2NvbW1vbi9ub3RpZnkvTm90aWZ5U2VydmljZUJhc2UuamF2YQ==) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (?)` | |
   | [...kylin/common/notify/util/MailTemplateProvider.java](https://codecov.io/gh/apache/kylin/pull/1596/diff?src=pr&el=tree#diff-Y29yZS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2t5bGluL2NvbW1vbi9ub3RpZnkvdXRpbC9NYWlsVGVtcGxhdGVQcm92aWRlci5qYXZh) | `50.00% <ø> (ø)` | `4.00 <0.00> (?)` | |
   | [...ylin/common/notify/util/NotificationConstants.java](https://codecov.io/gh/apache/kylin/pull/1596/diff?src=pr&el=tree#diff-Y29yZS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2t5bGluL2NvbW1vbi9ub3RpZnkvdXRpbC9Ob3RpZmljYXRpb25Db25zdGFudHMuamF2YQ==) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (?)` | |
   | [...rg/apache/kylin/rest/service/MigrationRuleSet.java](https://codecov.io/gh/apache/kylin/pull/1596/diff?src=pr&el=tree#diff-Y3ViZS1taWdyYXRpb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2t5bGluL3Jlc3Qvc2VydmljZS9NaWdyYXRpb25SdWxlU2V0LmphdmE=) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (ø)` | |
   | [...rg/apache/kylin/rest/service/MigrationService.java](https://codecov.io/gh/apache/kylin/pull/1596/diff?src=pr&el=tree#diff-Y3ViZS1taWdyYXRpb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2t5bGluL3Jlc3Qvc2VydmljZS9NaWdyYXRpb25TZXJ2aWNlLmphdmE=) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (ø)` | |
   | ... and [39 more](https://codecov.io/gh/apache/kylin/pull/1596/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/kylin/pull/1596?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/kylin/pull/1596?src=pr&el=footer). Last update [d1c99d7...b6d8bbb](https://codecov.io/gh/apache/kylin/pull/1596?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kylin] lgtm-com[bot] commented on pull request #1596: [KYLIN-4780] support dingtalk notify

Posted by GitBox <gi...@apache.org>.
lgtm-com[bot] commented on pull request #1596:
URL: https://github.com/apache/kylin/pull/1596#issuecomment-788844942


   This pull request **introduces 4 alerts** when merging cf374d61f396d953b6eb1317dd8476ec708f5bf0 into 9d7ee863304220c5fb53a4c88cb798ed3edb0891 - [view on LGTM.com](https://lgtm.com/projects/g/apache/kylin/rev/pr-b7306400595ec54978137a9b26d970558f10a754)
   
   **new alerts:**
   
   * 3 for Dereferenced variable may be null
   * 1 for Boxed variable is never null


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kylin] codecov-io edited a comment on pull request #1596: [KYLIN-4780] support dingtalk notify

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #1596:
URL: https://github.com/apache/kylin/pull/1596#issuecomment-799678944


   # [Codecov](https://codecov.io/gh/apache/kylin/pull/1596?src=pr&el=h1) Report
   > Merging [#1596](https://codecov.io/gh/apache/kylin/pull/1596?src=pr&el=desc) (b2a10f4) into [master](https://codecov.io/gh/apache/kylin/commit/02500818d85955b1125340eaa19ab88a634a5181?el=desc) (0250081) will **decrease** coverage by `0.03%`.
   > The diff coverage is `17.25%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/kylin/pull/1596/graphs/tree.svg?width=650&height=150&src=pr&token=JawVgbgsVo)](https://codecov.io/gh/apache/kylin/pull/1596?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #1596      +/-   ##
   ============================================
   - Coverage     25.42%   25.39%   -0.04%     
   - Complexity     6765     6778      +13     
   ============================================
     Files          1508     1517       +9     
     Lines         93918    94195     +277     
     Branches      13158    13188      +30     
   ============================================
   + Hits          23877    23919      +42     
   - Misses        67662    67892     +230     
   - Partials       2379     2384       +5     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/kylin/pull/1596?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | [.../java/org/apache/kylin/common/KylinConfigBase.java](https://codecov.io/gh/apache/kylin/pull/1596/diff?src=pr&el=tree#diff-Y29yZS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2t5bGluL2NvbW1vbi9LeWxpbkNvbmZpZ0Jhc2UuamF2YQ==) | `12.43% <ø> (-0.04%)` | `51.00 <0.00> (ø)` | |
   | [...rg/apache/kylin/common/notify/DingTalkService.java](https://codecov.io/gh/apache/kylin/pull/1596/diff?src=pr&el=tree#diff-Y29yZS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2t5bGluL2NvbW1vbi9ub3RpZnkvRGluZ1RhbGtTZXJ2aWNlLmphdmE=) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (?)` | |
   | [...va/org/apache/kylin/common/notify/MailService.java](https://codecov.io/gh/apache/kylin/pull/1596/diff?src=pr&el=tree#diff-Y29yZS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2t5bGluL2NvbW1vbi9ub3RpZnkvTWFpbFNlcnZpY2UuamF2YQ==) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (?)` | |
   | [...pache/kylin/common/notify/NotificationContext.java](https://codecov.io/gh/apache/kylin/pull/1596/diff?src=pr&el=tree#diff-Y29yZS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2t5bGluL2NvbW1vbi9ub3RpZnkvTm90aWZpY2F0aW9uQ29udGV4dC5qYXZh) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (?)` | |
   | [...e/kylin/common/notify/NotificationTransmitter.java](https://codecov.io/gh/apache/kylin/pull/1596/diff?src=pr&el=tree#diff-Y29yZS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2t5bGluL2NvbW1vbi9ub3RpZnkvTm90aWZpY2F0aW9uVHJhbnNtaXR0ZXIuamF2YQ==) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (?)` | |
   | [.../apache/kylin/common/notify/NotifyServiceBase.java](https://codecov.io/gh/apache/kylin/pull/1596/diff?src=pr&el=tree#diff-Y29yZS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2t5bGluL2NvbW1vbi9ub3RpZnkvTm90aWZ5U2VydmljZUJhc2UuamF2YQ==) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (?)` | |
   | [...kylin/common/notify/util/MailTemplateProvider.java](https://codecov.io/gh/apache/kylin/pull/1596/diff?src=pr&el=tree#diff-Y29yZS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2t5bGluL2NvbW1vbi9ub3RpZnkvdXRpbC9NYWlsVGVtcGxhdGVQcm92aWRlci5qYXZh) | `50.00% <ø> (ø)` | `4.00 <0.00> (?)` | |
   | [...ylin/common/notify/util/NotificationConstants.java](https://codecov.io/gh/apache/kylin/pull/1596/diff?src=pr&el=tree#diff-Y29yZS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2t5bGluL2NvbW1vbi9ub3RpZnkvdXRpbC9Ob3RpZmljYXRpb25Db25zdGFudHMuamF2YQ==) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (?)` | |
   | [...rg/apache/kylin/rest/service/MigrationRuleSet.java](https://codecov.io/gh/apache/kylin/pull/1596/diff?src=pr&el=tree#diff-Y3ViZS1taWdyYXRpb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2t5bGluL3Jlc3Qvc2VydmljZS9NaWdyYXRpb25SdWxlU2V0LmphdmE=) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (ø)` | |
   | [...rg/apache/kylin/rest/service/MigrationService.java](https://codecov.io/gh/apache/kylin/pull/1596/diff?src=pr&el=tree#diff-Y3ViZS1taWdyYXRpb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2t5bGluL3Jlc3Qvc2VydmljZS9NaWdyYXRpb25TZXJ2aWNlLmphdmE=) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (ø)` | |
   | ... and [47 more](https://codecov.io/gh/apache/kylin/pull/1596/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/kylin/pull/1596?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/kylin/pull/1596?src=pr&el=footer). Last update [d1c99d7...b2a10f4](https://codecov.io/gh/apache/kylin/pull/1596?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kylin] yanghua commented on pull request #1596: [KYLIN-4780] support dingtalk notify

Posted by GitBox <gi...@apache.org>.
yanghua commented on pull request #1596:
URL: https://github.com/apache/kylin/pull/1596#issuecomment-789344642


   @chenjie-sau Thanks for your contribution. Will review later.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kylin] zhangayqian commented on pull request #1596: [KYLIN-4780] Support dingtalk notify

Posted by GitBox <gi...@apache.org>.
zhangayqian commented on pull request #1596:
URL: https://github.com/apache/kylin/pull/1596#issuecomment-823852293


   > @zhangayqian Would you please review this PR?
   
   Sorry for late. This PR changed a lot and there is new dependencies be introduced. We may need some time to discuss it.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kylin] yanghua commented on a change in pull request #1596: [KYLIN-4780] support dingtalk notify

Posted by GitBox <gi...@apache.org>.
yanghua commented on a change in pull request #1596:
URL: https://github.com/apache/kylin/pull/1596#discussion_r601106437



##########
File path: core-common/src/main/java/org/apache/kylin/common/notify/util/DingTalkTemplateProvider.java
##########
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.kylin.common.notify.util;
+
+import org.apache.kylin.shaded.com.google.common.base.Strings;
+
+import java.util.Map;
+
+public class DingTalkTemplateProvider {
+
+    private static DingTalkTemplateProvider DEFAULT_INSTANCE = new DingTalkTemplateProvider();
+
+    public static DingTalkTemplateProvider getInstance() {
+        return DEFAULT_INSTANCE;
+    }
+
+    public String buildDingTalkContent(String state, String title, Map<String, Object> data) {
+        String titleStart = "<font color=%s size=3>";
+        String titleEnd = "</font>";
+        StringBuilder sb = new StringBuilder(Strings.lenientFormat(titleStart, titleColor(state)))
+                .append(title)
+                .append(titleEnd)
+                .append("  \n");
+        for (Map.Entry<String, Object> entry : data.entrySet()) {
+            sb.append(" **")
+                    .append(entry.getKey())

Review comment:
       indent.

##########
File path: core-job/src/main/java/org/apache/kylin/job/execution/AbstractExecutable.java
##########
@@ -54,12 +57,12 @@
 
     public static final String CUBE_NAME = "cubeName";
     protected static final String SUBMITTER = "submitter";
-    protected static final String NOTIFY_LIST = "notify_list";
     protected static final String START_TIME = "startTime";
     protected static final String END_TIME = "endTime";
     protected static final String INTERRUPT_TIME = "interruptTime";
     protected static final String BUILD_INSTANCE = "buildInstance";
     protected static final String PROJECT_INSTANCE_NAME = "projectName";
+    public static final String MAP_REDUCE_WAIT_TIME = "mapReduceWaitTime";

Review comment:
       Does this change relate to this PR?

##########
File path: core-common/src/main/java/org/apache/kylin/common/notify/util/DingTalkTemplateProvider.java
##########
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.kylin.common.notify.util;
+
+import org.apache.kylin.shaded.com.google.common.base.Strings;
+
+import java.util.Map;
+
+public class DingTalkTemplateProvider {
+
+    private static DingTalkTemplateProvider DEFAULT_INSTANCE = new DingTalkTemplateProvider();
+
+    public static DingTalkTemplateProvider getInstance() {
+        return DEFAULT_INSTANCE;
+    }
+
+    public String buildDingTalkContent(String state, String title, Map<String, Object> data) {

Review comment:
       Since we have no shared fields, can we let this method be a `static` utility method?

##########
File path: core-common/src/main/java/org/apache/kylin/common/notify/util/DingTalkTemplateProvider.java
##########
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.kylin.common.notify.util;
+
+import org.apache.kylin.shaded.com.google.common.base.Strings;
+
+import java.util.Map;
+
+public class DingTalkTemplateProvider {
+
+    private static DingTalkTemplateProvider DEFAULT_INSTANCE = new DingTalkTemplateProvider();
+
+    public static DingTalkTemplateProvider getInstance() {
+        return DEFAULT_INSTANCE;
+    }
+
+    public String buildDingTalkContent(String state, String title, Map<String, Object> data) {
+        String titleStart = "<font color=%s size=3>";
+        String titleEnd = "</font>";
+        StringBuilder sb = new StringBuilder(Strings.lenientFormat(titleStart, titleColor(state)))
+                .append(title)
+                .append(titleEnd)
+                .append("  \n");
+        for (Map.Entry<String, Object> entry : data.entrySet()) {
+            sb.append(" **")
+                    .append(entry.getKey())
+                    .append(" :** ")
+                    .append(entry.getValue())
+                    .append("  \n");
+        }
+
+        return sb.toString();
+    }
+
+    private String titleColor(String state) {

Review comment:
       ditto

##########
File path: core-common/src/test/java/org/apache/kylin/common/notify/DingTalkServiceTest.java
##########
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+package org.apache.kylin.common.notify;
+
+import org.apache.kylin.common.KylinConfig;
+import org.apache.kylin.common.util.LocalFileMetadataTestCase;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+@Ignore("convenient trial tool for dev")
+public class DingTalkServiceTest extends LocalFileMetadataTestCase {
+
+    @Before
+    public void setup() throws Exception {
+        this.createTestMetadata();
+
+    }
+
+    @After
+    public void after() throws Exception {
+        this.cleanupTestMetadata();
+    }
+
+    @Test
+    public void testSendEmail() throws IOException {
+
+        KylinConfig config = KylinConfig.getInstanceFromEnv();
+
+        DingTalkService dingTalkservice = new DingTalkService(config);
+        boolean sent = sendTestEmail(dingTalkservice);
+        assert !sent;
+
+        System.setProperty("kylin.job.notification-enabled", "false");
+        // set kylin.job.notification-enabled=false, and run again, this time should be no mail delivered
+        dingTalkservice = new DingTalkService(config);
+        sent = sendTestEmail(dingTalkservice);
+        assert !sent;
+

Review comment:
       still some empty line

##########
File path: core-common/src/test/java/org/apache/kylin/common/notify/MailServiceTest.java
##########
@@ -46,23 +50,29 @@ public void after() throws Exception {
     public void testSendEmail() throws IOException {
 
         KylinConfig config = KylinConfig.getInstanceFromEnv();
+        List<String> receivers = new ArrayList<String>(1);
+        receivers.add("foobar@foobar.com");
+        Map<String, List<String>> receiversMap = new HashMap();
+        receiversMap.put(NotificationConstants.NOTIFY_EMAIL_LIST, receivers);
+
+        Map<String, Object> content = new HashMap();
+        content.put("info", "email notification");
+
+        NotificationContext notificationInfo = new NotificationContext(config, receiversMap, NotificationConstants.JOB_ERROR, Pair.newPair(new String[]{"test"}, content));

Review comment:
       too long line




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kylin] chenjie-sau commented on pull request #1596: [KYLIN-4780] Support dingtalk notify

Posted by GitBox <gi...@apache.org>.
chenjie-sau commented on pull request #1596:
URL: https://github.com/apache/kylin/pull/1596#issuecomment-830771732


   Thank you for your valuable suggestions. Some suggestions are very reasonable. I will consider each suggestion for certification and redesign a better solution.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kylin] lgtm-com[bot] commented on pull request #1596: [KYLIN-4780] support dingtalk notify

Posted by GitBox <gi...@apache.org>.
lgtm-com[bot] commented on pull request #1596:
URL: https://github.com/apache/kylin/pull/1596#issuecomment-788972809


   This pull request **introduces 4 alerts** when merging 6ba193cb466e6ce8616ff9b4bfb24d16d6fd6779 into 9d7ee863304220c5fb53a4c88cb798ed3edb0891 - [view on LGTM.com](https://lgtm.com/projects/g/apache/kylin/rev/pr-693112c1ebace325e1bd8af369c27fb474fff390)
   
   **new alerts:**
   
   * 3 for Dereferenced variable may be null
   * 1 for Boxed variable is never null


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kylin] coveralls edited a comment on pull request #1596: [KYLIN-4780] support dingtalk notify

Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #1596:
URL: https://github.com/apache/kylin/pull/1596#issuecomment-791204373


   ## Pull Request Test Coverage Report for [Build 6954](https://coveralls.io/builds/37804993)
   
   * **62** of **281**   **(22.06%)**  changed or added relevant lines in **21** files are covered.
   * **174** unchanged lines in **11** files lost coverage.
   * Overall coverage increased (+**0.005%**) to **27.961%**
   
   ---
   
   |  Changes Missing Coverage | Covered Lines | Changed/Added Lines | % |
   | :-----|--------------|--------|---: |
   | [core-common/src/main/java/org/apache/kylin/common/notify/util/DingTalkNotificationUtil.java](https://coveralls.io/builds/37804993/source?filename=core-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fcommon%2Fnotify%2Futil%2FDingTalkNotificationUtil.java#L25) | 3 | 4 | 75.0%
   | [core-common/src/main/java/org/apache/kylin/common/notify/util/NotificationConstant.java](https://coveralls.io/builds/37804993/source?filename=core-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fcommon%2Fnotify%2Futil%2FNotificationConstant.java#L21) | 0 | 1 | 0.0%
   | [server-base/src/main/java/org/apache/kylin/rest/controller/StreamingV2Controller.java](https://coveralls.io/builds/37804993/source?filename=server-base%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fcontroller%2FStreamingV2Controller.java#L520) | 0 | 1 | 0.0%
   | [engine-mr/src/main/java/org/apache/kylin/engine/mr/LookupSnapshotBuildJob.java](https://coveralls.io/builds/37804993/source?filename=engine-mr%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fengine%2Fmr%2FLookupSnapshotBuildJob.java#L69) | 0 | 2 | 0.0%
   | [server-base/src/main/java/org/apache/kylin/rest/constant/NotifyType.java](https://coveralls.io/builds/37804993/source?filename=server-base%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fconstant%2FNotifyType.java#L21) | 0 | 2 | 0.0%
   | [server-base/src/main/java/org/apache/kylin/rest/job/KylinHealthCheckJob.java](https://coveralls.io/builds/37804993/source?filename=server-base%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fjob%2FKylinHealthCheckJob.java#L269) | 0 | 2 | 0.0%
   | [core-cube/src/main/java/org/apache/kylin/cube/model/CubeDesc.java](https://coveralls.io/builds/37804993/source?filename=core-cube%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fcube%2Fmodel%2FCubeDesc.java#L536) | 10 | 13 | 76.92%
   | [core-common/src/main/java/org/apache/kylin/common/notify/util/DingTalkTemplateProvider.java](https://coveralls.io/builds/37804993/source?filename=core-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fcommon%2Fnotify%2Futil%2FDingTalkTemplateProvider.java#L55) | 19 | 23 | 82.61%
   | [core-common/src/main/java/org/apache/kylin/common/notify/util/SecretKeyUtil.java](https://coveralls.io/builds/37804993/source?filename=core-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fcommon%2Fnotify%2Futil%2FSecretKeyUtil.java#L30) | 8 | 12 | 66.67%
   | [core-common/src/main/java/org/apache/kylin/common/notify/NotifyServiceBase.java](https://coveralls.io/builds/37804993/source?filename=core-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fcommon%2Fnotify%2FNotifyServiceBase.java#L27) | 0 | 6 | 0.0%
   <!-- | **Total:** | **62** | **281** | **22.06%** | -->
   
   |  Files with Coverage Reduction | New Missed Lines | % |
   | :-----|--------------|--: |
   | [cube-migration/src/main/java/org/apache/kylin/rest/service/MigrationService.java](https://coveralls.io/builds/37804993/source?filename=cube-migration%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fservice%2FMigrationService.java#L234) | 1 | 0% |
   | [engine-mr/src/main/java/org/apache/kylin/engine/mr/CubingJob.java](https://coveralls.io/builds/37804993/source?filename=engine-mr%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fengine%2Fmr%2FCubingJob.java#L166) | 1 | 1.47% |
   | [engine-mr/src/main/java/org/apache/kylin/engine/mr/LookupSnapshotBuildJob.java](https://coveralls.io/builds/37804993/source?filename=engine-mr%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fengine%2Fmr%2FLookupSnapshotBuildJob.java#L71) | 1 | 0% |
   | [tool/src/main/java/org/apache/kylin/tool/query/ProbabilityGenerator.java](https://coveralls.io/builds/37804993/source?filename=tool%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Ftool%2Fquery%2FProbabilityGenerator.java#L42) | 1 | 81.58% |
   | [core-job/src/main/java/org/apache/kylin/job/impl/threadpool/DefaultScheduler.java](https://coveralls.io/builds/37804993/source?filename=core-job%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fjob%2Fimpl%2Fthreadpool%2FDefaultScheduler.java#L193) | 2 | 79.07% |
   | [cube-migration/src/main/java/org/apache/kylin/rest/service/MigrationRuleSet.java](https://coveralls.io/builds/37804993/source?filename=cube-migration%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fservice%2FMigrationRuleSet.java#L216) | 2 | 0% |
   | [core-job/src/main/java/org/apache/kylin/job/execution/AbstractExecutable.java](https://coveralls.io/builds/37804993/source?filename=core-job%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fjob%2Fexecution%2FAbstractExecutable.java#L320) | 4 | 58.78% |
   | [stream-source-kafka/src/main/java/org/apache/kylin/stream/source/kafka/TimedJsonStreamParser.java](https://coveralls.io/builds/37804993/source?filename=stream-source-kafka%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fstream%2Fsource%2Fkafka%2FTimedJsonStreamParser.java#L157) | 9 | 76.09% |
   | [stream-core/src/main/java/org/apache/kylin/stream/core/query/StreamingTupleConverter.java](https://coveralls.io/builds/37804993/source?filename=stream-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fstream%2Fcore%2Fquery%2FStreamingTupleConverter.java#L82) | 19 | 0% |
   | [core-storage/src/main/java/org/apache/kylin/storage/gtrecord/CubeTupleConverter.java](https://coveralls.io/builds/37804993/source?filename=core-storage%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fstorage%2Fgtrecord%2FCubeTupleConverter.java#L119) | 64 | 0% |
   <!-- | **Total:** | **174** |  | -->
   
   |  Totals | [![Coverage Status](https://coveralls.io/builds/37804993/badge)](https://coveralls.io/builds/37804993) |
   | :-- | --: |
   | Change from base [Build 6921](https://coveralls.io/builds/37585214): |  0.005% |
   | Covered Lines: | 26314 |
   | Relevant Lines: | 94110 |
   
   ---
   ##### 💛  - [Coveralls](https://coveralls.io)
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kylin] yanghua commented on pull request #1596: [KYLIN-4780] Support dingtalk notify

Posted by GitBox <gi...@apache.org>.
yanghua commented on pull request #1596:
URL: https://github.com/apache/kylin/pull/1596#issuecomment-828410898


   @zhangayqian @hit-lacus Do we have any schedule for this PR?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kylin] lgtm-com[bot] commented on pull request #1596: [KYLIN-4780] support dingtalk notify

Posted by GitBox <gi...@apache.org>.
lgtm-com[bot] commented on pull request #1596:
URL: https://github.com/apache/kylin/pull/1596#issuecomment-817285664


   This pull request **introduces 3 alerts** when merging 6969865ac4a94673a0ab7486f3378514d44417ba into ca0801201a4a5b3a78dd6fac788cbc5bde7e2bbd - [view on LGTM.com](https://lgtm.com/projects/g/apache/kylin/rev/pr-af9ebce9e01c211192f35597bfb0dd1fbccfcada)
   
   **new alerts:**
   
   * 3 for Dereferenced variable may be null


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kylin] coveralls edited a comment on pull request #1596: [KYLIN-4780] support dingtalk notify

Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #1596:
URL: https://github.com/apache/kylin/pull/1596#issuecomment-791204373


   ## Pull Request Test Coverage Report for [Build 6951](https://coveralls.io/builds/37772030)
   
   * **62** of **281**   **(22.06%)**  changed or added relevant lines in **21** files are covered.
   * **174** unchanged lines in **10** files lost coverage.
   * Overall coverage increased (+**0.004%**) to **27.96%**
   
   ---
   
   |  Changes Missing Coverage | Covered Lines | Changed/Added Lines | % |
   | :-----|--------------|--------|---: |
   | [core-common/src/main/java/org/apache/kylin/common/notify/util/DingTalkNotificationUtil.java](https://coveralls.io/builds/37772030/source?filename=core-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fcommon%2Fnotify%2Futil%2FDingTalkNotificationUtil.java#L25) | 3 | 4 | 75.0%
   | [core-common/src/main/java/org/apache/kylin/common/notify/util/NotificationConstant.java](https://coveralls.io/builds/37772030/source?filename=core-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fcommon%2Fnotify%2Futil%2FNotificationConstant.java#L21) | 0 | 1 | 0.0%
   | [server-base/src/main/java/org/apache/kylin/rest/controller/StreamingV2Controller.java](https://coveralls.io/builds/37772030/source?filename=server-base%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fcontroller%2FStreamingV2Controller.java#L520) | 0 | 1 | 0.0%
   | [engine-mr/src/main/java/org/apache/kylin/engine/mr/LookupSnapshotBuildJob.java](https://coveralls.io/builds/37772030/source?filename=engine-mr%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fengine%2Fmr%2FLookupSnapshotBuildJob.java#L69) | 0 | 2 | 0.0%
   | [server-base/src/main/java/org/apache/kylin/rest/constant/NotifyType.java](https://coveralls.io/builds/37772030/source?filename=server-base%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fconstant%2FNotifyType.java#L21) | 0 | 2 | 0.0%
   | [server-base/src/main/java/org/apache/kylin/rest/job/KylinHealthCheckJob.java](https://coveralls.io/builds/37772030/source?filename=server-base%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fjob%2FKylinHealthCheckJob.java#L269) | 0 | 2 | 0.0%
   | [core-cube/src/main/java/org/apache/kylin/cube/model/CubeDesc.java](https://coveralls.io/builds/37772030/source?filename=core-cube%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fcube%2Fmodel%2FCubeDesc.java#L536) | 10 | 13 | 76.92%
   | [core-common/src/main/java/org/apache/kylin/common/notify/util/DingTalkTemplateProvider.java](https://coveralls.io/builds/37772030/source?filename=core-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fcommon%2Fnotify%2Futil%2FDingTalkTemplateProvider.java#L55) | 19 | 23 | 82.61%
   | [core-common/src/main/java/org/apache/kylin/common/notify/util/SecretKeyUtil.java](https://coveralls.io/builds/37772030/source?filename=core-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fcommon%2Fnotify%2Futil%2FSecretKeyUtil.java#L30) | 8 | 12 | 66.67%
   | [core-common/src/main/java/org/apache/kylin/common/notify/NotifyServiceBase.java](https://coveralls.io/builds/37772030/source?filename=core-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fcommon%2Fnotify%2FNotifyServiceBase.java#L27) | 0 | 6 | 0.0%
   <!-- | **Total:** | **62** | **281** | **22.06%** | -->
   
   |  Files with Coverage Reduction | New Missed Lines | % |
   | :-----|--------------|--: |
   | [cube-migration/src/main/java/org/apache/kylin/rest/service/MigrationService.java](https://coveralls.io/builds/37772030/source?filename=cube-migration%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fservice%2FMigrationService.java#L234) | 1 | 0% |
   | [engine-mr/src/main/java/org/apache/kylin/engine/mr/LookupSnapshotBuildJob.java](https://coveralls.io/builds/37772030/source?filename=engine-mr%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fengine%2Fmr%2FLookupSnapshotBuildJob.java#L71) | 1 | 0% |
   | [core-job/src/main/java/org/apache/kylin/job/impl/threadpool/DefaultScheduler.java](https://coveralls.io/builds/37772030/source?filename=core-job%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fjob%2Fimpl%2Fthreadpool%2FDefaultScheduler.java#L193) | 2 | 79.07% |
   | [cube-migration/src/main/java/org/apache/kylin/rest/service/MigrationRuleSet.java](https://coveralls.io/builds/37772030/source?filename=cube-migration%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fservice%2FMigrationRuleSet.java#L216) | 2 | 0% |
   | [engine-mr/src/main/java/org/apache/kylin/engine/mr/CubingJob.java](https://coveralls.io/builds/37772030/source?filename=engine-mr%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fengine%2Fmr%2FCubingJob.java#L166) | 2 | 1.47% |
   | [core-job/src/main/java/org/apache/kylin/job/execution/AbstractExecutable.java](https://coveralls.io/builds/37772030/source?filename=core-job%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fjob%2Fexecution%2FAbstractExecutable.java#L320) | 4 | 58.78% |
   | [stream-source-kafka/src/main/java/org/apache/kylin/stream/source/kafka/TimedJsonStreamParser.java](https://coveralls.io/builds/37772030/source?filename=stream-source-kafka%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fstream%2Fsource%2Fkafka%2FTimedJsonStreamParser.java#L157) | 9 | 76.09% |
   | [stream-core/src/main/java/org/apache/kylin/stream/core/query/StreamingTupleConverter.java](https://coveralls.io/builds/37772030/source?filename=stream-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fstream%2Fcore%2Fquery%2FStreamingTupleConverter.java#L82) | 19 | 0% |
   | [core-storage/src/main/java/org/apache/kylin/storage/gtrecord/CubeTupleConverter.java](https://coveralls.io/builds/37772030/source?filename=core-storage%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fstorage%2Fgtrecord%2FCubeTupleConverter.java#L119) | 64 | 0% |
   | [server-base/src/main/java/org/apache/kylin/rest/controller/StreamingV2Controller.java](https://coveralls.io/builds/37772030/source?filename=server-base%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Frest%2Fcontroller%2FStreamingV2Controller.java#L91) | 70 | 0% |
   <!-- | **Total:** | **174** |  | -->
   
   |  Totals | [![Coverage Status](https://coveralls.io/builds/37772030/badge)](https://coveralls.io/builds/37772030) |
   | :-- | --: |
   | Change from base [Build 6921](https://coveralls.io/builds/37585214): |  0.004% |
   | Covered Lines: | 26313 |
   | Relevant Lines: | 94110 |
   
   ---
   ##### 💛  - [Coveralls](https://coveralls.io)
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org