Query Variables in Dashboard not being populated

  • What Grafana version and what operating system are you using?
    11.3.1 and macOS

  • What are you trying to achieve?: I’m trying to build a grafana plugin that supports importing a pre-configured Dashboard which has query variables defined.

  • How are you trying to achieve it? I’m trying to implement CustomVariableSupport. I can see the backend query running and returning successful response. But the dropdown down in the UI is not being populated.

  • What happened? I was on version 11.1.1 earlier and implemented “DataSourceVariableSupport” to use the query editor to populate the query variables. After I upgraded to 11.3.1, I noticed the error “Couldn’t create a query runner for datasource” on the UI. After checking the createQueryVariableRunner.js script, looks like the only types supported are Legacy, Standard and Custom. Hence, tried implementing the CustomVariableSupport.

  • What did you expect to happen? I expected the successful response from the query to populate the query variable dropdown on the Dashboard screen.

  • Can you copy/paste the configuration(s) that you are having problems with?

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
    SceneVariableSet updateAndValidate error Error: Couldn’t create a query runner for datasource xyz
    at g_ (createQueryVariableRunner.js:113:9)
    at QueryVariable.js:73:24
    at M (mergeInternals.js:19:19)
    at P (mergeInternals.js:14:70)
    at C.L._next (OperatorSubscriber.js:15:21)

  • Did you follow any online instructions? If so, what is the URL?
    None. The below link refers to VariableQueryEditor but looks like that is deprecated.
    Add support for variables | Grafana Plugin Tools