You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current install function of BaseExporter class is:
classBaseExporter:
definstall(self) ->bool:
"""Install the exporter."""logger.info("Installing %s.", self.exporter_name)
config_success=self.render_config()
service_success=self.render_service(str(self.charm_dir), str(self.exporter_config_path))
ifnot (config_successandservice_success):
logger.error("Failed to install %s.", self.exporter_name)
returnFalsesystemd.daemon_reload()
# Verify installedifnot (self.exporter_config_path.exists() andself.exporter_service_path.exists()):
logger.error(f"{self.exporter_name} is not installed properly.")
returnFalselogger.info("%s installed.", self.exporter_name)
returnTrue
and the timing to trigger this install function is on
defget_exporter(exporter: BaseExporter):
"""Install and get an exporter"""ifexporter.exporter_service_path.exists():
returnexporterinstalled=exporter.install()
ifnotinstalled:
logger.error(f"Failed to install {exporter.exporter_name}")
returnreturnexporterclassHardwareObserverCharm(ops.CharmBase):
def__init__(self, *args: Any) ->None:
...
self.exporters= []
hardware_exporter=exporter_helpers.get_exporter(
HardwareExporter(self.charm_dir, self.model.config)
)
ifhardware_exporter:
self.exporters.append(hardware_exporter)
...
The logic only include the systemd service config file generate, which is because we hide the prometheus-hardware-exporter dependency in charm's packaging, which is working fine.
But this become a issue when now we need to include more exporter services which are not a python package. There is no hook we can use to handle the install process of the required resource/dependency for exporter.
The text was updated successfully, but these errors were encountered:
I suggest we split the get_exporter into get_installed_exporters (for getting the installed exporters instances, used in places other than install even) and install_exporters (for installation only, used in install or upgrade events) functions
On branch
/dev/refactor-multiple-exporter-support
The current install function of
BaseExporter
class is:and the timing to trigger this install function is on
The logic only include the systemd service config file generate, which is because we hide the
prometheus-hardware-exporter
dependency in charm's packaging, which is working fine.But this become a issue when now we need to include more exporter services which are not a python package. There is no hook we can use to handle the install process of the required resource/dependency for exporter.
The text was updated successfully, but these errors were encountered: