You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by ak...@apache.org on 2020/02/27 18:55:05 UTC
[incubator-pinot] branch master updated: [TE][subscription] destroy
jira connections after use (#5097)
This is an automated email from the ASF dual-hosted git repository.
akshayrai09 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git
The following commit(s) were added to refs/heads/master by this push:
new 00fd911 [TE][subscription] destroy jira connections after use (#5097)
00fd911 is described below
commit 00fd911936f10420c612cbe7200b9b6a89ddcafa
Author: Akshay Rai <ak...@linkedin.com>
AuthorDate: Thu Feb 27 10:54:57 2020 -0800
[TE][subscription] destroy jira connections after use (#5097)
---
.../thirdeye/detection/alert/DetectionAlertTaskRunner.java | 1 +
.../thirdeye/detection/alert/scheme/DetectionAlertScheme.java | 4 ++++
.../thirdeye/detection/alert/scheme/DetectionJiraAlerter.java | 6 ++++++
.../thirdeye/notification/commons/ThirdEyeJiraClient.java | 10 +++++++++-
4 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/alert/DetectionAlertTaskRunner.java b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/alert/DetectionAlertTaskRunner.java
index 7291756..cfa27a1 100644
--- a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/alert/DetectionAlertTaskRunner.java
+++ b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/alert/DetectionAlertTaskRunner.java
@@ -112,6 +112,7 @@ public class DetectionAlertTaskRunner implements TaskRunner {
detAlertTaskFactory.loadAlertSchemes(alertConfig, taskContext.getThirdEyeAnomalyConfiguration(), result);
for (DetectionAlertScheme alertScheme : alertSchemes) {
alertScheme.run();
+ alertScheme.destroy();
}
updateAlertConfigWatermarks(result, alertConfig);
diff --git a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/alert/scheme/DetectionAlertScheme.java b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/alert/scheme/DetectionAlertScheme.java
index 8aaf6d7..c89fc2b 100644
--- a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/alert/scheme/DetectionAlertScheme.java
+++ b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/alert/scheme/DetectionAlertScheme.java
@@ -54,6 +54,10 @@ public abstract class DetectionAlertScheme {
public abstract void run() throws Exception;
+ public void destroy() {
+ // do nothing
+ }
+
/**
* Plug the appropriate template based on configuration.
*/
diff --git a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/alert/scheme/DetectionJiraAlerter.java b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/alert/scheme/DetectionJiraAlerter.java
index 49f978c..df807df 100644
--- a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/alert/scheme/DetectionJiraAlerter.java
+++ b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/detection/alert/scheme/DetectionJiraAlerter.java
@@ -21,6 +21,7 @@ package org.apache.pinot.thirdeye.detection.alert.scheme;
import com.atlassian.jira.rest.client.api.domain.Issue;
import com.google.common.base.Preconditions;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -171,6 +172,11 @@ public class DetectionJiraAlerter extends DetectionAlertScheme {
}
@Override
+ public void destroy() {
+ this.jiraClient.close();
+ }
+
+ @Override
public void run() throws Exception {
Preconditions.checkNotNull(result);
if (result.getAllAnomalies().size() == 0) {
diff --git a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/notification/commons/ThirdEyeJiraClient.java b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/notification/commons/ThirdEyeJiraClient.java
index 2820905..8ce9097 100644
--- a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/notification/commons/ThirdEyeJiraClient.java
+++ b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/notification/commons/ThirdEyeJiraClient.java
@@ -35,6 +35,7 @@ import com.atlassian.jira.rest.client.api.domain.input.TransitionInput;
import com.atlassian.jira.rest.client.internal.async.AsynchronousJiraRestClientFactory;
import com.google.common.base.Joiner;
import java.io.File;
+import java.io.IOException;
import java.net.URI;
import java.util.ArrayList;
import java.util.Collections;
@@ -60,7 +61,6 @@ public class ThirdEyeJiraClient {
private static final String JIRA_REOPEN_TRANSITION = "Reopen";
public static final String PROP_ISSUE_TYPE = "issuetype";
public static final String PROP_PROJECT = "project";
- public static final String PROP_SUMMARY = "summary";
public static final String PROP_ASSIGNEE = "assignee";
public static final String PROP_MERGE_GAP = "mergeGap";
public static final String PROP_LABELS = "labels";
@@ -249,4 +249,12 @@ public class ThirdEyeJiraClient {
return issueBuilder.build();
}
+
+ public void close() {
+ try {
+ restClient.close();
+ } catch (IOException e) {
+ LOG.warn("Failed to close jira rest client", e);
+ }
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org