You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2021/01/12 08:03:25 UTC

[GitHub] [incubator-pinot] harleyjj commented on a change in pull request #6333: [TE] frontend - harleyjj/rca - display metric funnel in metrics table…

harleyjj commented on a change in pull request #6333:
URL: https://github.com/apache/incubator-pinot/pull/6333#discussion_r555577154



##########
File path: thirdeye/thirdeye-frontend/app/pods/rootcause/controller.js
##########
@@ -305,140 +306,153 @@ export default Controller.extend({
    * callgraph:        service call graph edges as ranked by the backend
    *                   (typically displayed in call graph table)
    */
-  _contextObserver: observer(
-    'context',
-    'entities',
-    'selectedUrns',
-    'sizeMetricUrns',
-    'activeTab',
-    function () {
-      const { context, selectedUrns, sizeMetricUrns, entitiesService, timeseriesService, aggregatesService, breakdownsService, scoresService, anomalyFunctionService, callgraphService, activeTab, setupMode } =
-        getProperties(this, 'context', 'selectedUrns', 'sizeMetricUrns', 'entitiesService', 'timeseriesService', 'aggregatesService', 'breakdownsService', 'scoresService', 'anomalyFunctionService', 'callgraphService', 'activeTab', 'setupMode');
-      if (!context || !selectedUrns) {
-        return;
-      }
-
-      if (setupMode === ROOTCAUSE_SETUP_MODE_CONTEXT) {
-        return;
-      }
-
-      //
-      // entities
-      //
-      const entitiesUrns = new Set([...selectedUrns, ...context.urns, ...context.anomalyUrns]);
-      entitiesService.request(context, entitiesUrns);
-
-      //
-      // related metrics
-      //
-      const anomalyMetricUrns = new Set();
-      const relatedMetricUrns = new Set();
-
-      if (activeTab === ROOTCAUSE_TAB_METRICS
-          || activeTab === ROOTCAUSE_TAB_TREND) {
-        const entities = get(this, 'entitiesService.entities'); // cache may be stale, fetch directly
-        filterPrefix(Object.keys(entities), 'thirdeye:metric:').forEach(urn => relatedMetricUrns.add(urn));
-      }
+  _contextObserver: observer('context', 'entities', 'selectedUrns', 'sizeMetricUrns', 'activeTab', function () {
+    const {
+      context,
+      selectedUrns,
+      sizeMetricUrns,
+      entitiesService,
+      timeseriesService,
+      aggregatesService,
+      breakdownsService,
+      scoresService,
+      anomalyFunctionService,
+      callgraphService,
+      activeTab,
+      setupMode
+    } = getProperties(
+      this,
+      'context',
+      'selectedUrns',
+      'sizeMetricUrns',
+      'entitiesService',
+      'timeseriesService',
+      'aggregatesService',
+      'breakdownsService',
+      'scoresService',
+      'anomalyFunctionService',
+      'callgraphService',
+      'activeTab',
+      'setupMode'
+    );
+    if (!context || !selectedUrns) {
+      return;
+    }
 
-      if (context.anomalyUrns.size > 0) {
-        filterPrefix(context.anomalyUrns, 'thirdeye:metric:').forEach(urn => anomalyMetricUrns.add(urn));
-      }
+    if (setupMode === ROOTCAUSE_SETUP_MODE_CONTEXT) {
+      return;
+    }
 
-      //
-      // timeseries
-      //
-      const timeseriesUrns = new Set(selectedUrns);
+    //
+    // entities
+    //
+    const entitiesUrns = new Set([...selectedUrns, ...context.urns, ...context.anomalyUrns]);
+    entitiesService.request(context, entitiesUrns);
+
+    //
+    // related metrics
+    //
+    const anomalyMetricUrns = new Set();
+    const relatedMetricUrns = new Set();
+
+    if (activeTab === ROOTCAUSE_TAB_METRICS || activeTab === ROOTCAUSE_TAB_TREND) {
+      const entities = get(this, 'entitiesService.entities'); // cache may be stale, fetch directly
+      filterPrefix(Object.keys(entities), 'thirdeye:metric:').forEach((urn) => relatedMetricUrns.add(urn));
+    }
 
-      if (activeTab === ROOTCAUSE_TAB_TREND) {
-        [...relatedMetricUrns].forEach(urn => {
-          timeseriesUrns.add(toCurrentUrn(urn));
-          timeseriesUrns.add(toBaselineUrn(urn));
-        });
-      }
+    if (context.anomalyUrns.size > 0) {
+      filterPrefix(context.anomalyUrns, 'thirdeye:metric:').forEach((urn) => anomalyMetricUrns.add(urn));
+    }
 
-      timeseriesService.request(context, timeseriesUrns);
-
-      //
-      // anomaly function baselines
-      //
-      const anomalyFunctionUrns = filterPrefix(context.anomalyUrns, 'thirdeye:event:anomaly');
-      anomalyFunctionService.request(context, new Set(anomalyFunctionUrns));
-
-      //
-      // breakdowns
-      //
-      if (activeTab === ROOTCAUSE_TAB_DIMENSIONS) {
-        const metricUrns = new Set(filterPrefix(context.urns, 'thirdeye:metric:'));
-        const currentUrns = [...metricUrns].map(toCurrentUrn);
-        const baselineUrns = [...metricUrns].map(toBaselineUrn);
-        const sizeMetricCurrentUrns = [...sizeMetricUrns].map(toCurrentUrn);
-        breakdownsService.request(context, new Set(currentUrns.concat(baselineUrns).concat(sizeMetricCurrentUrns)));
-      }
+    //
+    // timeseries
+    //
+    const timeseriesUrns = new Set(selectedUrns);
 
-      //
-      // scores
-      //
-      if (activeTab === ROOTCAUSE_TAB_METRICS) {
-        const scoresUrns = new Set(relatedMetricUrns);
-        scoresService.request(context, new Set(scoresUrns));
-      }
+    if (activeTab === ROOTCAUSE_TAB_TREND) {
+      [...relatedMetricUrns].forEach((urn) => {
+        timeseriesUrns.add(toCurrentUrn(urn));
+        timeseriesUrns.add(toBaselineUrn(urn));
+      });
+    }
 
-      //
-      // aggregates
-      //
-      const offsets = ['current', 'baseline', 'wo1w', 'wo2w'];
-      const offsetUrns = [...relatedMetricUrns]
-        .map(urn => [].concat(offsets.map(offset => toOffsetUrn(urn, offset))))
-        .reduce((agg, l) => agg.concat(l), []);
-
-      const anomalyOffsets = ['current', 'baseline', 'wo1w', 'wo2w', 'wo3w', 'wo4w'];
-      const anomalyOffsetUrns = [...anomalyMetricUrns]
-        .map(urn => [].concat(anomalyOffsets.map(offset => toOffsetUrn(urn, offset))))
-        .reduce((agg, l) => agg.concat(l), []);
-
-      //
-      // call graph
-      //
-      if (activeTab === ROOTCAUSE_SERVICE_CALLGRAPH) {
-        callgraphService.request(context, [...context.urns]);
-      }
+    timeseriesService.request(context, timeseriesUrns);
+
+    //
+    // anomaly function baselines
+    //
+    const anomalyFunctionUrns = filterPrefix(context.anomalyUrns, 'thirdeye:event:anomaly');
+    anomalyFunctionService.request(context, new Set(anomalyFunctionUrns));
+
+    //
+    // breakdowns
+    //
+    if (activeTab === ROOTCAUSE_TAB_DIMENSIONS) {
+      const metricUrns = new Set(filterPrefix(context.urns, 'thirdeye:metric:'));
+      const currentUrns = [...metricUrns].map(toCurrentUrn);
+      const baselineUrns = [...metricUrns].map(toBaselineUrn);
+      const sizeMetricCurrentUrns = [...sizeMetricUrns].map(toCurrentUrn);
+      breakdownsService.request(context, new Set(currentUrns.concat(baselineUrns).concat(sizeMetricCurrentUrns)));
+    }
 
-      aggregatesService.request(context, new Set([...offsetUrns, ...anomalyOffsetUrns]));
+    //
+    // scores
+    //
+    if (activeTab === ROOTCAUSE_TAB_METRICS) {
+      const scoresUrns = new Set(relatedMetricUrns);
+      scoresService.request(context, new Set(scoresUrns));
+    }
 
+    //
+    // aggregates
+    //
+    const offsets =
+      context.compareMode === 'forecast'
+        ? ['current', 'baseline', 'yoy', 'upper', 'lower']

Review comment:
       The implementation is in this PR: https://github.com/apache/incubator-pinot/pull/6432




----------------------------------------------------------------
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



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