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:
co-authored by
Andre Pereira
Zoltán Bedi
parent
380154707b
commit
5fe192a893
@@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user