mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Tempo: Replace template variables in TraceQL tab when streaming is enabled (#73259)
This commit is contained in:
parent
ed8ca02e0f
commit
d293b08e52
@ -228,7 +228,7 @@ export class TempoDatasource extends DataSourceWithBackend<TempoQuery, TempoJson
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (config.featureToggles.traceQLStreaming) {
|
if (config.featureToggles.traceQLStreaming) {
|
||||||
subQueries.push(this.handleStreamingSearch(options, targets.traceql));
|
subQueries.push(this.handleStreamingSearch(options, targets.traceql, queryValue));
|
||||||
} else {
|
} else {
|
||||||
subQueries.push(
|
subQueries.push(
|
||||||
this._request('/api/search', {
|
this._request('/api/search', {
|
||||||
@ -430,22 +430,21 @@ export class TempoDatasource extends DataSourceWithBackend<TempoQuery, TempoJson
|
|||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This function can probably be simplified by avoiding passing both `targets` and `query`,
|
||||||
|
// since `query` is built from `targets`, if you look at how this function is currently called
|
||||||
handleStreamingSearch(
|
handleStreamingSearch(
|
||||||
options: DataQueryRequest<TempoQuery>,
|
options: DataQueryRequest<TempoQuery>,
|
||||||
targets: TempoQuery[],
|
targets: TempoQuery[],
|
||||||
query?: string
|
query: string
|
||||||
): Observable<DataQueryResponse> {
|
): Observable<DataQueryResponse> {
|
||||||
const validTargets = targets
|
if (query === '') {
|
||||||
.filter((t) => t.query || query)
|
|
||||||
.map((t): TempoQuery => ({ ...t, query: query || t.query.trim() }));
|
|
||||||
if (!validTargets.length) {
|
|
||||||
return EMPTY;
|
return EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
return merge(
|
return merge(
|
||||||
...validTargets.map((q) =>
|
...targets.map((target) =>
|
||||||
doTempoChannelStream(
|
doTempoChannelStream(
|
||||||
q,
|
{ ...target, query },
|
||||||
this, // the datasource
|
this, // the datasource
|
||||||
options,
|
options,
|
||||||
this.instanceSettings
|
this.instanceSettings
|
||||||
|
Loading…
Reference in New Issue
Block a user