mirror of
https://github.com/grafana/grafana.git
synced 2025-02-14 01:23:32 -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) {
|
||||
subQueries.push(this.handleStreamingSearch(options, targets.traceql));
|
||||
subQueries.push(this.handleStreamingSearch(options, targets.traceql, queryValue));
|
||||
} else {
|
||||
subQueries.push(
|
||||
this._request('/api/search', {
|
||||
@ -430,22 +430,21 @@ export class TempoDatasource extends DataSourceWithBackend<TempoQuery, TempoJson
|
||||
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(
|
||||
options: DataQueryRequest<TempoQuery>,
|
||||
targets: TempoQuery[],
|
||||
query?: string
|
||||
query: string
|
||||
): Observable<DataQueryResponse> {
|
||||
const validTargets = targets
|
||||
.filter((t) => t.query || query)
|
||||
.map((t): TempoQuery => ({ ...t, query: query || t.query.trim() }));
|
||||
if (!validTargets.length) {
|
||||
if (query === '') {
|
||||
return EMPTY;
|
||||
}
|
||||
|
||||
return merge(
|
||||
...validTargets.map((q) =>
|
||||
...targets.map((target) =>
|
||||
doTempoChannelStream(
|
||||
q,
|
||||
{ ...target, query },
|
||||
this, // the datasource
|
||||
options,
|
||||
this.instanceSettings
|
||||
|
Loading…
Reference in New Issue
Block a user