Welcome to MongoDB exporter!
June 1, 2026 ยท View on GitHub
We're glad you'd like to join the Percona community and help keep open source open. This is the new MongoDB exporter implementation, which collects all metrics exposed by MongoDB monitoring commands by iterating over the fields returned by diagnostic commands.
Prerequisites
Before submitting code or documentation, we kindly ask you to complete the following prerequisites.
1. Sign the CLA
All contributors must sign our Contributor License Agreement (CLA). This is a legal document that ensures that we can use your contributions in our project. It only needs to be signed once, and it applies to all of your contributions to this repository.
2. Code of Conduct
Please make sure to read and agree to our Code of Conduct.
Submitting a Bug
If you find a bug in Percona MongoDB Exporter and it is not related to PMM, please open issue in GitHub new issue, if you use PMM, please submit a ticket to that project's JIRA issue tracker.
Your first step should be to search GH issues and JIRA PMM issues for the existing or a similar ticket. If you find that someone else has already reported your problem, then you can upvote that ticket to increase its visibility.
Submitting PMM Bug
If there is no existing PMM ticket for the issue that relates to PMM, submit a ticket following these steps:
- Sign in to Percona JIRA. You will need to create an account if you do not have one.
- Go to the Create Issue screen and select the relevant project.
- Fill in the fields of Summary, Description, Steps To Reproduce, and Affects Version to the best you can. If the bug corresponds to a crash, attach the stack trace from the logs.
As a general rule of thumb, please try to create bug reports that are:
- Reproducible. Include steps to reproduce the problem.
- Specific. Include as much detail as possible: which version, what environment, etc.
- Unique. Do not duplicate existing tickets.
- Scoped to a Single Bug. One bug per ticket.
Branching workflow
MongoDB exporter uses Semantic Versioning [major].[minor].[patch]:
- major version when you make incompatible changes
- minor version when you add functionality in a backwards compatible manner
- patch version when you make backwards compatible bug fixes
main is a main branch where all the changes are merged first.
release-x.y are the release branches and are forked from main to prepare and test the release. Release branch stays open to get critical patches and to release another patch release. Release branch closes (no merges happens) just after new minor release is created.
Each release is tagged with vx.y.z tag.
Please submit your changes against main branch, if the fix is needed for the patch or minor release - please ask maintainers to cherry pick it into the release branch.
Setup your local development environment
Using the Makefile
In the main directory there is a Makefile to help you with development and testing tasks.
Use make without parameters to get help.
These are these available options:
| Command | Description |
|---|---|
| init | Install linters |
| build | Build the binaries |
| format | Format source code |
| check | Run checks/linters |
| check-license | Check license in headers. |
| help | Display this help message. |
| test | Run all tests (need to start the sandbox first) |
| test-cluster | Starts MongoDB test cluster. Use env var TEST_MONGODB_IMAGE to set flavor and version. Example: |
TEST_MONGODB_IMAGE=mongo:3.6 make test-cluster | |
| test-cluster-clean | Stops MongoDB test cluster |
Initializing the development environment
First you need to have Go and Docker installed on your system and then, in order to install tools to format, test and build the exporter, you need to run this command:
make init
It will install goimports, goreleaser, golangci-lint and reviewdog.
Tests
Starting the sandbox
The testing sandbox starts n MongoDB instances as follows:
- 3 Instances for shard 1 at ports 17001, 17002, 17003 (with no authentication)
- 3 instances for shard 2 at ports 17004, 17005, 17006 (with authentication enabled)
- 3 config servers at ports 17007, 17008, 17009
- 1 mongos server at port 17000
- 1 stand alone instance at port 27017
To connect to the mongos on shard 1, you can use:
mongo mongodb://127.0.0.1:17001/admin
To connect to the mongos on shard 2 (with authentication enabled), you can use:
mongo mongodb://admin:admin@127.0.0.1:17001/admin
The sandbox can be started using the provided Makefile using: make test-cluster and it can be stopped using make test-cluster-clean.
Running tests
To run the unit tests, just run make test.
Submitting a Pull Request
Formatting code
Before submitting code, please run make format to format the code according to the standards.
Submit your code against the main branch.
Code Reviews
Once the PR is ready for review, our team will be assigned as reviewers.
After your Pull Request is merged
Once your pull request is merged, you are an official Percona Community Contributor. Welcome to the community!
We're looking forward to your contributions and hope to hear from you soon on our Forums.