Cascading dropdowns


I am quite new to Grafana and I trying to create two cascading custom variables. Here is the scenario

I am using Version 10.0.1, on Windows 10

Variable 1:
name: env_name

Variable 2:
name: app_name
Values: (I want to achieve this scenario). But not sure how to achieve it in Grafana.
if(env_name == “Development”)
return “app_dev”
else if(env_name == “Test”)
return “app_tst”
else if(env_name == “Production”)
return “app_prd”

I tried doing this, but could not acheive it. As I do not know how to return the value out?

case {
$env_name = “Development” | app_name := “app_dev”;
$env_name = “Test” | app_name := “app-tst”;
$env_name = “Production” | app_name := “app-prd”;

How will you be using variable2 in your query? What is you query data source type? If you are not using the first variable in your dashboard make it simpler by using 1 variable with key values

Development : app_dev,Test : app_tst,Production : app_prd

@yosiasz : thanks for the reply

Actually Variable 1 it self connects to Humio datasource and gets the environment names.
Here is the query:
#app_name” = select([“#app_environment”])
Which returns me environment values “Development”, “Test”, “Production”
Which I use for Humio widgets.

I also have a widget which checks if the application is up and I have that information through Mimir metric. This query will give me the status of the app.


As you can see I want this query to run something like this

I do this because, the system is already setup like this. All log messages goto Humio datasource and metrics goto Mimir.

Hope you understand my issue :slight_smile:

1 Like