Skip to content

Latest commit

 

History

History
185 lines (139 loc) · 8.38 KB

CONTRIBUTING.md

File metadata and controls

185 lines (139 loc) · 8.38 KB

Contributing to the APM Agent

The APM Agent is open source and we love to receive contributions from our community — you!

There are many ways to contribute, from writing tutorials or blog posts, improving the documentation, submitting bug reports and feature requests or writing code.

You can get in touch with us through Discuss, feedback and ideas are always welcome.

Code contributions

If you have a bugfix or new feature that you would like to contribute, please find or open an issue about it first. Talk about what you would like to do. It may be that somebody is already working on it, or that there are particular issues that you should know about before implementing the change.

Submitting your changes

Generally, we require that you test any code you are adding or modifying. Once your changes are ready to submit for review:

  1. Sign the Contributor License Agreement

    Please make sure you have signed our Contributor License Agreement. We are not asking you to assign copyright to us, but to give us the right to distribute your code without restriction. We ask this of all contributors in order to assure our users of the origin and continuing existence of the code. You only need to sign the CLA once.

  2. Test your changes

    Run the test suite to make sure that nothing is broken. See testing for details.

  3. Rebase your changes

    Update your local repository with the most recent code from the main repo, and rebase your branch on top of the latest master branch. We prefer your initial changes to be squashed into a single commit. Later, if we ask you to make changes, add them as separate commits. This makes them easier to review. As a final step before merging we will either ask you to squash all commits yourself or we'll do it for you.

  4. Submit a pull request

    Push your local changes to your forked copy of the repository and submit a pull request. In the pull request, choose a title which sums up the changes that you have made, and in the body provide more details about what your changes do. Also mention the number of the issue where discussion has taken place, eg "Closes #123".

  5. Be patient

    We might not be able to review your code as fast as we would like to, but we'll do our best to dedicate it the attention it deserves. Your effort is much appreciated!

Commit message guidelines

This repo uses the Conventional Commits standard for comment messages (see linked spec for a complete list of commit message formatting rules).

A good commit message should describe what changed and why.

  1. The first line should:

    • contain a short description of the change (preferably 50 characters or less, and no more than 72 characters)
    • be entirely in lowercase with the exception of proper nouns, acronyms, and the words that refer to code, like function/variable names
    • be prefixed with the type of change, optionally the name of the changed subsystem, and start with an imperative verb. Check the output of git log --oneline files/you/changed to find out what subsystems your changes touch.

    Examples:

    • fix(ioredis): prevent unhandled promise rejection
    • docs: fix typos in README.md
  2. Keep the second line blank.

  3. Wrap all other lines at 72 columns (except for long URLs).

  4. If your patch fixes an open issue, you can add a reference to it at the end of the log. Use the Fixes: or Closes: prefix and the issue number.

    Examples:

    • Fixes: #42
  5. If your commit introduces a breaking change (semver-major), it should contain an explanation about the reason of the breaking change, which situation would trigger the breaking change and what is the exact change. The explanation should be prefixed with BREAKING CHANGE:.

To validate the commit message locally, run:

npm run lint:commit

Testing

For information about how to run the test suite, see TESTING.md.

Backporting

If a PR is marked with a backport:* label, it should be backported to the branch specified by the label after it has been merged.

To backport a commit, run the following command and follow the instructions in the terminal:

npm run backport

Workflow

All feature development and most bug fixes hit the master branch first. Pull requests should be reviewed by someone with commit access. Once approved, the author of the pull request, or reviewer if the author does not have commit access, should "Squash and merge".

Adding support for new modules

The following is an overview of what's required in order to add support to the agent for automatic instrumentation of an npm package.

  1. Add the instrumentation logic to a new file in the lib/instrumentation/modules directory named <package-name>.js, E.g. mysql.js for the mysql package
  2. Add the name of the package to the MODULES array in lib/instrumentation/index.js
  3. Add accompanying tests in the test/instrumentation/modules directory. If you only have one test file, place it in the root of the modules directory and name it the same as the lib file. If you have more than one test file, create a sub-directory with the name of the package and place all test files inside that
    1. If you created a sub-directory under test/instrumentation/modules, add it to the directories array in test/test.js
  4. List the supported versions of the package in docs/supported-technologies.asciidoc
  5. We use the test-all-versions module to test the agent against all supported versions of each package we instrument. Add the supported versions and required test commands to the .tav.yml file
  6. Add the name of the module to one of the TAV groups in both .travis.yml and test/.jenkins_tav.yml for all Node.js versions. To better balance the work requried to run each TAV group, pick the TAV group that is currently running the fastest. Look at the "Dependencies" stage of one of our latest Travis cron job builds for an overview

Releasing

If you have access to make releases, the process is as follows:

Current major

  1. Be sure you have checked out the master branch and have pulled latest changes
  2. Update the version in package.json according to the scale of the change. (major, minor or patch)
  3. Add commit messages to CHANGELOG.asciidoc (You may skip non-user-visible changes)
  4. If a major or minor release, update the EOL table in docs/upgrading.asciidoc. EOL is 18 months after release date.
  5. Commit changes with message x.y.z where x.y.z is the version in package.json
  6. Tag the commit with git tag vx.y.x, for example git tag v1.2.3
  7. Reset the latest major branch (1.x, 2.x etc) to point to the current master, e.g. git branch -f 3.x master
  8. Run tests with npm test
  9. Push commits and tags upstream with git push upstream master && git push upstream --tags (and optionally to your own fork as well)
  10. Update the latest major branch on upstream with git push upstream <major_branch>
  11. Publish to npm with npm publish

Past major

  1. Be sure you have checked out the branch associated with the major you wish to release and have pulled latest changes, e.g. 2.x
  2. Update the version in package.json according to the scale of the change. (major, minor or patch)
  3. Add commit messages to CHANGELOG.asciidoc (You may skip non-user-visible changes)
  4. Commit changes with message x.y.z where x.y.z is the version in package.json
  5. Tag the commit with git tag vx.y.x, for example git tag v1.2.3
  6. Run tests with npm test
  7. Push commits and tags upstream with git push upstream <major_branch> && git push upstream --tags (and optionally to your own fork as well)
  8. Publish to npm with npm publish --tag=2x (where 2x is the tag for the past major version being published)
  9. Make a PR against master containing the updates to CHANGELOG.asciidoc so that master always contain information about all releases