[BUGFIX] Loki: dispatch to instant query when context.mode is instant#737
Merged
Merged
Conversation
tgitelman
force-pushed
the
fix/loki-instant-query-mode
branch
from
July 21, 2026 09:18
bf52d85 to
0574eab
Compare
jgbernalp
self-requested a review
July 21, 2026 09:44
jgbernalp
reviewed
Jul 21, 2026
jgbernalp
reviewed
Jul 21, 2026
jgbernalp
reviewed
Jul 21, 2026
tgitelman
force-pushed
the
fix/loki-instant-query-mode
branch
2 times, most recently
from
July 21, 2026 12:04
dd263f9 to
da60f25
Compare
Signed-off-by: Tal Gitelman <tgitelma@redhat.com>
tgitelman
force-pushed
the
fix/loki-instant-query-mode
branch
from
July 21, 2026 12:06
da60f25 to
56f6e6e
Compare
jgbernalp
approved these changes
Jul 21, 2026
Merged
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Ref: perses/perses#4270
getLokiTimeSeriesData()always callsclient.queryRange()regardless ofcontext.mode. When a panel requests instant mode (e.g. Table without column plugins), the Loki plugin ignores it and sendsquery_range— unlike the Prometheus plugin which checkscontext.modeand dispatches toinstantQuery()vsrangeQuery().This also causes empty results for large time ranges (14d+):
query_rangewith large range vectors triggers Loki'ssplit_queries_by_interval, which truncates lookback windows. The instant endpoint (/loki/api/v1/query) does not split and evaluates correctly.Changes
loki/src/queries/loki-time-series-query/get-loki-time-series-data.ts:context.mode— dispatch toclient.query()(/loki/api/v1/query) for instant modeconvertVectorToTimeSeries()to convert instant query vector responses to theTimeSeriesformatstreamsresultType (raw log queries without aggregation) returns empty — not applicable for time series panelsloki/src/queries/loki-time-series-query/loki-time-series-query-types.ts:LokiTimeSeriesQueryResponseto includeLokiQueryResponse(instant query responses)Reproduction
count_over_time(... [$__range])--log.level=debug)/loki/api/v1/query_range, zero instant queries/loki/api/v1/queryTest plan
/loki/api/v1/query(instant) requests when Table panel loadscount_over_time,sum_over_time) return correct single values