Only load metrics once in csv/json generators
Currently, as visible in pipeline job logs, we load each metric multiple times. For example: try searching for config/metrics/counts_7d/20210901223416_p_ci_templates_dart_weekly.yml
in this pipeline job.
This MR is aiming to remove one of the reasons to why we load metrics multiple times: in json
and csv
generators, we first loaded the metrics in initializer, saved them to an instance variable, and then fetched them again [instead of using the instance var].
We also need to have this improvement for another MR to not timeout jobs [MR, issue].
Edited by Michał Wielich