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.
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.
Generally, we require that you test any code you are adding or modifying. Once your changes are ready to submit for review:
-
Sign the Contributor License Agreement (CLA)
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.
-
Test your changes
npm test # requires a local Docker
If you are adding new code or changing existing code, write some automated tests that exercise this code. See the TESTING.md doc for details.
-
Document your changes
- See the Commit message guidelines below.
- If your changes will be visible to users of this package, then add an item to the "Unreleased" section of the changelog.
- If you are changing usage of this package, are there updates under "docs/" that should be made?
-
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.
-
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, e.g. "Closes #123".
-
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!
This repo loosely encourages commit messages per Conventional Commits.
[optional type, e.g. "fix:", "feat:"] <description>
[Optional body paragraphs.]
[Optional "BREAKING CHANGE: ..." paragraphs.]
[Optional footers, e.g. "Fixes: #123" or "Co-authored-by: ...".]
-
The first line should contain a short description of the change. Ideally a description is less than 50 characters, and certainly less than 72.
-
The first line may optionally be prefixed with a type:
- "fix:" when fixing a bug
- "feat:" when adding a new feature
- "docs:" when only updating documentation
- "refactor:" when refactoring code without changing functional behavior
- "test:" when only updating tests
- "perf:" when improving performance without changing functional behavior
- "chore:" when making some other task that does not change functional behavior
-
The second line MUST be blank.
-
Optionally provide body paragraphs that explain the what and why of the change, and not the how.
-
Wrap all lines at 72 columns, within reason (URLs, quoted output).
-
If your commit introduces a breaking change, it should (strongly encouraged) contain a "BREAKING CHANGE: ..." paragraph, explaining the reason for the change, which situations would trigger the breaking change, and what is the exact change.
-
If fixing an open issue, add a footer block of the form
Fixes: #123
orCloses: #123
.
Of these guidelines, #1 and #3 are the most important. A succinct description and a body that answers "what" and "why" will best help future maintainers of the software.
For information about how to run the test suite, see TESTING.md.
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
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".
The following is an overview of what's required in order to add support to the agent for automatic instrumentation of an npm package.
- Add the instrumentation logic to a new file in the
lib/instrumentation/modules
directory named<package-name>.js
, E.g.mysql.js
for themysql
package - Add the name of the package to the
MODULES
array inlib/instrumentation/index.js
- Add accompanying tests in the
test/instrumentation/modules
directory. If you only have one test file, place it in the root of themodules
directory and name it the same as thelib
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- If you created a sub-directory under
test/instrumentation/modules
, add it to thedirectories
array intest/test.js
- If you created a sub-directory under
- List the supported versions of the package in
docs/supported-technologies.asciidoc
- 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 - Add the name of the module to one of the TAV groups in both
.travis.yml
andtest/.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
If you have access to make releases, the process is as follows:
- Be sure you have checked out the
master
branch and have pulled latest changes - Update the version in
package.json
according to the scale of the change. (major, minor or patch) - Update
CHANGELOG.asciidoc
:- Change the "Unreleased" section title to:
[[release-notes-x.x.x]] ==== x.x.x - YYYY/MM/DD
- Add missing changelog entries, if any. (Typically commits will include changelog entries in the "Unreleased" section.)
- Change the "Unreleased" section title to:
- If a major or minor release, update the EOL table in
docs/upgrading.asciidoc
. EOL is 18 months after release date. - Make a PR titled
x.y.z
-- wherex.y.z
is the new version in package.json -- with these changes. - Ensure PR checks pass, then merge to master.
- Working on the elastic repo now (not a fork), tag the merged-to-master commit with
git tag vx.y.x && git push origin --tags
. For example:git tag v1.2.3 && git push origin --tags
. - Reset the latest major branch (currently
3.x
) to point to the current master, e.g.git branch -f 3.x master && git push origin 3.x
- Publish to npm with
npm publish
- 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
- Update the version in
package.json
according to the scale of the change. (major, minor or patch) - Update
CHANGELOG.asciidoc
:- Change the "Unreleased" section title to:
[[release-notes-x.x.x]] ==== x.x.x - YYYY/MM/DD
- Add missing changelog entries, if any. (Typically commits will include changelog entries in the "Unreleased" section.)
- Change the "Unreleased" section title to:
- Commit changes with message
x.y.z
wherex.y.z
is the version inpackage.json
- Tag the commit with
git tag vx.y.x
, for examplegit tag v1.2.3
- Run tests with
npm test
- Push commits and tags upstream with
git push upstream <major_branch> && git push upstream --tags
(and optionally to your own fork as well) - Publish to npm with
npm publish --tag=2x
(where2x
is the tag for the past major version being published) - Make a PR against
master
containing the updates toCHANGELOG.asciidoc
so thatmaster
always contain information about all releases