mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
(cloudwatch) move query parameter to 'parameters'
This commit is contained in:
parent
110f157621
commit
62d84c1e14
@ -62,9 +62,13 @@ func (e *CloudWatchExecutor) Execute(ctx context.Context, queries tsdb.QuerySlic
|
|||||||
|
|
||||||
currentlyExecuting := 0
|
currentlyExecuting := 0
|
||||||
for _, model := range queries {
|
for _, model := range queries {
|
||||||
|
queryType := model.Model.Get("type").MustString()
|
||||||
|
if queryType != "timeSeriesQuery" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
currentlyExecuting++
|
currentlyExecuting++
|
||||||
go func(refId string) {
|
go func(refId string) {
|
||||||
queryRes, err := e.executeQuery(ctx, model, queryContext)
|
queryRes, err := e.executeQuery(ctx, model.Model.Get("parameters"), queryContext)
|
||||||
currentlyExecuting--
|
currentlyExecuting--
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errCh <- err
|
errCh <- err
|
||||||
@ -130,8 +134,8 @@ func (e *CloudWatchExecutor) getClient(region string) (*cloudwatch.CloudWatch, e
|
|||||||
return client, nil
|
return client, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *CloudWatchExecutor) executeQuery(ctx context.Context, model *tsdb.Query, queryContext *tsdb.QueryContext) (*tsdb.QueryResult, error) {
|
func (e *CloudWatchExecutor) executeQuery(ctx context.Context, parameters *simplejson.Json, queryContext *tsdb.QueryContext) (*tsdb.QueryResult, error) {
|
||||||
query, err := parseQuery(model.Model)
|
query, err := parseQuery(parameters)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -48,12 +48,14 @@ 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 _.extend({
|
return {
|
||||||
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,
|
||||||
}, item);
|
type: 'timeSeriesQuery',
|
||||||
|
parameters: 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.
|
||||||
|
Loading…
Reference in New Issue
Block a user