Datasource variable

  • What Grafana version and what operating system are you using?
    Grafana v10.2.2

  • What are you trying to achieve?
    I want to use the datasource variable in a link

  • How are you trying to achieve it?

  1. I am defining a variable called ds in settings → variables which is for prometheus data sources
  2. I am defining a link in settings → link and using the variable ds defined for datasource above
  • What happened?
    Now I have upgraded to v10.2.2 the ds variable is the dsUID and not the dsName so my links no longer work as expected.

the confusing thing is that the ${ds} variable is ok if used in a panel title but nok if used in same panel content.

  • What did you expect to happen?
    The variable list as strings name for my defined data sources and I expected the variable to be the same i.e. the ds as a string and not the dsUID .

  • Can you copy/paste the configuration(s) that you are having problems with?
    “to”: “now”
    },
    “timepicker”: {},
    “timezone”: “”,
    “title”: “ds example”,
    “uid”: “ef9f697a-cd05-4668-8dec-5093b04e6f3a”,
    “version”: 3,
    “weekStart”: “”
    }

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
    No errors

  • Did you follow any online instructions? If so, what is the URL?
    None specific

Try:
${ds:text} - it should return datasource name
${ds:raw} - it should return datasource uid

Grafana uses name or uid automatically, based on the context. I guess you can override that magic with advance variable formatting.

1 Like

Thanks - works