Skip to content

refactor output #552

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 20, 2024
Merged

refactor output #552

merged 4 commits into from
May 20, 2024

Conversation

inimaz
Copy link
Collaborator

@inimaz inimaz commented May 15, 2024

Goal of this PR

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

Before this PR

  • output.py file contains all the methods to output the emissions data.
  • prometheus folder contains the files to initialize the PrometheousOutput
...
├── output.py
├── prometheus
│   ├── __init__.py
│   ├── metric_definitions.py
│   ├── prometheus.py

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)

@inimaz inimaz changed the title refactor output methods refactor output May 20, 2024
@inimaz inimaz requested review from benoit-cty and SaboniAmine May 20, 2024 09:33
Copy link
Contributor

@benoit-cty benoit-cty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice organization, thanks !

@inimaz inimaz merged commit 149d078 into master May 20, 2024
8 checks passed
@inimaz inimaz deleted the feat/refactor-output-methods branch May 20, 2024 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants