Currently these are populated within the main routine in the Collect method on the ec2 package. It means that every time the exporter goes to collect the metrics, it stops to first check if the compute one is outdated, if it is, populate it, and then the same for the storage one, before moving on to actually collecting the metrics that we want to expose.
Follow up to https://github.com/grafana/cloudcost-exporter/issues/235
Currently these are populated within the main routine in the Collect method on the
ec2
package. It means that every time the exporter goes to collect the metrics, it stops to first check if the compute one is outdated, if it is, populate it, and then the same for the storage one, before moving on to actually collecting the metrics that we want to expose.This responsibility should not belong to the Collect method. Instead, we could follow the same pattern as the
aks
package:New
function instead of theCollect
oneCollect
function