mirror of
https://github.com/grafana/grafana.git
synced 2025-07-29 13:22:28 +08:00

* Changes. to metadata in Manage users * changes to install section * Added titile * More changes. * Updated administration folder metadata, moved 2 files from installation folder. * Added links to Administration landing page, other metadata changes worked out. * Updated alerting section metadata. * Updated metadata of Auth section. Broke index and created separate Grafana Authentication section. * Added correct weight. * Updated metadata for the Best practices section. * Updated metadata in templates, broke Overview topic. * Updated subment Variable types metadata * Fixed yaml file and H1 description of Variables syntax topic. * Couple more metadata changes. * Added aliases files, as suggested by Diana.
29 lines
1.6 KiB
Markdown
29 lines
1.6 KiB
Markdown
+++
|
|
title = "Variables syntax and types"
|
|
keywords = ["grafana", "templating", "documentation", "guide", "template", "variable"]
|
|
type = "docs"
|
|
aliases = ["/docs/grafana/latest/reference/templating"]
|
|
[menu.docs]
|
|
identifier = "variables-syntax-types"
|
|
parent = "variables"
|
|
weight = 100
|
|
+++
|
|
|
|
# Variable syntax
|
|
|
|
Panel titles and metric queries can refer to variables using two different syntaxes:
|
|
|
|
- `$varname`
|
|
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
|
|
- `${var_name}` Use this syntax when you want to interpolate a variable in the middle of an expression.
|
|
- `${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.
|
|
- `[[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
|
|
interpolation, the variable value might be _escaped_ in order to conform to the syntax of the query language and where it is used.
|
|
For example, a variable used in a regex expression in an InfluxDB or Prometheus query will be regex escaped. Read the data source specific
|
|
documentation topic for details on value escaping during interpolation.
|
|
|
|
For advanced syntax to override data source default formatting, refer to [Advanced variable format options]({{< relref "advanced-variable-format-options.md" >}}).
|