mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
loki: query chunking: consider refId when merging frames (#64103)
This commit is contained in:
parent
76bc288d67
commit
fdc4973b77
@ -315,13 +315,21 @@ export function requestSupportsPartitioning(allQueries: LokiQuery[]) {
|
|||||||
return queries.length > 0;
|
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) {
|
export function combineResponses(currentResult: DataQueryResponse | null, newResult: DataQueryResponse) {
|
||||||
if (!currentResult) {
|
if (!currentResult) {
|
||||||
return cloneQueryResponse(newResult);
|
return cloneQueryResponse(newResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
newResult.data.forEach((newFrame) => {
|
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) {
|
if (!currentFrame) {
|
||||||
currentResult.data.push(cloneDataFrame(newFrame));
|
currentResult.data.push(cloneDataFrame(newFrame));
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user