cloud-bulldozer / performance-dashboards

Performance dashboards from the Perf & Scale team
Apache License 2.0
18 stars 40 forks source link

Jsonnet CI

Performance dashboards

Jsonnet grafana dashboards

Managing grafana dashboards in a CVS is not an easy task, since the exported dashboards by Grafana do not have always the same json layout due to the nature of the own json format. When exporting a Grafana dashboard json keys may be exported in different order. In addition, dealing with such complex json files is not an easy task since it's usually required import & export the full dashboard to perform a minimal modification or update.

Jsonnet based dashboards is an effort to improve the manageability of grafana json dashboards by leveraging the libraries included at the project grafonnet-lib. But grafonnet-lib had a hard time to keep up with Grafana development, this resulted in it being under-maintained. Grafonnet jsonnet library which is generated from JSON Schemas generated by Grok, these schemas are generated directly from the Grafana repository to ensure Grafonnet can keep up with Grafana development. Using this mechanism of dashboards as code will improve versioning and make simplify collaboration.

How to

To make a change, simply update the desired .jsonnet dashboard file and push your changes. The project is configured to automatically render updated .jsonnet files into .json format.

Alternatively, you can render the jsonnet files manually by doing the following:

Render a jsonnet file is as simple as executing jsonnet <jsonnet_template>. The jsonnet binary is not included in this repo, though binary builds can be found in its official repository. A makefile has been included to automate jsonnet formatting and rendering tasks. Executing make downloads the jsonnet binary and renders the templates at the rendered directory.

$ make
mkdir -p bin rendered
Downloading jsonnet binary
curl -s -L https://github.com/google/go-jsonnet/releases/download/v0.20.0/go-jsonnet_0.20.0_Linux_x86_64.tar.gz | tar xz -C bin
Downloading jb binary
curl -s -L https://github.com/jsonnet-bundler/jsonnet-bundler/releases/latest/download/jb-linux-amd64 -o bin/jb
chmod +x bin/jb
Downloading vendor files
cd templates && ../bin/jb install && cd ../
GET https://github.com/grafana/grafonnet/archive/f40876da40d787e9c288de0b547ac85597c781d9.tar.gz 200
GET https://github.com/grafana/grafonnet/archive/f40876da40d787e9c288de0b547ac85597c781d9.tar.gz 200
GET https://github.com/jsonnet-libs/docsonnet/archive/cc9df63eaca56f39e8e4e1ce192141333257b08d.tar.gz 200
GET https://github.com/jsonnet-libs/xtd/archive/0256a910ac71f0f842696d7bca0bf01ea77eb654.tar.gz 200
bin/jsonnetfmt -i templates/General/ocp-performance-v2.jsonnet
Building template templates/General/ocp-performance-v2.jsonnet
mkdir -p rendered/General/
bin/jsonnet -J ./templates/vendor templates/General/ocp-performance-v2.jsonnet > rendered/General/ocp-performance-v2.json

In order to clean up the environment execute make clean.

In order to lint the templates using jsonnetfmtexecute make format

$ make clean
Cleaning up
rm -rf bin rendered tmp templates/grafonnet-lib

Templates available

Dashboards Available after Migration to Grafonnet v10.1.0(latest):

Dittybopper

Dittybopper is a tool meant to deploy a grafana instance with certain dashboards on top of a running OpenShift 4.X cluster. Find more info here

Contributing

To contribute to this repository submit a PR with your changes. If you're adding or modifying a panel, a screenshot with the changes you've make will ease reviewers work.

In addition, make sure to lint your modifications to jsonnet files if you don't want our CI to complain. You can do that executing make format.

Tested versions

The dashboards from this repository have been tested with Grafana 9.X