Tempo: Fix multiple streaming TraceQL metrics queries being conflated into one (#114360)

* Correctly stream multiple metrics series

Signed-off-by: Joe Elliott <number101010@gmail.com>

* cleanup

Signed-off-by: Joe Elliott <number101010@gmail.com>

* prettier fix

---------

Signed-off-by: Joe Elliott <number101010@gmail.com>
Co-authored-by: Andre Pereira <adrapereira@gmail.com>
Co-authored-by: Zoltán Bedi <zoltan.bedi@gmail.com>
This commit is contained in:
Joe Elliott
2026-01-06 12:47:52 +00:00
committed by GitHub
co-authored by Andre Pereira Zoltán Bedi
parent 380154707b
commit 5fe192a893
2 changed files with 12 additions and 3 deletions
@@ -811,7 +811,7 @@ export class TempoDatasource extends DataSourceWithBackend<TempoQuery, TempoJson
return merge(
...targets.map((target) =>
doTempoSearchStreaming(
{ ...target, query },
{ ...target, query: this.applyVariables(target, options.scopedVars).query },
this, // the datasource
options,
this.instanceSettings
@@ -857,7 +857,7 @@ export class TempoDatasource extends DataSourceWithBackend<TempoQuery, TempoJson
return merge(
...targets.map((target) =>
doTempoMetricsStreaming(
{ ...target, query },
{ ...target, query: this.applyVariables(target, options.scopedVars).query },
this, // the datasource
options
)
@@ -5,6 +5,7 @@ import { v4 as uuidv4 } from 'uuid';
import {
DataFrame,
dataFrameFromJSON,
DataFrameJSON,
DataQueryRequest,
DataQueryResponse,
DataSourceInstanceSettings,
@@ -165,7 +166,15 @@ export function doTempoMetricsStreaming(
}
newResult = {
data: data?.map(dataFrameFromJSON) ?? [],
data:
data?.map((frame: DataFrameJSON) => {
const df = dataFrameFromJSON(frame);
// preserve the query's refId to prevent conflation of series from different queries
if (query.refId) {
df.refId = query.refId;
}
return df;
}) ?? [],
state,
};
}