This is an automated email from the ASF dual-hosted git repository. jihao pushed a commit to branch health-alerts in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git
commit b0319e95e2a4c093125e7476cb6ad1873bc23bb5 Author: Jihao Zhang <jihzh...@linkedin.com> AuthorDate: Tue Sep 29 13:24:08 2020 -0700 [TE] show alert health on the alerts page --- .../app/pods/manage/alerts/index/controller.js | 13 ++++++ .../acceptance/self-serve-alert-tuning-test.js | 47 ---------------------- .../anomaly/monitor/MonitorTaskRunner.java | 28 ------------- 3 files changed, 13 insertions(+), 75 deletions(-) diff --git a/thirdeye/thirdeye-frontend/app/pods/manage/alerts/index/controller.js b/thirdeye/thirdeye-frontend/app/pods/manage/alerts/index/controller.js index 314dcfc..aae52e9 100644 --- a/thirdeye/thirdeye-frontend/app/pods/manage/alerts/index/controller.js +++ b/thirdeye/thirdeye-frontend/app/pods/manage/alerts/index/controller.js @@ -31,6 +31,7 @@ import { export default Controller.extend({ queryParams: ['testMode'], + detectionHealthQueryTimeRange: [moment().add(1, 'day').subtract(30, 'day').startOf('day').valueOf(), moment().add(1, 'day').startOf('day').valueOf()], /** * One-way CP to store all sub groups @@ -228,6 +229,11 @@ export default Controller.extend({ break; } } + + for (const alert of alerts) { + this._fetchDetectionHealth(alert); + } + // Return one page of sorted alerts return alerts; } @@ -335,6 +341,13 @@ export default Controller.extend({ return this.get('_getAlerts').perform(paramsForAlerts); }, + async _fetchDetectionHealth(alert) { + const healthQueryTimeRange = get(this, 'detectionHealthQueryTimeRange'); + const healthUrl = `/detection/health/${alert.id}?start=${healthQueryTimeRange[0]}&end=${healthQueryTimeRange[1]}`; + const health_result = await fetch(healthUrl).then(checkStatus); + set(alert, 'health', health_result); + }, + _handlePrimaryFilter(primaryFilter, paramsForAlerts) { switch(primaryFilter) { case 'Alerts I subscribe to': { diff --git a/thirdeye/thirdeye-frontend/tests/acceptance/self-serve-alert-tuning-test.js b/thirdeye/thirdeye-frontend/tests/acceptance/self-serve-alert-tuning-test.js deleted file mode 100644 index 1220632..0000000 --- a/thirdeye/thirdeye-frontend/tests/acceptance/self-serve-alert-tuning-test.js +++ /dev/null @@ -1,47 +0,0 @@ -import $ from 'jquery'; -import { module, test } from 'qunit'; -import { setupApplicationTest } from 'ember-qunit'; -import { selfServeConst } from 'thirdeye-frontend/tests/utils/constants'; -import { visit, fillIn, click, currentURL, triggerKeyEvent, waitUntil } from '@ember/test-helpers'; -import { filters, dimensions, granularities } from 'thirdeye-frontend/mocks/metricPeripherals'; -import { selectChoose, clickTrigger } from 'thirdeye-frontend/tests/helpers/ember-power-select'; - -module('Acceptance | tune alert settings', function(hooks) { - setupApplicationTest(hooks); - - const alertLinkTitle = 'test_function_1'; - const alertProps = [ - 'Metric', - 'Dataset', - 'Granularity', - 'Application', - 'Created By', - 'Filtered By', - 'Breakdown By', - 'Detection Type', - 'Subscription Group' - ]; - - test(`check whether alerts page shows correct number of alerts`, async (assert) => { - server.createList('alert', 5); - await visit(`/manage/alerts`); - - // Verify default search results - assert.equal( - $(selfServeConst.RESULTS_TITLE).get(0).innerText.trim(), - 'Alerts (5)', - 'Number of alerts displayed and title are correct.' - ); - }); - - /** - * TODO: extend this test with the following flow: - * - click "preview performance", verify expected alert performance results, verify anomaly table results - * - click "reset", verify clean slate - * - click preview on custom settings, verify expected alert performance results - * - save a custom MTTD, verify banner - * - change date time range - * - navigate back to alert page, verify mttd % is consistent and time range is persisted - * - click report missing anomaly, enter time range, verify success banner and closed modal - */ -}); diff --git a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/anomaly/monitor/MonitorTaskRunner.java b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/anomaly/monitor/MonitorTaskRunner.java index 7e47f3b..1749318 100644 --- a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/anomaly/monitor/MonitorTaskRunner.java +++ b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/anomaly/monitor/MonitorTaskRunner.java @@ -132,9 +132,6 @@ public class MonitorTaskRunner implements TaskRunner { } } - // update detection health - updateDetectionHealth(); - // disable alerts that failed consecutively for a long time disableLongFailedAlerts(); @@ -190,31 +187,6 @@ public class MonitorTaskRunner implements TaskRunner { textBody, thirdeyeConfig.getFailureFromAddress(), new DetectionAlertFilterRecipients(recipients)); } - private void updateDetectionHealth() { - DetectionConfigManager detectionDAO = DAO_REGISTRY.getDetectionConfigManager(); - List<DetectionConfigDTO> detectionConfigs = detectionDAO.findAllActive(); - for (DetectionConfigDTO config : detectionConfigs) { - // update detection health status - try { - DateTime healthStatusWindowEnd = DateTime.now(); - DetectionHealth health = new DetectionHealth.Builder(config.getId(), healthStatusWindowEnd.minusDays(30).getMillis(), - healthStatusWindowEnd.getMillis()).addRegressionStatus(DAO_REGISTRY.getEvaluationManager()) - .addAnomalyCoverageStatus(DAO_REGISTRY.getMergedAnomalyResultDAO()) - .addDetectionTaskStatus(DAO_REGISTRY.getTaskDAO()) - .addOverallHealth() - .addOriginalDetectionHealth(config.getHealth()) - .build(); - // fetch the config again before saving to DB to avoid overriding config that is updated by other threads - config = detectionDAO.findById(config.getId()); - config.setHealth(health); - detectionDAO.update(config); - LOG.info("Updated detection health for {}", config.getId()); - } catch (Exception e) { - LOG.info("Update detection health for {} failed", config.getId(), e); - } - } - } - private void executeMonitorExpire(MonitorTaskInfo monitorTaskInfo) { LOG.info("Execute monitor expire {}", monitorTaskInfo); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org