albertodonato / query-exporter

Export Prometheus metrics from SQL queries
GNU General Public License v3.0
447 stars 103 forks source link

Does query-exporter reads and loads config.yaml only at start time or does it checks for changes periodically ? #127

Closed codemauri closed 2 years ago

codemauri commented 2 years ago

Is your feature request related to a problem? Please describe. I want to use a configuration manger on a Kubernetes deployment of the exporter. The integration kubernetes and config manager is already built and it delivers the config file to the pot /etc/config. The problem is every time there is a change to the config.yaml delivered...would the query-exporter detect it and reload the config.yaml or the query-exporter would need to be restarted for the config changes to become effective ? Also can the exporter read json format like config.json as well ?

Describe the solution you'd like I would like the exporter to include some sort of file watcher and reload config.yaml when it changes without having to restart the exporter. Also would like to be able to support the config file in both json or yaml

Describe alternatives you've considered Not really as its only that specific need.

Additional context N/A

albertodonato commented 2 years ago

Currently query-exporter doesn't re-read the configuration file after startup. It would be quite tricky doing so as not only database connections might change, but also exported queries. You can achieve the same result by restarting the service, or in the case of services running in k8s, you could just spawn a new container with the new config.

WRT configuration, json configuration will work fine as yaml is a superset of json and valid json is also valid yaml.