Add numberofprojects metric

Implement new metric plugins_git_repo_metrics_numberofprojects which
captures the number of projects at collection moment.
The plugin reload mode is changed to restart to allow for the new metric
to reload, as due to the order of the events on the plugin reload
mechanism, the previous version of the plugin is maintained until the
last stage, which invalidates the re-creation of the metric.

Bug: Issue 325029893
Change-Id: I86e8a1f7f35be650ebd6e24ad5ca92723fb89d3d
8 files changed
tree: 72f044c15bfa48d1c1206dc3fcfec5956d39c90a
  1. src/
  2. .gitignore
  3. BUILD

Plugin to collect Git repository metrics

This plugin allows a systematic collection of repository metrics. Metrics are updated upon a ref-update receive.

How to build

Clone or link this plugin to the plugins directory of Gerrit‘s source tree, and then run bazel build on the plugin’s directory.


git clone --recursive
git clone
pushd gerrit/plugins && ln -s ../../git-repo-metrics . && popd
cd gerrit && bazel build plugins/git-repo-metrics

The output plugin jar is created in:


How to install

Copy the git-repo-metrics.jar into the Gerrit's /plugins directory and wait for the plugin to be automatically loaded.


More information about the plugin configuration can be found in the file.