Commit 8243ac39 by Mitsuhiro Tanda

fix parameter format

parent fe1d395d
...@@ -87,7 +87,7 @@ func (e *CloudWatchExecutor) executeTimeSeriesQuery(ctx context.Context, queryCo ...@@ -87,7 +87,7 @@ func (e *CloudWatchExecutor) executeTimeSeriesQuery(ctx context.Context, queryCo
} }
currentlyExecuting++ currentlyExecuting++
go func(refId string, index int) { go func(refId string, index int) {
queryRes, err := e.executeQuery(ctx, queryContext.Queries[index].Model.Get("parameters"), queryContext) queryRes, err := e.executeQuery(ctx, queryContext.Queries[index].Model, queryContext)
currentlyExecuting-- currentlyExecuting--
if err != nil { if err != nil {
errCh <- err errCh <- err
......
...@@ -48,14 +48,13 @@ function (angular, _, moment, dateMath, kbn, templatingVariable, CloudWatchAnnot ...@@ -48,14 +48,13 @@ function (angular, _, moment, dateMath, kbn, templatingVariable, CloudWatchAnnot
item.dimensions = dimensions; item.dimensions = dimensions;
item.period = self.getPeriod(item, options); item.period = self.getPeriod(item, options);
return { return _.extend({
refId: item.refId, refId: item.refId,
intervalMs: options.intervalMs, intervalMs: options.intervalMs,
maxDataPoints: options.maxDataPoints, maxDataPoints: options.maxDataPoints,
datasourceId: self.instanceSettings.id, datasourceId: self.instanceSettings.id,
type: 'timeSeriesQuery', type: 'timeSeriesQuery',
parameters: item }, item);
};
}); });
// No valid targets, return the empty result to save a round trip. // No valid targets, return the empty result to save a round trip.
...@@ -147,15 +146,14 @@ function (angular, _, moment, dateMath, kbn, templatingVariable, CloudWatchAnnot ...@@ -147,15 +146,14 @@ function (angular, _, moment, dateMath, kbn, templatingVariable, CloudWatchAnnot
from: range.from, from: range.from,
to: range.to, to: range.to,
queries: [ queries: [
{ _.extend({
refId: 'metricFindQuery', refId: 'metricFindQuery',
intervalMs: 1, // dummy intervalMs: 1, // dummy
maxDataPoints: 1, // dummy maxDataPoints: 1, // dummy
datasourceId: this.instanceSettings.id, datasourceId: this.instanceSettings.id,
type: 'metricFindQuery', type: 'metricFindQuery',
subtype: subtype, subtype: subtype
parameters: parameters }, parameters)
}
] ]
}).then(function (r) { return transformSuggestDataFromTable(r); }); }).then(function (r) { return transformSuggestDataFromTable(r); });
}; };
......
import "../datasource"; import "../datasource";
import {describe, beforeEach, it, expect, angularMocks} from 'test/lib/common'; import {describe, beforeEach, it, expect, angularMocks} from 'test/lib/common';
import helpers from 'test/specs/helpers'; import helpers from 'test/specs/helpers';
...@@ -76,11 +75,11 @@ describe('CloudWatchDatasource', function() { ...@@ -76,11 +75,11 @@ describe('CloudWatchDatasource', function() {
it('should generate the correct query', function(done) { it('should generate the correct query', function(done) {
ctx.ds.query(query).then(function() { ctx.ds.query(query).then(function() {
var params = requestParams.queries[0]; var params = requestParams.queries[0];
expect(params.parameters.namespace).to.be(query.targets[0].namespace); expect(params.namespace).to.be(query.targets[0].namespace);
expect(params.parameters.metricName).to.be(query.targets[0].metricName); expect(params.metricName).to.be(query.targets[0].metricName);
expect(params.parameters.dimensions['InstanceId']).to.be('i-12345678'); expect(params.dimensions['InstanceId']).to.be('i-12345678');
expect(params.parameters.statistics).to.eql(query.targets[0].statistics); expect(params.statistics).to.eql(query.targets[0].statistics);
expect(params.parameters.period).to.be(query.targets[0].period); expect(params.period).to.be(query.targets[0].period);
done(); done();
}); });
ctx.$rootScope.$apply(); ctx.$rootScope.$apply();
...@@ -110,7 +109,7 @@ describe('CloudWatchDatasource', function() { ...@@ -110,7 +109,7 @@ describe('CloudWatchDatasource', function() {
ctx.ds.query(query).then(function() { ctx.ds.query(query).then(function() {
var params = requestParams.queries[0]; var params = requestParams.queries[0];
expect(params.parameters.period).to.be(600); expect(params.period).to.be(600);
done(); done();
}); });
ctx.$rootScope.$apply(); ctx.$rootScope.$apply();
......
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