Decouple the number of repositories metrics from the cache

Do not associate directly the metric value and his
callback to the Gerrit's project cache. A direct coupling
has two issues:
1. Makes testing difficult (see the need of mocking the projects cache)
2. Generates unneeded workload of loading all Gerrit projects in cache

This is a preparation for point 2. complete resolution where
in a follow-up change the projects cache will be totally removed
and replaced with a lighter mechanism.

Change-Id: I1b27ed99bb13a12c3d3042b72187c716b21a457c
5 files changed
tree: b42e3c49e6f828bbf23ff857f85a4bfa6fe07b3a
  1. src/
  2. .gitignore
  3. BUILD
  4. README.md
README.md

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.

Example:

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

The output plugin jar is created in:

bazel-genfiles/plugins/git-repo-metrics/git-repo-metrics.jar

How to install

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

Configuration

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