Skip to content

criteo/grafana-static-variables-datasource

Repository files navigation

Grafana Static Data Source Variable Plugin

CircleCI

This plugin allows you to serve static variables for your dashboards

How to use

Create a new datasource and paste a valid Map<string,string[]> in the json field of the configuration page

{ 
    "regions": ["Europe", "America", "Asia"], 
    "datacenters": ["Paris", "Milan", "NewYork", "Vancouver", "Sidney", "Singapour"] ,
    "Europe": ["Paris", "Milan"],
    "America": ["NewYork", "Vancouver"],
    "Asia": ["Sidney", "Singapour"]
}

Now add a new variable to one of your dashboards and select the datasource you just created
You can use any of the map key in the query field to return the associated list of values

This works pretty well with the new value groups/tags feature

Screenshots

Datasource configuration :
Datasource configuration

Variable configuration :
Datasource configuration

Dashboard variable :
Datasource configuration

Getting started

  1. Install dependencies
yarn install
  1. Build plugin in development mode or run in watch mode
yarn dev

or

yarn watch
  1. Build plugin in production mode
yarn build

Learn more