mirror of
https://github.com/grafana/grafana.git
synced 2024-11-30 12:44:10 -06:00
5e38b02f94
* migrate queries that use multiple stats - squash commits * fix typo
27 lines
739 B
Go
27 lines
739 B
Go
package cloudwatch
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/aws/aws-sdk-go/aws"
|
|
"github.com/aws/aws-sdk-go/service/cloudwatch"
|
|
)
|
|
|
|
func (e *cloudWatchExecutor) buildMetricDataInput(startTime time.Time, endTime time.Time,
|
|
queries []*cloudWatchQuery) (*cloudwatch.GetMetricDataInput, error) {
|
|
metricDataInput := &cloudwatch.GetMetricDataInput{
|
|
StartTime: aws.Time(startTime),
|
|
EndTime: aws.Time(endTime),
|
|
ScanBy: aws.String("TimestampAscending"),
|
|
}
|
|
for _, query := range queries {
|
|
metricDataQuery, err := e.buildMetricDataQuery(query)
|
|
if err != nil {
|
|
return nil, &queryError{err, query.RefId}
|
|
}
|
|
metricDataInput.MetricDataQueries = append(metricDataInput.MetricDataQueries, metricDataQuery)
|
|
}
|
|
|
|
return metricDataInput, nil
|
|
}
|