loki: backend-mode: fix experimental stream-mode (#48936)

This commit is contained in:
Gábor Farkas 2022-05-16 08:28:41 +02:00 committed by GitHub
parent c1b56e79ef
commit 8b9419222a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -175,6 +175,17 @@ export class LokiDatasource
targets: request.targets.map(getNormalizedLokiQuery),
};
const streamQueries = fixedRequest.targets.filter((q) => q.queryType === LokiQueryType.Stream);
if (config.featureToggles.lokiLive && streamQueries.length > 0 && fixedRequest.rangeRaw?.to === 'now') {
// this is still an in-development feature,
// we do not support mixing stream-queries with normal-queries for now.
const streamRequest = {
...fixedRequest,
targets: streamQueries,
};
return merge(...streamQueries.map((q) => doLokiChannelStream(q, this, streamRequest)));
}
if (fixedRequest.liveStreaming) {
return this.runLiveQueryThroughBackend(fixedRequest);
} else {