Jsonnet and Monitoring Mixins
Have you ever tried to template YAML? It’s a nightmare! Most templating languages like Jinja (used by Ansible and Salt), or even Go’s templating language, handle whitespace in generally unintuitive ways to most users. It’s devilishly easy to accidentally add extra space into a template’s output. Combined with YAML’s whitespace sensitivity, it’s a recipe for headaches. And yet – like it or not – YAML is the de-facto configuration language of the present time, used for everything from deploying apps to Kubernetes to configuring your Prometheus servers. So, how do we balance the tedious, error-prone management of large YAML files by hand with the arguably more error-prone desire to template our way out of the repetitiveness?
One solution that has seen relatively broad adoption within the Prometheus community is using a language called Jsonnet to handle generating YAML files. Jsonnet is a superset...