Commit fa6e31c6 by Erik Sundell

stackdriver: adds null check to query

parent 8b72853d
......@@ -12,15 +12,23 @@ export default class StackdriverDatasource {
}
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({
url: '/api/tsdb/query',
......
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