stackdriver: move response parsing to datasource file
This commit is contained in:
@@ -70,7 +70,7 @@ export default class StackdriverDatasource {
|
||||
}
|
||||
|
||||
async getLabels(metricType, refId) {
|
||||
return await this.getTimeSeries({
|
||||
const response = await this.getTimeSeries({
|
||||
targets: [
|
||||
{
|
||||
refId: refId,
|
||||
@@ -84,6 +84,8 @@ export default class StackdriverDatasource {
|
||||
],
|
||||
range: this.timeSrv.timeRange(),
|
||||
});
|
||||
|
||||
return response.results[refId];
|
||||
}
|
||||
|
||||
interpolateGroupBys(groupBys: string[], scopedVars): string[] {
|
||||
|
||||
@@ -150,10 +150,10 @@ export class StackdriverFilterCtrl {
|
||||
async getLabels() {
|
||||
this.loadLabelsPromise = new Promise(async resolve => {
|
||||
try {
|
||||
const data = await this.datasource.getLabels(this.target.metricType, this.target.refId);
|
||||
this.metricLabels = data.results[this.target.refId].meta.metricLabels;
|
||||
this.resourceLabels = data.results[this.target.refId].meta.resourceLabels;
|
||||
this.resourceTypes = data.results[this.target.refId].meta.resourceTypes;
|
||||
const { meta } = await this.datasource.getLabels(this.target.metricType, this.target.refId);
|
||||
this.metricLabels = meta.metricLabels;
|
||||
this.resourceLabels = meta.resourceLabels;
|
||||
this.resourceTypes = meta.resourceTypes;
|
||||
resolve();
|
||||
} catch (error) {
|
||||
if (error.data && error.data.message) {
|
||||
|
||||
Reference in New Issue
Block a user