Commit dd745e0c by Erik Sundell

stackdriver: prevent backend query from being made when there are not yet any defined targets

parent 5deba92d
......@@ -50,16 +50,20 @@ export default class StackdriverDatasource {
};
});
const { data } = await this.backendSrv.datasourceRequest({
url: '/api/tsdb/query',
method: 'POST',
data: {
from: options.range.from.valueOf().toString(),
to: options.range.to.valueOf().toString(),
queries,
},
});
return data;
if (queries.length > 0) {
const { data } = await this.backendSrv.datasourceRequest({
url: '/api/tsdb/query',
method: 'POST',
data: {
from: options.range.from.valueOf().toString(),
to: options.range.to.valueOf().toString(),
queries,
},
});
return data;
} else {
return { results: [] };
}
}
async getLabels(metricType, refId) {
......
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