Why should I create Grafana dashboard as a code while I am having everything in UI?


I can do everything In UI of Grafana then Why should I go to coding of Dashboard. Please can anyone clear my doubt.

Creating dashboards as code can be advantageous in a number of circumstances.

One possible reason for creating your dashboards programmatically is to eliminate “toil”, which is defined in Google’s SRE Book as “the kind of work tied to running a production service that tends to be manual, repetitive, automatable, tactical, devoid of enduring value, and that scales linearly as a service grows.” If you find that you regularly have to go in and make changes to your dashboards through the UI which could be automated, that might be a good reason to use code to generate your dashboards.

Another reason to create dashboards programmatically is to implement the practice of Infrastructure as Code, which has a number of advantages. By creating your dashboards programmatically and storing them in a version-control system like Git, you can have a self-documenting system that can be easily tested, deployed, and rolled back if you find an issue. Martin Fowler has a post on the topic, and Atlassian’s Bamboo team has a useful page in their documentation.

These concepts apply to any kind of configuration or management, not just building dashboards through the UI.

1 Like