Commit 33aa3f0f by utkarshcmu

Made tag_values query more robust

parent e4e042e3
......@@ -168,7 +168,9 @@ function (angular, _, dateMath) {
return $q.when([]);
}
var keysArray = keys.split(",");
var keysArray = keys.split(",").map(function(key) {
return key.trim();
});
var key = keysArray[0];
var keysQuery = key + "=*";
......
......@@ -55,14 +55,14 @@ describe('opentsdb', function() {
ctx.ds.metricFindQuery('tag_values(cpu, hostname, env=$env)').then(function(data) { results = data; });
ctx.$rootScope.$apply();
expect(requestOptions.url).to.be('/api/search/lookup');
expect(requestOptions.params.m).to.be('cpu{hostname=*, env=$env}');
expect(requestOptions.params.m).to.be('cpu{hostname=*,env=$env}');
});
it('tag_values(cpu, test) should generate lookup query', function() {
ctx.ds.metricFindQuery('tag_values(cpu, hostname, env=$env, region=$region)').then(function(data) { results = data; });
ctx.$rootScope.$apply();
expect(requestOptions.url).to.be('/api/search/lookup');
expect(requestOptions.params.m).to.be('cpu{hostname=*, env=$env, region=$region}');
expect(requestOptions.params.m).to.be('cpu{hostname=*,env=$env,region=$region}');
});
it('suggest_tagk() should generate api suggest query', function() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment