mlco2 / codecarbon

Track emissions from Compute and recommend ways to reduce their impact on the environment.
https://mlco2.github.io/codecarbon
MIT License
1k stars 157 forks source link

refactor output #552

Closed inimaz closed 1 month ago

inimaz commented 1 month ago

Goal of this PR

Refactor output so it is easier to add new output methods.

Before this PR


# After this PR

... ├── output.py ├── output_methods │ ├── init.py │ ├── base_output.py │ ├── emissions_data.py │ ├── file.py │ ├── http.py │ ├── logger.py │ └── metrics │ ├── init.py │ ├── metric_docs.py <==== contains metrics docs to be reused if we want to create other metrics (e.g. opentelemetry) │ └── prometheus │ ├── init.py │ ├── metrics.py │ └── prometheus.py


* The output methods are split by type (file output, output to logger, http, metrics...)
* `output.py` is only to simplify imports (we can remove it if needed)