Azure Monitor: Log Analytics response to data frames (#25297)

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
This commit is contained in:
Kyle Brandt
2020-06-05 12:32:10 -04:00
committed by GitHub
parent c3549f845e
commit ef61a64c46
13 changed files with 594 additions and 673 deletions

View File

@@ -6,6 +6,7 @@ import {
DataQuery,
DataSourceJsonData,
ScopedVars,
DataFrame,
} from '@grafana/data';
import { Observable, from, of } from 'rxjs';
import { config } from '..';
@@ -109,16 +110,34 @@ export class DataSourceWithBackend<
requestId,
})
.then((rsp: any) => {
return toDataQueryResponse(rsp);
const dqs = toDataQueryResponse(rsp);
if (this.processResponse) {
return this.processResponse(dqs);
}
return dqs;
})
.catch(err => {
err.isHandled = true; // Avoid extra popup warning
return toDataQueryResponse(err);
const dqs = toDataQueryResponse(err);
if (this.processResponse) {
return this.processResponse(dqs);
}
return dqs;
});
return from(req);
}
/**
* Optionally augment the response before returning the results to the
*/
processResponse?(res: DataQueryResponse): Promise<DataQueryResponse>;
/**
* Optionally process the results for display
*/
processDataFrameResult?(frame: DataFrame, idx: number): Promise<DataFrame>;
/**
* Override to skip executing a query
*