Parcourir la source

support metric trees of varying depth, never send '.select metric' to graphite

Dan Cech il y a 8 ans
Parent
commit
525ae4fdf5

+ 1 - 1
public/app/plugins/datasource/graphite/graphite_query.ts

@@ -152,7 +152,7 @@ export default class GraphiteQuery {
   updateModelTarget(targets) {
   updateModelTarget(targets) {
     // render query
     // render query
     if (!this.target.textEditor) {
     if (!this.target.textEditor) {
-      var metricPath = this.getSegmentPathUpTo(this.segments.length);
+      var metricPath = this.getSegmentPathUpTo(this.segments.length).replace(/\.select metric$/, '');
       this.target.target = _.reduce(this.functions, wrapFunction, metricPath);
       this.target.target = _.reduce(this.functions, wrapFunction, metricPath);
     }
     }
 
 

+ 1 - 4
public/app/plugins/datasource/graphite/query_ctrl.ts

@@ -219,10 +219,7 @@ export class GraphiteQueryCtrl extends QueryCtrl {
     this.updateModelTarget();
     this.updateModelTarget();
 
 
     if (this.queryModel.target !== oldTarget) {
     if (this.queryModel.target !== oldTarget) {
-      var lastSegment = this.segments.length > 0 ? this.segments[this.segments.length - 1] : {};
-      if (lastSegment.value !== 'select metric') {
-        this.panelCtrl.refresh();
-      }
+      this.panelCtrl.refresh();
     }
     }
   }
   }