From fdc4973b77688824c20634b6e1562bdc3e27e047 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Farkas?= Date: Fri, 3 Mar 2023 10:06:25 +0100 Subject: [PATCH] loki: query chunking: consider refId when merging frames (#64103) --- public/app/plugins/datasource/loki/queryUtils.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/public/app/plugins/datasource/loki/queryUtils.ts b/public/app/plugins/datasource/loki/queryUtils.ts index e2c3a80092c..ef040bfe73d 100644 --- a/public/app/plugins/datasource/loki/queryUtils.ts +++ b/public/app/plugins/datasource/loki/queryUtils.ts @@ -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;