Get query hints per query transaction

This commit is contained in:
David Kaltschmidt
2018-10-23 15:12:53 +02:00
parent 2e02a8c855
commit fbed57ab43
7 changed files with 122 additions and 140 deletions

View File

@@ -176,7 +176,6 @@ export class PrometheusDatasource {
return this.$q.all(allQueryPromise).then(responseList => {
let result = [];
let hints = [];
_.each(responseList, (response, index) => {
if (response.status === 'error') {
@@ -196,19 +195,13 @@ export class PrometheusDatasource {
end: queries[index].end,
query: queries[index].expr,
responseListLength: responseList.length,
responseIndex: index,
refId: activeTargets[index].refId,
};
const series = this.resultTransformer.transform(response, transformerOptions);
result = [...result, ...series];
if (queries[index].hinting) {
const queryHints = getQueryHints(series, this);
hints = [...hints, ...queryHints];
}
});
return { data: result, hints };
return { data: result };
});
}
@@ -437,6 +430,10 @@ export class PrometheusDatasource {
return state;
}
getQueryHints(query: string, result: any[]) {
return getQueryHints(query, result, this);
}
loadRules() {
this.metadataRequest('/api/v1/rules')
.then(res => res.data || res.json())