Skip to content

Latest commit

 

History

History
136 lines (86 loc) · 4.96 KB

CONTRIBUTING.md

File metadata and controls

136 lines (86 loc) · 4.96 KB

Contributing Guidelines

This project is licensed under the Apache 2.0 license and accepts contributions via GitHub pull requests. This document outlines some of the conventions on development workflow, commit message formatting, contact points and other resources to make it easier to get your contribution accepted.

Certificate of Origin

By contributing to this project you agree to sign a Contributor License Agreement(CLA).

Code of Conduct

Parca-agent follows CNCF Code of Conduct.

Prerequisites

  • Linux Kernel version 5.3+ with BTF
  • A source of targets to discover from: Kubernetes or systemd.

Install the following dependencies (Instructions are linked for each dependency).

Note: LLVM version 11 is enough to compile libbpf.

For the debian based distributions:

$ sudo apt-get update

$ sudo apt-get install make zlib1g libzstd-dev pkg-config libclang-11-dev llvm-11-dev libbpf-dev libelf-dev

Alternatively, Nix can be used to avoid installing system packages, simply run nix-shell or nix develop to load the dependencies. Docker and VirtualBox are required to be installed as system packages.

Getting Started

Fork the parca-agent and parca repositories on GitHub. Clone the repositories on to your machine.

$ git clone git@github.com:parca-dev/parca-agent.git

Run parca-agent

Code changes can be tested locally by building parca-agent and running it to profile systemd units. The following code snippet profiles the docker daemon, i.e. docker.service systemd unit:

$ cd parca-agent

$ make

# Assumes Parca server runs on localhost:7070
$ sudo dist/parca-agent --node=test --log-level=debug --remote-store-address=localhost:7070 --remote-store-insecure

The generated profiles can be seen at http://localhost:7071 .

Working with parca server

Clone the parca server repository and copy the parca-agent repository (where you have made changes) to parca/tmp/:

$ git clone git@github.com:parca-dev/parca.git

$ cp -Rf parca-agent parca/tmp/parca-agent

Then depending on whether you would like to test changes to Parca Agent or Parca, you can run make dev/up in Parca Agent or follow the server's CONTRIBUTING.md to get your development Kubernetes cluster running with Tilt.

Test your changes by running:

$ cd parca-agent && make test

Making a PR

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. If you are not entirely sure about this, you can discuss this on the Parca Discord server as well. RFCs are used to document all things architecture and design for the Parca project. You can find an index of the RFCs here.

Please make sure to update tests as appropriate.

This is roughly what the contribution workflow should look like:

  • Create a topic branch from where you want to base your work (usually main).
  • Make commits of logical units.
  • Make sure the tests pass, and add any new tests as appropriate.
  • Use make test and make test-e2e to run unit tests and smoke tests respectively.
  • Make sure the code is properly formatted. (make format could be useful here.)
  • Make sure the code is properly linted. (make lint could be useful here.)
  • Make sure your commit messages follow the commit guidelines (see below).
  • Push your changes to a topic branch in your fork of the repository.
  • Submit a pull request to the original repository.

Thank you for your contributions!

Commit Guidelines

We follow a rough convention for commit messages that is designed to answer two questions: what changed and why. The subject line should feature the what and the body of the commit should describe the why.


scripts: add the test-cluster command

this uses tmux to setup a test cluster that you can easily kill and
start for debugging.

Fixes #38

The first line is the subject and should be no longer than 70 characters, the second line is always blank, and other lines should be wrapped at 80 characters. This allows the message to be easier to read on GitHub as well as in various git tools.

pre-commit

pre-commit hooks can installed to help with the linting and formatting of your code:

pre-commit install