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 2019/03/11 21:09:47 UTC
[incubator-pinot] branch master updated: [TE] Fix and include comma
separated subscription groups in alert headers (#3950)
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 994dc85 [TE] Fix and include comma separated subscription groups in alert headers (#3950)
994dc85 is described below
commit 994dc85d75719fda61bfa494e7a6df4bf7672f70
Author: Akshay Rai <ak...@gmail.com>
AuthorDate: Mon Mar 11 14:09:43 2019 -0700
[TE] Fix and include comma separated subscription groups in alert headers (#3950)
---
.../self-serve-alert-yaml-details/template.hbs | 18 ++++++---
.../app/pods/manage/alerts/index/route.js | 14 +++----
.../app/pods/manage/explore-new/route.js | 44 +++++++++++++---------
.../app/pods/manage/explore-new/template.hbs | 1 +
4 files changed, 47 insertions(+), 30 deletions(-)
diff --git a/thirdeye/thirdeye-frontend/app/pods/components/self-serve-alert-yaml-details/template.hbs b/thirdeye/thirdeye-frontend/app/pods/components/self-serve-alert-yaml-details/template.hbs
index 91da016..2727da4 100644
--- a/thirdeye/thirdeye-frontend/app/pods/components/self-serve-alert-yaml-details/template.hbs
+++ b/thirdeye/thirdeye-frontend/app/pods/components/self-serve-alert-yaml-details/template.hbs
@@ -1,7 +1,7 @@
<div class="te-search-results__header">
<div class="te-search-results__title-group">
<div class="te-search-results__title">
- <span title={{alertData.functionName}}>{{alertData.functionName}}</span>
+ <span title={{alertData.detectionName}}>{{alertData.detectionName}}</span>
<div class="te-search-results__tag {{if (eq displayMode "list") "te-search-results__tag--list"}} {{if alertData.isActive "te-search-results__tag--active"}}">
{{#if isLoadError}}
Error
@@ -11,7 +11,7 @@
</div>
{{#if (eq displayMode "list")}}
{{#link-to "manage.explore-new" alertData.id}}
- <div class="te-search-results__title-name" title={{alertData.functionName}}>{{alertData.functionName}}</div>
+ <div class="te-search-results__title-name" title={{alertData.detectionName}}>{{alertData.detectionName}}</div>
{{/link-to}}
{{/if}}
<h4 class="te-alert-page__subtitle">{{alertData.description}}</h4>
@@ -29,9 +29,9 @@
</li>
<li class="te-search-results__row">
<div class="te-search-results__option te-search-results__option--{{modeSubClass}} te-search-results__option--left">Dataset</div>
- <div class="te-search-results__value{{valueClassSuffix}}" title={{alertData.collection}}>
- <span class="{{unless alertData.collection 'te-search-results__prop--missing' 'te-search-results__prop'}}">
- {{if alertData.collection alertData.collection 'N/A'}}
+ <div class="te-search-results__value{{valueClassSuffix}}" title={{alertData.dataset}}>
+ <span class="{{unless alertData.dataset 'te-search-results__prop--missing' 'te-search-results__prop'}}">
+ {{if alertData.dataset alertData.dataset 'N/A'}}
</span>
</div>
</li>
@@ -77,6 +77,14 @@
</span>
</div>
</li>
+ <li class="te-search-results__row">
+ <div class="te-search-results__option te-search-results__option--{{modeSubClass}} te-search-results__option--left">Subscribed Groups</div>
+ <div class="te-search-results__value{{valueClassSuffix}}" title={{subscribedGroups}}>
+ <span class="{{unless subscribedGroups 'te-search-results__prop--missing' 'te-search-results__prop'}}">
+ {{if subscribedGroups subscribedGroups 'N/A'}}
+ </span>
+ </div>
+ </li>
</div>
</ul>
{{/if}}
diff --git a/thirdeye/thirdeye-frontend/app/pods/manage/alerts/index/route.js b/thirdeye/thirdeye-frontend/app/pods/manage/alerts/index/route.js
index 61b8665..34ce8f0 100644
--- a/thirdeye/thirdeye-frontend/app/pods/manage/alerts/index/route.js
+++ b/thirdeye/thirdeye-frontend/app/pods/manage/alerts/index/route.js
@@ -37,7 +37,7 @@ export default Route.extend({
// Work only with valid alerts - with metric association
let alerts = model.rawAlerts.filter(alert => isPresent(alert.metric));
- // Itereate through config groups to enhance all alerts with extra properties (group name, application)
+ // Iterate through config groups to enhance all alerts with extra properties (group name, application)
for (let config of model.subscriberGroups) {
let groupFunctionIds = config.emailConfig && config.emailConfig.functionIds ? config.emailConfig.functionIds : [];
for (let id of groupFunctionIds) {
@@ -45,7 +45,7 @@ export default Route.extend({
if (foundAlert) {
Object.assign(foundAlert, {
application: config.application,
- group: config.name
+ group: foundAlert.group ? foundAlert.group + ", " + config.name : config.name
});
}
}
@@ -72,15 +72,15 @@ export default Route.extend({
});
}
- // Itereate through detection alerter to enhance all yaml alert with extra properties (group name, application)
- for (let detectionAlert of model.detectionAlertConfig){
- const detectionConfigIds = Object.keys(detectionAlert.vectorClocks);
+ // Iterate through detection alerter to enhance all yaml alert with extra properties (group name, application)
+ for (let subscriptionGroup of model.detectionAlertConfig){
+ const detectionConfigIds = Object.keys(subscriptionGroup.vectorClocks);
for (let id of detectionConfigIds) {
let foundAlert = yamlAlerts.find(yamlAlert => yamlAlert.id.toString() === id);
if (foundAlert) {
Object.assign(foundAlert, {
- application: detectionAlert.application,
- group: detectionAlert.name
+ application: subscriptionGroup.application,
+ group: foundAlert.group ? foundAlert.group + ", " + subscriptionGroup.name : subscriptionGroup.name
});
}
}
diff --git a/thirdeye/thirdeye-frontend/app/pods/manage/explore-new/route.js b/thirdeye/thirdeye-frontend/app/pods/manage/explore-new/route.js
index 7b65a14..d219d42 100644
--- a/thirdeye/thirdeye-frontend/app/pods/manage/explore-new/route.js
+++ b/thirdeye/thirdeye-frontend/app/pods/manage/explore-new/route.js
@@ -8,6 +8,7 @@ import RSVP from 'rsvp';
import { set, get } from '@ember/object';
import { inject as service } from '@ember/service';
import yamljs from 'yamljs';
+import moment from 'moment';
export default Route.extend({
notifications: service('toast'),
@@ -29,25 +30,23 @@ export default Route.extend({
notifications.error('Retrieval of alert yaml failed.', 'Error');
} else {
if (detection_json.yaml) {
- const detectionYaml = yamljs.parse(detection_json.yaml);
+ const detectionInfo = yamljs.parse(detection_json.yaml);
const lastDetection = new Date(detection_json.lastTimestamp);
- Object.assign(detectionYaml, {
- lastDetectionTime: lastDetection.toDateString() + ", " + lastDetection.toLocaleTimeString() + " (" + Intl.DateTimeFormat().resolvedOptions().timeZone + ")",
+ Object.assign(detectionInfo, {
isActive: detection_json.active,
createdBy: detection_json.createdBy,
updatedBy: detection_json.updatedBy,
- functionName: detectionYaml.detectionName,
- collection: detectionYaml.dataset,
- type: detectionYaml.pipelineType,
exploreDimensions: detection_json.dimensions,
- filters: this._formatYamlFilter(detectionYaml.filters),
- dimensionExploration: this._formatYamlFilter(detectionYaml.dimensionExploration),
- yaml: detection_json.yaml
+ filters: this._formatYamlFilter(detectionInfo.filters),
+ dimensionExploration: this._formatYamlFilter(detectionInfo.dimensionExploration),
+ lastDetectionTime: lastDetection.toDateString() + ", " + lastDetection.toLocaleTimeString() + " (" + moment.tz.guess() + ")",
+ rawYaml: detection_json.yaml
});
this.setProperties({
- alertHeaderFields: detectionYaml,
alertId: alertId,
+ detectionInfo,
+ rawDetectionYaml: get(this, 'detectionInfo') ? get(this, 'detectionInfo').rawYaml : null,
metricUrn: detection_json.properties.nested[0].nestedMetricUrns[0],
metricUrnList: detection_json.properties.nested[0].nestedMetricUrns
});
@@ -56,7 +55,6 @@ export default Route.extend({
}
} catch (error) {
notifications.error('Retrieving alert yaml failed.', error);
-
}
//subscription group fetch
@@ -74,16 +72,26 @@ export default Route.extend({
notifications.error('Retrieving subscription groups failed.', error);
}
- const subscriptionGroupYamlDisplay = typeof get(this, 'subscriptionGroups') === 'object' && get(this, 'subscriptionGroups').length > 0 ? get(this, 'subscriptionGroups')[0].yaml : get(this, 'subscriptionGroups').yaml;
- const subscriptionGroupId = typeof get(this, 'subscriptionGroups') === 'object' && get(this, 'subscriptionGroups').length > 0 ? get(this, 'subscriptionGroups')[0].id : get(this, 'subscriptionGroups').id;
+ let subscribedGroups = "";
+ if (typeof get(this, 'subscriptionGroups') === 'object' && get(this, 'subscriptionGroups').length > 0) {
+ const groups = get(this, 'subscriptionGroups');
+ for (let key in groups) {
+ if (groups.hasOwnProperty(key)) {
+ let group = groups[key];
+ if (subscribedGroups === "") {
+ subscribedGroups = group.name
+ } else {
+ subscribedGroups = subscribedGroups + ", " + group.name;
+ }
+ }
+ }
+ }
return RSVP.hash({
alertId,
- subscriptionGroupId,
- alertData: get(this, 'alertHeaderFields'),
- detectionYaml: get(this, 'detectionYaml') ? get(this, 'detectionYaml').yaml : null,
- subscriptionGroups: get(this, 'subscriptionGroups'),
- subscriptionGroupYamlDisplay,
+ alertData: get(this, 'detectionInfo'),
+ detectionYaml: get(this, 'rawDetectionYaml'),
+ subscribedGroups,
metricUrn: get(this, 'metricUrn'),
metricUrnList: get(this, 'metricUrnList') ? get(this, 'metricUrnList') : []
});
diff --git a/thirdeye/thirdeye-frontend/app/pods/manage/explore-new/template.hbs b/thirdeye/thirdeye-frontend/app/pods/manage/explore-new/template.hbs
index ff5671f..d0f178b 100644
--- a/thirdeye/thirdeye-frontend/app/pods/manage/explore-new/template.hbs
+++ b/thirdeye/thirdeye-frontend/app/pods/manage/explore-new/template.hbs
@@ -2,6 +2,7 @@
<div class="container">
{{#self-serve-alert-yaml-details
alertData=model.alertData
+ subscribedGroups=model.subscribedGroups
isLoadError=isLoadError
}}
<div class="te-search-results__cta">
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org