How to create a drop down in grafana dashboard which is based on sysdig metrics label

3.7k Views Asked by At

I am trying to create a drop down in grafana panel for the below metric :

cloud_storage_request_count{repo="github",method="create",region="ap-south",zone="ap-south-1"}

I want to create a dropdown based on labels region and zone in grafana dashboard like attached screenshot. Dropdown example

Please help. I am new to grafana and sysdig.

1

There are 1 best solutions below

2
On

To do that you need to go in your dashboard, then :

  • Settings > Variables > New
  • In the General block, you need to choose Query as the variable type.
  • In the Query Options block, you need to chose your datasource in the dropdown
  • Then, in the same block, you'll have a Query textfield. Here you have to use the grafana function called label_values

You can find the documentation for this function here.

So basically, for your use case, to retrieve the label value for the region label, you'll have something like this :

label_values(cloud_storage_request_count,region)