Docs: Update template variable overview to contain the preferred variable syntax (#25176)

* Update templates-and-variables.md

Fixes #13744

* Update templates-and-variables.md

* Update templates-and-variables.md

* Update docs/sources/variables/templates-and-variables.md

Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>

* Update docs/sources/variables/templates-and-variables.md

Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>

* Update docs/sources/variables/templates-and-variables.md

Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>

Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>
This commit is contained in:
Torkel Ödegaard 2020-05-28 17:28:24 +02:00 committed by GitHub
parent 6191e08080
commit 3532d08cbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -43,9 +43,9 @@ Panel titles and metric queries can refer to variables using two different synta
- `$varname` - `$varname`
This syntax is easy to read, but it does not allow you to use a variable in the middle of a word. This syntax is easy to read, but it does not allow you to use a variable in the middle of a word.
**Example:** apps.frontend.$server.requests.count **Example:** apps.frontend.$server.requests.count
- `[[varname]]` - `${var_name}` Use this syntax when you want to interpolate a variable in the middle of an expression.
**Note:** This syntax might be deprecated in the future. - `${var_name:<format>}` This format gives you more control over how Grafana interpolates values. Refer to [Advanced variable format options]({{< relref "advanced-variable-format-options.md" >}}) for more detail on all the formatting types.
Example: apps.frontend.[[server]].requests.count - `[[varname]]` Do not use. Deprecated old syntax, will be removed in a future release.
Before queries are sent to your data source the query is _interpolated_, meaning the variable is replaced with its current value. During Before queries are sent to your data source the query is _interpolated_, meaning the variable is replaced with its current value. During
interpolation, the variable value might be _escaped_ in order to conform to the syntax of the query language and where it is used. interpolation, the variable value might be _escaped_ in order to conform to the syntax of the query language and where it is used.