Loki: Introduce $__auto range variable for metric queries (#72690)

* Loki: Add  interpolation to backend

* Loki: Replace default variable  with  in frontend

* Loki: Update docs in query builder fro __auto

* Loki: Update test for change default __auto

* Loki: Remove  and  from suggestions as  should be used

* Update docs

* Update pkg/tsdb/loki/parse_query.go

* Fix backend lint

* Fix lint and test

* Update

* Update docs/sources/datasources/loki/template-variables/index.md

Co-authored-by: lwandz13 <126723338+lwandz13@users.noreply.github.com>

* Update public/app/plugins/datasource/loki/querybuilder/operationUtils.ts

Co-authored-by: Matias Chomicki <matyax@gmail.com>

---------

Co-authored-by: lwandz13 <126723338+lwandz13@users.noreply.github.com>
Co-authored-by: Matias Chomicki <matyax@gmail.com>
This commit is contained in:
Ivana Huckova
2023-08-03 16:27:23 +02:00
committed by GitHub
co-authored by lwandz13 Matias Chomicki
parent b1fd399c10
commit 7bb0ff7055
16 changed files with 103 additions and 61 deletions
@@ -47,11 +47,11 @@ You can use this variable type to specify any number of key/value filters, and G
For more information, refer to [Add ad hoc filters][add-template-variables-add-ad-hoc-filters].
## Use interval and range variables
## Use $\_\_auto variable for Loki metric queries
You can use some global built-in variables in query variables: `$__interval`, `$__interval_ms`, `$__range`, `$__range_s`, and `$__range_ms`.
Consider using the `$__auto` variable in your Loki metric queries, which will automatically be substituted with the [step value](https://grafana.com/docs/grafana/next/datasources/loki/query-editor/#options) for range queries, and with the selected time range's value (computed from the starting and ending times) for instant queries.
For more information, refer to [Global built-in variables][add-template-variables-global-variables].
For more information about variables, refer to [Global built-in variables][add-template-variables-global-variables].
## Label extraction and indexing in Loki