|
@@ -12,15 +12,23 @@ export default class StackdriverDatasource {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
async getTimeSeries(options) {
|
|
async getTimeSeries(options) {
|
|
|
- const queries = options.targets.filter(target => !target.hide).map(t => ({
|
|
|
|
|
- refId: t.refId,
|
|
|
|
|
- datasourceId: this.id,
|
|
|
|
|
- metricType: t.metricType,
|
|
|
|
|
- primaryAggregation: t.aggregation.crossSeriesReducer,
|
|
|
|
|
- groupBys: t.aggregation.groupBys,
|
|
|
|
|
- view: t.view || 'FULL',
|
|
|
|
|
- filters: t.filters,
|
|
|
|
|
- }));
|
|
|
|
|
|
|
+ const queries = options.targets.filter(target => !target.hide).map(t => {
|
|
|
|
|
+ if (!t.hasOwnProperty('aggregation')) {
|
|
|
|
|
+ t.aggregation = {
|
|
|
|
|
+ crossSeriesReducer: 'REDUCE_MEAN',
|
|
|
|
|
+ groupBys: [],
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+ return {
|
|
|
|
|
+ refId: t.refId,
|
|
|
|
|
+ datasourceId: this.id,
|
|
|
|
|
+ metricType: t.metricType,
|
|
|
|
|
+ primaryAggregation: t.aggregation.crossSeriesReducer,
|
|
|
|
|
+ groupBys: t.aggregation.groupBys,
|
|
|
|
|
+ view: t.view || 'FULL',
|
|
|
|
|
+ filters: t.filters,
|
|
|
|
|
+ };
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
const { data } = await this.backendSrv.datasourceRequest({
|
|
const { data } = await this.backendSrv.datasourceRequest({
|
|
|
url: '/api/tsdb/query',
|
|
url: '/api/tsdb/query',
|