scaphandre
scaphandre copied to clipboard
Allow to run multiple exporters at once
Problem
For now, Scaphandre works by starting one exporter that will poll one sensor. If one wants to export the data to multiple destinations, another instance of Scaphandre is needed. It's making double the work, because the sensor will be the same for those two instances, only the exporter changes. Therefore, it's suboptimal (and less practical for the user).
Solution
It would be great to allow multiple exporters to run from the same sensor(s). (Note that I'm adding an "s" to sensors because for GPU support it would be good to have multiple sensors running in the same instance of Scaphandre).
To avoid the sensors' metrics to be regenerated for each exporter, I can think of the following scheme:
let sensor = init_sensor();
let exporters = init_all_exporters();
loop {
let metrics = sensor.generate_metrics(); // only generate the metrics once
for e in exporters {
e.accept_all(metrics); // export the same metrics with each exporter
}
sleep(interval);
}