How to add precise options in dropdown while creating variables?

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

  • What are you trying to achieve?
    I am trying to create a variable named Instances which gives me all the instances.
    For that I have a created the variable and using Label Values as resource.label.instances
    So now when I click on Instance dropdown I get a big string of instance like “projects/prj-gg-6ad1/locations/us-central1/instances/prod-kafka-general-us-central1” but I only want ''prod-kafka-general-us-central1".

  • How are you trying to achieve it?

{
“current”: {
“selected”: false,
“text”: “projects/prj-ft-psa-p-6ad1/locations/us-central1/instances/prod-redis-i-general-us-central1”,
“value”: “projects/prj-ft-psa-p-6ad1/locations/us-central1/instances/prod-redis-i-general-us-central1”
},
“datasource”: {
“type”: “stackdriver”,
“uid”: “IB9tbwA4z”
},
“definition”: “”,
“hide”: 0,
“includeAll”: false,
“label”: “Instance”,
“multi”: false,
“name”: “Instance”,
“options”: ,
“query”: {
“labelKey”: “resource.label.instance_id”,
“loading”: false,
“projectName”: “$project”,
“projects”: [
{
“label”: “prj-gg-6ad1/”,
“value”: “prj-gg-6ad1/”
},
{
“label”: “prj-gg1-6ad1/”,
“value”: “prj-gg1-6ad1/”
}
],
“refId”: “CloudMonitoringVariableQueryEditor-VariableQuery”,
“selectedMetricType”: “redis.googleapis.com/clients/blocked”,
“selectedQueryType”: “labelValues”,
“selectedSLOService”: “”,
“selectedService”: “kafka.googleapis.com”,
“sloServices”:
},

  • What happened?

  • What did you expect to happen?

  • 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.

  • Did you follow any online instructions? If so, what is the URL?

1 Like