grafana/loki

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

Offen

#9.459 geöffnet am 15.05.2023

 (3 Kommentare) (0 Reaktionen) (1 zugewiesene Person)Go (3.997 Forks)batch import
help wantedtype/docs

Repository-Metriken

Stars
 (28.187 Sterne)
PR-Merge-Metriken
 (Durchschn. Merge 5T 20h) (522 gemergte PRs in 30 T)

Beschreibung

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"

Contributor Guide