grafana/loki

[docs] improve the documentation of query_range's interval param

Open

#9,459 opened on 2023年5月15日

GitHub で見る
 (3 comments) (0 reactions) (1 assignee)Go (28,187 stars) (3,997 forks)batch import
help wantedtype/docs

説明

the current documentation at https://grafana.com/docs/loki/latest/api/#query-loki-over-a-range-of-time says:

" Determines the sort order of logs. Supported values are forward or backward. Defaults to backward. "

i think it does not just control the sort order of the returned logs, it also controls where in time Loki begins to find log lines. if you go direction=backward, then the returned logs will start from the end timestamp, going in the direction of the start timestamp. and direction=forward does the opposite, the logs will start from the start timestamp, going in the direction of the end timestamp.

with an example: imagine i have a time-range that contains 6 log-lines, in timestamp-number-is-increasing order:

line1
line2
line3
line4
line5
line6
  • if i say limit=2&direction=forward, i get line1 and line2
  • if i say limit=2&direction=backward, i get line6 and line5

i think the documentation for the direction param should be improved to also describe this, because right now it may be interpreted as "it always returns the same log-lines, except in a different order"

コントリビューターガイド