@ -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].
return`${opDocs}\`$__interval\` is a variable that will be replaced with the [calculated interval](https://grafana.com/docs/grafana/latest/dashboards/variables/add-template-variables/#__interval) based on the time range and width of the graph. In Dashboards, you can affect the interval variable using **Max data points** and **Min interval**. You can find these options under **Query options** right of the data source select dropdown.`;
if(op.params[0]==='$__auto'){
return`${opDocs}\`$__auto\` is a variable that will be replaced with the [value of step](https://grafana.com/docs/grafana/next/datasources/loki/query-editor/#options) for range queries and with the value of the selected time range (calculated to - from) for instant queries.`;
}else{
return`${opDocs} The [range vector](https://grafana.com/docs/loki/latest/logql/metric_queries/#range-vector-aggregation) is set to \`${op.params[0]}\`.`;
}
@ -137,14 +137,14 @@ function operationWithRangeVectorRenderer(
innerExpr: string
){
constparams=model.params??[];
constrangeVector=params[0]??'$__interval';
constrangeVector=params[0]??'$__auto';
// QuantileOverTime is only range vector with more than one param