Skip to content

Add support for prometheus rule files

Matthias Käppler requested to merge mk/prometheus-rule-files into master

I need to test recording rules for the Usage Ping topology feature. However, with our current setup, there wasn't an easy way to tell Prometheus where to look for .rules files or to persist them, since you don't want to lose them every time you remove the container.

What I ended up doing was:

  • create a prometheus_conf volume and mount it to /etc/prometheus
  • extend prometheus.yml config to add a rule_files section pointing to that volume

I decided to use a volume because I didn't want to lose my rule definitions every time the container is removed. Another option could be to mount a local directory e.g. from within the GCK folder itself? The good thing is it doesn't have to exist; if the path is invalid, Prometheus will still start up properly. But I wasn't sure which folder that should be if we mount it, and whether that should be a new volume in itself (with the local driver?)

Happy for better suggestions!

Merge request reports