diff --git a/public/app/plugins/datasource/graphite/graphite_query.ts b/public/app/plugins/datasource/graphite/graphite_query.ts index 54504219dad..824b49f8860 100644 --- a/public/app/plugins/datasource/graphite/graphite_query.ts +++ b/public/app/plugins/datasource/graphite/graphite_query.ts @@ -120,6 +120,10 @@ export default class GraphiteQuery { this.segments.push({value: "select metric"}); } + hasSelectMetric() { + return this.segments[this.segments.length - 1].value === 'select metric'; + } + addFunction(newFunc) { this.functions.push(newFunc); this.moveAliasFuncLast(); diff --git a/public/app/plugins/datasource/graphite/query_ctrl.ts b/public/app/plugins/datasource/graphite/query_ctrl.ts index d00ac90fe65..a2e54903bcb 100644 --- a/public/app/plugins/datasource/graphite/query_ctrl.ts +++ b/public/app/plugins/datasource/graphite/query_ctrl.ts @@ -218,7 +218,7 @@ export class GraphiteQueryCtrl extends QueryCtrl { var oldTarget = this.queryModel.target.target; this.updateModelTarget(); - if (this.queryModel.target !== oldTarget) { + if (this.queryModel.target !== oldTarget && !this.queryModel.hasSelectMetric()) { this.panelCtrl.refresh(); } }