Contributing to Balena Prometheus Exporter

This document outlines the steps to contribute to the Balena Prometheus Exporter project.

Understanding the Project

The Balena Prometheus Exporter project is a Python application packaged as a Docker container. It provides a Prometheus-compatible endpoint to expose metrics about Balena devices and services. Understanding the project’s structure and its purpose is crucial for effective contributions.

Setting Up Your Environment

  1. Fork the Repository: Start by forking the official Balena Prometheus Exporter repository on GitHub. This creates a personal copy of the project where you can make changes.
  2. Clone the Repository: Clone your forked repository to your local machine:
git clone [email protected]:<your-github-username>/balena-prometheus-exporter.git
  1. Create a Branch: Create a new branch for your changes:
git checkout -b feature/your-feature-name

Contributing to the Project

  1. Explore the Codebase: Familiarize yourself with the existing codebase by reading the source code and analyzing the existing implementation. Focus on the specific area you want to contribute to.
  2. Write Your Code: Implement your changes or features. Follow the existing coding style and structure.
  3. Add Unit Tests: If your contribution introduces new functionality or changes existing behavior, write comprehensive unit tests to ensure the correctness of your code.
  4. Run Tests: Execute the existing test suite to confirm that your changes do not introduce regressions.
  5. Document Your Changes: Clearly document any changes made to the code. Add explanations for the changes and update the documentation if necessary.
  6. Commit Your Changes: Stage your changes and commit them to your branch with a descriptive message.
  7. Push to Your Fork: Push your changes to your forked repository:
git push origin feature/your-feature-name

Submitting a Pull Request

  1. Create a Pull Request: Navigate to your forked repository on GitHub and create a pull request against the original screenly/balena-prometheus-exporter repository.
  2. Describe Your Changes: Provide a clear and detailed description of your changes in the pull request. Explain the rationale for the changes, highlight the benefits, and address any potential issues.
  3. Address Feedback: The maintainers of the project may review your pull request and provide feedback. Respond to their comments and address any suggested improvements or changes.
  4. Merge Your Changes: Once your pull request is reviewed and approved, the maintainers will merge your changes into the main branch.

CI/CD Pipeline

The project’s CI/CD pipeline likely includes automated tests and builds to ensure code quality and stability. Understanding the pipeline helps you assess the impact of your changes and ensure they meet the project’s standards.

Tips for Contributing

  • Start Small: Begin with small, focused changes. This makes it easier to review and integrate your contributions.
  • Communicate: Be clear in your communications with the maintainers. Ask questions if you need clarification.
  • Be Patient: The review process may take time. Remain patient and responsive to feedback.

By following these steps and maintaining a collaborative approach, you can contribute effectively to the Balena Prometheus Exporter project and help improve its functionality and usability.