This is a workaround for a memory leak that occurred when the long running process (exporter) was using libjuju directly. Things that have been changed:
CLI was split into two (mandatory) sub-commands export and collect
prometheus-juju-exporter collect gathers the data from controller and prints the output to STDOUT as a json
prometheus-juju-exporter export runs the Prometheus exporter and periodically executes prometheus-juju-exporter collect as a subprocess to get updated data
With this structure, libjuju objects are created only in the short-lived process prometheus-juju-exporter collect and therfore can't cause memory leak in the long living process prometheus-juju-exporter export
Note: This is just a working version to get some feedback. Unit tests were not adjusted yet.
This is a workaround for a memory leak that occurred when the long running process (exporter) was using libjuju directly. Things that have been changed:
export
andcollect
prometheus-juju-exporter collect
gathers the data from controller and prints the output to STDOUT as a jsonprometheus-juju-exporter export
runs the Prometheus exporter and periodically executesprometheus-juju-exporter collect
as a subprocess to get updated dataWith this structure, libjuju objects are created only in the short-lived process
prometheus-juju-exporter collect
and therfore can't cause memory leak in the long living processprometheus-juju-exporter export
Note: This is just a working version to get some feedback. Unit tests were not adjusted yet.
TODO before potential merge: