loki: query chunking: consider refId when merging frames (#64103)

This commit is contained in:
Gábor Farkas 2023-03-03 10:06:25 +01:00 committed by GitHub
parent 76bc288d67
commit fdc4973b77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -315,13 +315,21 @@ export function requestSupportsPartitioning(allQueries: LokiQuery[]) {
return queries.length > 0;
}
function shouldCombine(frame1: DataFrame, frame2: DataFrame): boolean {
if (frame1.refId !== frame2.refId) {
return false;
}
return frame1.name === frame2.name;
}
export function combineResponses(currentResult: DataQueryResponse | null, newResult: DataQueryResponse) {
if (!currentResult) {
return cloneQueryResponse(newResult);
}
newResult.data.forEach((newFrame) => {
const currentFrame = currentResult.data.find((frame) => frame.name === newFrame.name);
const currentFrame = currentResult.data.find((frame) => shouldCombine(frame, newFrame));
if (!currentFrame) {
currentResult.data.push(cloneDataFrame(newFrame));
return;