1

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.

Pixzium Media
  • 109
  • 2
  • 10

1 Answers1

4

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)
Marc ABOUCHACRA
  • 3,155
  • 12
  • 19
  • Thanks a lot. I am now seeing drop down for Zone and Region, but values are not shown. I guess i need to emit new fresh metrics , i think 2 days old metric is getting not loaded by grafana due to some reason. – Pixzium Media Jun 19 '21 at 16:05
  • 1
    You have a preview at the bottom of the "Add variable" page in Grafana. It will refresh any time you click outside the *Query* textbox. Thus, you should be able to test your query (or another one) without going back to your dashboard. – Marc ABOUCHACRA Jun 21 '21 at 07:57