|
| 1 | +# Contributing |
| 2 | + |
| 3 | +First, thank you for contributing to Vector! The goal of this document is to |
| 4 | +provide everything you need to start contributing to Vector. The |
| 5 | +following TOC is sorted progressively, starting with the basics and |
| 6 | +expanding into more specifics. Everyone from a first time contributor to a |
| 7 | +Vector team member will find this document useful. |
| 8 | + |
| 9 | +- [Introduction](#introduction) |
| 10 | +- [Your First Contribution](#your-first-contribution) |
| 11 | + - [New sources, sinks, and transforms](#new-sources-sinks-and-transforms) |
| 12 | +- [Workflow](#workflow) |
| 13 | + - [Git Branches](#git-branches) |
| 14 | + - [Git Commits](#git-commits) |
| 15 | + - [Style](#style) |
| 16 | + - [GitHub Pull Requests](#github-pull-requests) |
| 17 | + - [Title](#title) |
| 18 | + - [Reviews & Approvals](#reviews--approvals) |
| 19 | + - [Merge Style](#merge-style) |
| 20 | + - [CI](#ci) |
| 21 | + - [Releasing](#releasing) |
| 22 | + - [Testing](#testing) |
| 23 | + - [Skipping tests](#skipping-tests) |
| 24 | + - [Daily tests](#daily-tests) |
| 25 | + - [Flakey tests](#flakey-tests) |
| 26 | + - [Test harness](#test-harness) |
| 27 | + - [Deprecations](#deprecations) |
| 28 | + - [Dependencies](#dependencies) |
| 29 | +- [Next steps](#next-steps) |
| 30 | +- [Legal](#legal) |
| 31 | + - [Contributor License Agreement](#contributor-license-agreement) |
| 32 | + - [Granted rights and copyright assignment](#granted-rights-and-copyright-assignment) |
| 33 | + |
| 34 | +## Introduction |
| 35 | + |
| 36 | +1. **You're familiar with [GitHub](https://github.com) and the pull request |
| 37 | + workflow.** |
| 38 | +2. **You've read Vector's [docs](https://vector.dev/docs/).** |
| 39 | +3. **You know about the [Vector community](https://vector.dev/community/). |
| 40 | + Please use this for help.** |
| 41 | + |
| 42 | +## Your First Contribution |
| 43 | + |
| 44 | +1. Ensure your change has an issue! Find an |
| 45 | + [existing issue][urls.existing_issues] or [open a new issue][urls.new_issue]. |
| 46 | + - This is where you can get a feel if the change will be accepted or not. |
| 47 | + Changes that are questionable will have a `needs: approval` label. |
| 48 | +2. Once approved, [fork the Vector repository][urls.fork_repo] in your own |
| 49 | + GitHub account (only applicable to outside contributors). |
| 50 | +3. [Create a new Git branch][urls.create_branch]. |
| 51 | +4. Make your changes. |
| 52 | +5. [Submit the branch as a pull request][urls.submit_pr] to the main Vector |
| 53 | + repo. A Vector team member should comment and/or review your pull request |
| 54 | + within a few days. Although, depending on the circumstances, it may take |
| 55 | + longer. |
| 56 | + |
| 57 | +### New sources, sinks, and transforms |
| 58 | + |
| 59 | +If you're thinking of contributing a new source, sink, or transform to Vector, thank you that's way cool! The answers to |
| 60 | +the below questions are required for each newly proposed component and depending on the answers, we may elect to not |
| 61 | +include the proposed component. If you're having trouble with any of the questions, we're available to help you. |
| 62 | + |
| 63 | +**Prior to beginning work on a new source or sink if a GitHub Issue does not already exist, please open one to discuss |
| 64 | +the introduction of the new integration.** Maintainers will review the proposal with the following checklist in mind, |
| 65 | +try and consider them when sharing your proposal to reduce the amount of time it takes to review your proposal. This |
| 66 | +list is not exhaustive, and may be updated over time. |
| 67 | + |
| 68 | +- [ ] Can the proposed component’s functionality be replicated by an existing component, with a specific configuration? |
| 69 | +(ex: Azure Event Hub as a `kafka` sink configuration) |
| 70 | + - [ ] Alternatively implemented as a wrapper around an existing component. (ex. `axiom` wrapping `elasticsearch`) |
| 71 | +- [ ] Can an existing component replicate the proposed component’s functionality, with non-breaking changes? |
| 72 | +- [ ] Can an existing component be rewritten in a more generic fashion to cover both the existing and proposed functions? |
| 73 | +- [ ] Is the proposed component generically usable or is it specific to a particular service? |
| 74 | + - [ ] How established is the target of the integration, what is the relative market share of the integrated service? |
| 75 | +- [ ] Is there sufficient demand for the component? |
| 76 | + - [ ] If the integration can be served with a workaround or more generic component, how painful is this for users? |
| 77 | +- [ ] Is the contribution from an individual or the organization owning the integrated service? (examples of |
| 78 | +organization backed integrations: `databend` sink, `axiom` sink) |
| 79 | + - [ ] Is the contributor committed to maintaining the integration if it is accepted? |
| 80 | +- [ ] What is the overall complexity of the proposed design of this integration from a technical and functional |
| 81 | +standpoint, and what is the expected ongoing maintenance burden? |
| 82 | +- [ ] How will this integration be tested and QA’d for any changes and fixes? |
| 83 | + - [ ] Will we have access to an account with the service if the integration is not open source? |
| 84 | + |
| 85 | +To merge a new source, sink, or transform, the pull request is required to: |
| 86 | + |
| 87 | +- [ ] Add tests, especially integration tests if your contribution connects to an external service. |
| 88 | +- [ ] Add instrumentation so folks using your integration can get insight into how it's working and performing. You can |
| 89 | +see some [example of instrumentation in existing integrations](https://github.com/vectordotdev/vector/tree/master/src/internal_events). |
| 90 | +- [ ] Add documentation. You can see [examples in the `docs` directory](https://github.com/vectordotdev/vector/blob/master/docs). |
| 91 | + |
| 92 | +When adding new integration tests, the following changes are needed in the GitHub Workflows: |
| 93 | + |
| 94 | +- in `.github/workflows/integration.yml`, add another entry in the matrix definition for the new integration. |
| 95 | +- in `.github/workflows/integration-comment.yml`, add another entry in the matrix definition for the new integration. |
| 96 | +- in `.github/workflows/changes.yml`, add a new filter definition for files changed, and update the `changes` job |
| 97 | +outputs to reference the filter, and finally update the outputs of `workflow_call` to include the new filter. |
| 98 | + |
| 99 | +## Workflow |
| 100 | + |
| 101 | +### Git Branches |
| 102 | + |
| 103 | +_All_ changes must be made in a branch and submitted as [pull requests](#github-pull-requests). |
| 104 | +Vector does not adopt any type of branch naming style, but please use something |
| 105 | +descriptive of your changes. |
| 106 | + |
| 107 | +### Git Commits |
| 108 | + |
| 109 | +#### Style |
| 110 | + |
| 111 | +Please ensure your commits are small and focused; they should tell a story of |
| 112 | +your change. This helps reviewers to follow your changes, especially for more |
| 113 | +complex changes. |
| 114 | + |
| 115 | +### GitHub Pull Requests |
| 116 | + |
| 117 | +Once your changes are ready you must submit your branch as a [pull request](https://github.com/vectordotdev/vector/pulls). |
| 118 | + |
| 119 | +#### Title |
| 120 | + |
| 121 | +The pull request title must follow the format outlined in the [conventional commits spec](https://www.conventionalcommits.org). |
| 122 | +[Conventional commits](https://www.conventionalcommits.org) is a standardized |
| 123 | +format for commit messages. Vector only requires this format for commits on |
| 124 | +the `master` branch. And because Vector squashes commits before merging |
| 125 | +branches, this means that only the pull request title must conform to this |
| 126 | +format. Vector performs a pull request check to verify the pull request title |
| 127 | +in case you forget. |
| 128 | + |
| 129 | +A list of allowed sub-categories is defined |
| 130 | +[here](https://github.com/vectordotdev/vector/tree/master/.github). |
| 131 | + |
| 132 | +The following are all good examples of pull request titles: |
| 133 | + |
| 134 | +```text |
| 135 | +feat(new sink): new `xyz` sink |
| 136 | +feat(tcp source): add foo bar baz feature |
| 137 | +fix(tcp source): fix foo bar baz bug |
| 138 | +chore: improve build process |
| 139 | +docs: fix typos |
| 140 | +``` |
| 141 | + |
| 142 | +#### Reviews & Approvals |
| 143 | + |
| 144 | +All pull requests should be reviewed by: |
| 145 | + |
| 146 | +- No review required for cosmetic changes like whitespace, typos, and spelling |
| 147 | + by a maintainer |
| 148 | +- One Vector team member for minor changes or trivial changes from contributors |
| 149 | +- Two Vector team members for major changes |
| 150 | +- Three Vector team members for RFCs |
| 151 | + |
| 152 | +If CODEOWNERS are assigned, a review from an individual from each of the sets of owners is required. |
| 153 | + |
| 154 | +#### Merge Style |
| 155 | + |
| 156 | +All pull requests are squashed and merged. We generally discourage large pull |
| 157 | +requests that are over 300-500 lines of diff. If you would like to propose a |
| 158 | +change that is larger we suggest coming onto our [Discord server](https://chat.vector.dev/) and discuss it |
| 159 | +with one of our engineers. This way we can talk through the solution and |
| 160 | +discuss if a change that large is even needed! This will produce a quicker |
| 161 | +response to the change and likely produce code that aligns better with our |
| 162 | +process. |
| 163 | + |
| 164 | +### CI |
| 165 | + |
| 166 | +Currently, Vector uses GitHub Actions to run tests. The workflows are defined in |
| 167 | +`.github/workflows`. |
| 168 | + |
| 169 | +#### Releasing |
| 170 | + |
| 171 | +GitHub Actions is responsible for releasing updated versions of Vector through |
| 172 | +various channels. |
| 173 | + |
| 174 | +#### Testing |
| 175 | + |
| 176 | +##### Skipping tests |
| 177 | + |
| 178 | +Tests are run for all changes except those that have the label: |
| 179 | + |
| 180 | +```text |
| 181 | +ci-condition: skip |
| 182 | +``` |
| 183 | + |
| 184 | +##### Daily tests |
| 185 | + |
| 186 | +Some long-running tests are only run daily, rather than on every pull request. |
| 187 | +If needed, an administrator can kick off these tests manually via the button on |
| 188 | +the [nightly build action |
| 189 | +page](https://github.com/vectordotdev/vector/actions?query=workflow%3Anightly) |
| 190 | + |
| 191 | +#### Flakey tests |
| 192 | + |
| 193 | +Historically, we've had some trouble with tests being flakey. If your PR does |
| 194 | +not have passing tests: |
| 195 | + |
| 196 | +- Ensure that the test failures are unrelated to your change |
| 197 | + - Is it failing on master? |
| 198 | + - Does it fail if you rerun CI? |
| 199 | + - Can you reproduce locally? |
| 200 | +- Find or open an issue for the test failure |
| 201 | + ([example](https://github.com/vectordotdev/vector/issues/3781)) |
| 202 | +- Link the PR in the issue for the failing test so that there are more examples |
| 203 | + |
| 204 | +##### Test harness |
| 205 | + |
| 206 | +You can invoke the [test harness][urls.vector_test_harness] by commenting on |
| 207 | +any pull request with: |
| 208 | + |
| 209 | +```bash |
| 210 | +/test -t <name> |
| 211 | +``` |
| 212 | + |
| 213 | +### Deprecations |
| 214 | + |
| 215 | +When deprecating functionality in Vector, see [DEPRECATION.md](DEPRECATION.md). |
| 216 | + |
| 217 | +### Dependencies |
| 218 | + |
| 219 | +When adding, modifying, or removing a dependency in Vector you may find that you need to update the |
| 220 | +inventory of third-party licenses maintained in `LICENSE-3rdparty.csv`. This file is generated using |
| 221 | +[rust-license-tool](https://github.com/DataDog/rust-license-tool.git) and can be updated using |
| 222 | +`cargo vdev build licenses`. |
| 223 | + |
| 224 | +## Next steps |
| 225 | + |
| 226 | +As discussed in the [`README`](README.md), you should continue to the following |
| 227 | +documents: |
| 228 | + |
| 229 | +1. **[DEVELOPING.md](DEVELOPING.md)** - Everything necessary to develop |
| 230 | +2. **[DOCUMENTING.md](DOCUMENTING.md)** - Preparing your change for Vector users |
| 231 | +3. **[DEPRECATION.md](DEPRECATION.md)** - Deprecating functionality in Vector |
| 232 | + |
| 233 | +## Legal |
| 234 | + |
| 235 | +To protect all users of Vector, the following legal requirements are made. |
| 236 | +If you have additional questions, please [contact us]. |
| 237 | + |
| 238 | +### Contributor License Agreement |
| 239 | + |
| 240 | +Vector requires all contributors to sign the Contributor License Agreement |
| 241 | +(CLA). This gives Vector the right to use your contribution as well as ensuring |
| 242 | +that you own your contributions and can use them for other purposes. |
| 243 | + |
| 244 | +The full text of the CLA can be found at [https://cla.datadoghq.com/vectordotdev/vector](https://cla.datadoghq.com/vectordotdev/vector). |
| 245 | + |
| 246 | +### Granted rights and copyright assignment |
| 247 | + |
| 248 | +This is covered by the CLA. |
| 249 | + |
| 250 | +[contact us]: https://vector.dev/community |
| 251 | +[urls.create_branch]: https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-and-deleting-branches-within-your-repository |
| 252 | +[urls.existing_issues]: https://github.com/vectordotdev/vector/issues |
| 253 | +[urls.fork_repo]: https://help.github.com/en/github/getting-started-with-github/fork-a-repo |
| 254 | +[urls.new_issue]: https://github.com/vectordotdev/vector/issues/new |
| 255 | +[urls.submit_pr]: https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork |
| 256 | +[urls.vector_test_harness]: https://github.com/vectordotdev/vector-test-harness/ |
0 commit comments