Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support __range_s variable in the Loki query editor. #25561

Closed
wardbekker opened this issue Jun 12, 2020 · 2 comments · Fixed by #36175
Closed

Support __range_s variable in the Loki query editor. #25561

wardbekker opened this issue Jun 12, 2020 · 2 comments · Fixed by #36175
Assignees
Labels
datasource/Loki prio/medium Important over the long term, but may not be staffed and/or may need multiple releases to complete. type/feature-request

Comments

@wardbekker
Copy link
Member

Like with Prometheus, upcoming Loki topK queries need the correct range to return the expected number of results. $__interval is supported, but this returns more results than the limit set in the topK, which is correct but counter-intuitive and not what is needed by the user. See also the Prometheus docs here:
https://grafana.com/docs/grafana/latest/features/datasources/prometheus/#templating

Loki is going to support the following syntax in upcoming versions:

topk(5, sum by (ipaddress) (count_over_time({filename="/var/log/nginx/access.log"} | regexp "(?P\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})"[10m])))

@ivanahuckova ivanahuckova added type/feature-request prio/high Must be staffed and worked on either currently, or very soon, ideally in time for the next release. labels Jul 2, 2020
@ivanahuckova ivanahuckova added prio/medium Important over the long term, but may not be staffed and/or may need multiple releases to complete. and removed prio/high Must be staffed and worked on either currently, or very soon, ideally in time for the next release. labels Nov 11, 2020
@candux
Copy link

candux commented Feb 26, 2021

I also wrestled with this problem for some time.
One workaround is to set "Max date points" in the Query Options to 1.
Then $__interval is always equal to what would be $__range

@Phara0h
Copy link

Phara0h commented Apr 16, 2021

Any updates on this bad boy?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
datasource/Loki prio/medium Important over the long term, but may not be staffed and/or may need multiple releases to complete. type/feature-request
Development

Successfully merging a pull request may close this issue.

5 participants