Influxdb: Fix issues with request creation and parsing (#21743)

This commit is contained in:
Andrej Ocenas
2020-01-27 18:21:41 +01:00
committed by GitHub
parent 7569a8608a
commit c3a19c6d98
5 changed files with 134 additions and 125 deletions

View File

@@ -204,7 +204,9 @@ export default class InfluxDatasource extends DataSourceApi<InfluxQuery, InfluxO
metricFindQuery(query: string, options?: any) {
const interpolated = this.templateSrv.replace(query, null, 'regex');
return this._seriesQuery(interpolated, options).then(() => this.responseParser.parse(query));
return this._seriesQuery(interpolated, options).then(resp => {
return this.responseParser.parse(query, resp);
});
}
getTagKeys(options: any = {}) {
@@ -323,7 +325,7 @@ export default class InfluxDatasource extends DataSourceApi<InfluxQuery, InfluxO
return result.data;
},
(err: any) => {
if (err.status !== 0 || err.status >= 300) {
if ((Number.isInteger(err.status) && err.status !== 0) || err.status >= 300) {
if (err.data && err.data.error) {
throw {
message: 'InfluxDB Error: ' + err.data.error,
@@ -337,6 +339,8 @@ export default class InfluxDatasource extends DataSourceApi<InfluxQuery, InfluxO
config: err.config,
};
}
} else {
throw err;
}
}
);