diff --git a/public/app/plugins/datasource/graphite/config_ctrl.ts b/public/app/plugins/datasource/graphite/config_ctrl.ts index 03b501975ff..497c73a7c28 100644 --- a/public/app/plugins/datasource/graphite/config_ctrl.ts +++ b/public/app/plugins/datasource/graphite/config_ctrl.ts @@ -16,6 +16,7 @@ export class GraphiteConfigCtrl { graphiteVersions = [ {name: '0.9.x', value: '0.9'}, {name: '1.0.x', value: '1.0'}, + {name: '1.1.x', value: '1.1'}, ]; } diff --git a/public/app/plugins/datasource/graphite/gfunc.js b/public/app/plugins/datasource/graphite/gfunc.js index 5186550ae0a..3a6981e147e 100644 --- a/public/app/plugins/datasource/graphite/gfunc.js +++ b/public/app/plugins/datasource/graphite/gfunc.js @@ -822,6 +822,49 @@ function (_, $) { version: '1.0' }); + addFuncDef({ + name: 'seriesByTag', + category: categories.Special, + params: [ + { name: "tagExpression", type: "string" }, + { name: "tagExpression", type: "string", optional: true }, + { name: "tagExpression", type: "string", optional: true }, + { name: "tagExpression", type: "string", optional: true }, + ], + version: '1.1' + }); + + addFuncDef({ + name: "groupByTags", + category: categories.Special, + params: [ + { + name: "function", + type: "string", + options: ['sum', 'avg', 'maxSeries'] + }, + { name: "tag", type: "string" }, + { name: "tag", type: "string", optional: true }, + { name: "tag", type: "string", optional: true }, + { name: "tag", type: "string", optional: true }, + ], + defaultParams: ["sum", "tag"], + version: '1.1' + }); + + addFuncDef({ + name: "aliasByTags", + category: categories.Special, + params: [ + { name: "tag", type: "string" }, + { name: "tag", type: "string", optional: true }, + { name: "tag", type: "string", optional: true }, + { name: "tag", type: "string", optional: true }, + ], + defaultParams: ["tag"], + version: '1.1' + }); + _.each(categories, function(funcList, catName) { categories[catName] = _.sortBy(funcList, 'name'); }); @@ -873,7 +916,7 @@ function (_, $) { // if string contains ',' and next param is optional, split and update both if (this._hasMultipleParamsInString(strValue, index)) { _.each(strValue.split(','), function(partVal, idx) { - this.updateParam(partVal.trim(), idx); + this.updateParam(partVal.trim(), index + idx); }.bind(this)); return; } diff --git a/public/app/plugins/datasource/graphite/query_ctrl.ts b/public/app/plugins/datasource/graphite/query_ctrl.ts index dd0378c9468..545e59ed3ec 100644 --- a/public/app/plugins/datasource/graphite/query_ctrl.ts +++ b/public/app/plugins/datasource/graphite/query_ctrl.ts @@ -96,7 +96,8 @@ export class GraphiteQueryCtrl extends QueryCtrl { if ((index-1) >= func.def.params.length) { throw { message: 'invalid number of parameters to method ' + func.def.name }; } - this.addFunctionParameter(func, astNode.value, index, true); + var shiftBack = this.isShiftParamsBack(func); + this.addFunctionParameter(func, astNode.value, index, shiftBack); break; case 'metric': if (this.segments.length > 0) { @@ -113,6 +114,10 @@ export class GraphiteQueryCtrl extends QueryCtrl { } } + isShiftParamsBack(func) { + return func.def.name !== 'seriesByTag'; + } + getSegmentPathUpTo(index) { var arr = this.segments.slice(0, index);