Made tag_values query more robust

This commit is contained in:
utkarshcmu 2016-06-13 14:21:46 -07:00
parent e4e042e389
commit 33aa3f0fc5
2 changed files with 5 additions and 3 deletions

View File

@ -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 + "=*";

View File

@ -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() {