grafana/cortex-jsonnet

Mixtool generates empty alerts and rules

muecs opened this issue · 3 comments

muecs commented

When I follow the workflow as per the Makefile in v1.5.0 to generate alerts/rules/dashboards from the mixin I get empty alerts.yaml and rules.yaml files, i.e. contents are just {}. Dashboards are fine.

Steps to reproduce:

git clone -b 1.5.0 git@github.com:grafana/cortex-jsonnet.git
cd cortex-jsonnet
docker run -it --rm -v $PWD:/src -w /src grafana/cortex-jsonnet-build-image:8ce0de1 make build-mixin
cat cortex-mixin/out/*.yaml

This outputs:

{}
{}

This also happens when I build the build image from scratch using the included Dockerfile.

What could I be doing wrong?

Edit: It works as expected when I revert parts of e75b06f to bring back the deleted jsonnet files and avoid mixtool.

I've had to replace "prometheusAlerts+::" with "prometheusAlerts+:" in alerts.libsonnet. I think mixtool's generate doesn't see hidden fields when looking for "prometheusAlerts": https://github.com/monitoring-mixins/mixtool/blob/bd0efc3ad2090d7f92cc53a0a8d453584a5645b0/pkg/mixer/eval.go#L27

Good catch!

This has been fixed in mixtool now.