diff --git a/public/app/plugins/datasource/graphite/graphite_query.ts b/public/app/plugins/datasource/graphite/graphite_query.ts index 3b29c57b808..54504219dad 100644 --- a/public/app/plugins/datasource/graphite/graphite_query.ts +++ b/public/app/plugins/datasource/graphite/graphite_query.ts @@ -152,7 +152,7 @@ export default class GraphiteQuery { updateModelTarget(targets) { // render query 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); } diff --git a/public/app/plugins/datasource/graphite/query_ctrl.ts b/public/app/plugins/datasource/graphite/query_ctrl.ts index f5daf01f7cc..d00ac90fe65 100644 --- a/public/app/plugins/datasource/graphite/query_ctrl.ts +++ b/public/app/plugins/datasource/graphite/query_ctrl.ts @@ -219,10 +219,7 @@ export class GraphiteQueryCtrl extends QueryCtrl { this.updateModelTarget(); 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(); } }