grafana/loki

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

Open

#9,459 建立於 2023年5月15日

在 GitHub 查看
 (3 留言) (0 反應) (1 負責人)Go (28,187 star) (3,997 fork)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"

貢獻者指南

[docs] improve the documentation of query_range's interval param · grafana/loki#9459 | Good First Issue