Hardcode variable relationships without external datasource

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


I want a user friendly variable containing service names which controls multiple hidden variables containing values to be used in a panel query.

Is this possible without an external datasource? I’m using graffonet to generate my dashboard and it will be much easier to hardcode these relationships. I see several solutions online about doing this using prometheus, SQL, etc.

variable #1:

  • Name: services
  • Type: custom
  • Values: serviceA, serviceB, serviceC

variable #2:

  • Name: namespace
  • Type: custom
  • Values: serviceA : namespaceA, serviceB : namespaceB, serviceC : namespaceC

variable #3:

  • Name: loggroup
  • Type: custom
  • Values: serviceA : logGroupA, serviceB : logGroupB, serviceC : logGroupC

when a user selects variable $services=serviceA, variable values are:

  • $service = serviceA
  • $namespace = namespaceA
  • $loggroup = logGroupA

As far as I can tell, you can’t retrieve values from one variable by using another variable as the key such as $loggroup.${service}. Sorry if I’m missing something obvious, help is appreciated!