You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by xh...@apache.org on 2019/06/26 20:51:27 UTC

[incubator-pinot] branch master updated: [TE] frontend - harleyjj/alert-overview - dont use anomalies from bounds endpoint in Alert Overview (#4366)

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

xhsun 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 39811df  [TE] frontend - harleyjj/alert-overview - dont use anomalies from bounds endpoint in Alert Overview (#4366)
39811df is described below

commit 39811dfad79e621696a9441bbac7f0072f002c0b
Author: Harley Jackson <hj...@linkedin.com>
AuthorDate: Wed Jun 26 13:51:22 2019 -0700

    [TE] frontend - harleyjj/alert-overview - dont use anomalies from bounds endpoint in Alert Overview (#4366)
---
 .../app/pods/components/alert-details/component.js            |  7 ++++---
 thirdeye/thirdeye-frontend/app/utils/anomaly.js               | 11 ++++++-----
 thirdeye/thirdeye-frontend/app/utils/api/anomaly.js           |  6 +++---
 3 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/thirdeye/thirdeye-frontend/app/pods/components/alert-details/component.js b/thirdeye/thirdeye-frontend/app/pods/components/alert-details/component.js
index 9cd60ae..4047113 100644
--- a/thirdeye/thirdeye-frontend/app/pods/components/alert-details/component.js
+++ b/thirdeye/thirdeye-frontend/app/pods/components/alert-details/component.js
@@ -22,7 +22,7 @@ import { colorMapping, makeTime, toMetricLabel, extractTail } from 'thirdeye-fro
 import { getYamlPreviewAnomalies,
   getAnomaliesByAlertId,
   getFormattedDuration,
-  getBoundsAndAnomalies,
+  getBounds,
   anomalyResponseMapNew,
   anomalyResponseObj,
   anomalyResponseObjNew,
@@ -666,7 +666,7 @@ export default Component.extend({
     let firstDimension;
     try {
       if(showRules){
-        applicationAnomalies = (granularity === 'DAYS') ? yield getBoundsAndAnomalies(alertId, startAnomalies, endAnomalies) : yield getYamlPreviewAnomalies(alertYaml, startAnomalies, endAnomalies, alertId);
+        applicationAnomalies = (granularity === 'DAYS') ? yield getBounds(alertId, startAnomalies, endAnomalies) : yield getYamlPreviewAnomalies(alertYaml, startAnomalies, endAnomalies, alertId);
         if (applicationAnomalies && applicationAnomalies.diagnostics && applicationAnomalies.diagnostics['0']) {
           metricUrnList = Object.keys(applicationAnomalies.diagnostics['0']);
           set(this, 'metricUrnList', metricUrnList);
@@ -683,7 +683,8 @@ export default Component.extend({
           }
           set(this, 'metricUrn', metricUrnList[0]);
         }
-        anomalies = applicationAnomalies.anomalies;
+        // In the case of Alert Overview, the anomalies returned by getBounds may not be valid, so get anomalies from different endpoint
+        anomalies = (granularity === 'DAYS') ? yield getAnomaliesByAlertId(alertId, start, end) : applicationAnomalies.anomalies;
         uniqueTimeSeries = applicationAnomalies.predictions;
       } else {
         applicationAnomalies = yield getAnomaliesByAlertId(alertId, start, end);
diff --git a/thirdeye/thirdeye-frontend/app/utils/anomaly.js b/thirdeye/thirdeye-frontend/app/utils/anomaly.js
index 41077fa..5d1156b 100644
--- a/thirdeye/thirdeye-frontend/app/utils/anomaly.js
+++ b/thirdeye/thirdeye-frontend/app/utils/anomaly.js
@@ -14,7 +14,7 @@ import {
   getAnomaliesByAlertIdUrl,
   getAnomalyFiltersByTimeRangeUrl,
   getAnomalyFiltersByAnomalyIdUrl,
-  getBoundsAndAnomaliesUrl
+  getBoundsUrl
 } from 'thirdeye-frontend/utils/api/anomaly';
 
 /**
@@ -112,15 +112,15 @@ export function getYamlPreviewAnomalies(yamlString, startTime, endTime, alertId)
 }
 
 /**
- * Get bounds and anomalies for a given detection
+ * Get bounds for a given detection (note the anomalies in this response are not end-user anomalies)
  * @method getBoundsAndAnomalies
  * @param {String} detectionId - the id of the detection
  * @param {Number} startTime - start time of analysis range
  * @param {Number} endTime - end time of analysis range
  * @return {Ember.RSVP.Promise}
  */
-export function getBoundsAndAnomalies(detectionId, startTime, endTime) {
-  const url = getBoundsAndAnomaliesUrl(detectionId, startTime, endTime);
+export function getBounds(detectionId, startTime, endTime) {
+  const url = getBoundsUrl(detectionId, startTime, endTime);
   return fetch(url, getProps()).then((res) => checkStatus(res));
 }
 
@@ -217,5 +217,6 @@ export default {
   verifyAnomalyFeedback,
   pluralizeTime,
   getYamlPreviewAnomalies,
-  getAnomaliesByAlertId
+  getAnomaliesByAlertId,
+  getBounds
 };
diff --git a/thirdeye/thirdeye-frontend/app/utils/api/anomaly.js b/thirdeye/thirdeye-frontend/app/utils/api/anomaly.js
index d6e6ded..9dfd386 100644
--- a/thirdeye/thirdeye-frontend/app/utils/api/anomaly.js
+++ b/thirdeye/thirdeye-frontend/app/utils/api/anomaly.js
@@ -22,14 +22,14 @@ export function getAnomaliesForYamlPreviewUrl(startTime, endTime, alertId) {
 }
 
 /**
- * Returns url for getting the time series and Anomalies for a given detection id
+ * Returns url for getting the time series with bounds for a given detection id
  * @param {String} detectionId - the detection id
  * @param {Number} startTime - the anomaly start time
  * @param {Number} endTime - the anomaly end time
  * @returns {String} the complete yaml/preview url
  * @example getBoundsAndAnomalies(111111, 1508472700000, 1508472800000) // yields => /detection/preview/111111?start=1508472700000&end=1508472800000&diagnostics=true
  */
-export function getBoundsAndAnomaliesUrl(detectionId, startTime, endTime) {
+export function getBoundsUrl(detectionId, startTime, endTime) {
   return `/detection/preview/${detectionId}?start=${startTime}&end=${endTime}&diagnostics=true`;
 }
 
@@ -71,7 +71,7 @@ export const anomalyApiUrls = {
   getAnomaliesByAlertIdUrl,
   getAnomalyFiltersByTimeRangeUrl,
   getAnomalyFiltersByAnomalyIdUrl,
-  getBoundsAndAnomaliesUrl
+  getBoundsUrl
 };
 
 export default {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org