From 14d8c5796acdb1887466cbf054ddd16ae11d6fa7 Mon Sep 17 00:00:00 2001 From: Isabel Matwawana <76437239+imatwawana@users.noreply.github.com> Date: Fri, 16 May 2025 10:48:36 -0400 Subject: [PATCH] Docs: Improve raw format description and examples (#105410) --- .../variables/variable-syntax/index.md | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/docs/sources/dashboards/variables/variable-syntax/index.md b/docs/sources/dashboards/variables/variable-syntax/index.md index 644b67c01d4..fd876b86847 100644 --- a/docs/sources/dashboards/variables/variable-syntax/index.md +++ b/docs/sources/dashboards/variables/variable-syntax/index.md @@ -136,12 +136,23 @@ Interpolation result: 'test1.|test2' ### Raw -The raw format for a data source variable returns the UID (unique identifier) of the data source, rather than its name. +Doesn't apply any data source-specific formatting to the variable. + +For example, in this case, there's a dashboard with a Prometheus data source and a multi-value variable. +Grafana typically converts the variable values as follows to accommodate Prometheus: ```bash -datasourceVariable = 'd7bbe725-9e48-4af8-a0cb-6cb255d873a3' -String to interpolate: '${datasourceVariable:raw}' -Interpolation result: 'd7bbe725-9e48-4af8-a0cb-6cb255d873a3' +servers = ['test1.', 'test2'] +String to interpolate: '${servers}' +Interpolation result: '(test1 | test2)' +``` + +Using the raw format, the values are returned without that formatting: + +```bash +servers = ['test1.', 'test2'] +String to interpolate: '${servers:raw}' +Interpolation result: 'test1,test2' ``` ### Regex