Replace project cache with GerritApi for listing projects

When rendering the number of projects metrics, use an
inexpensive project list instead of loading all projects
in cache, leveraging an internal user context.

Also honour the grace period configuration of the plugin
so that the new metric will respect the update frequency
configured without generating extra workload on the system.

If the metrics is requested more often, return a memoized
value from the earlier executions.

Change-Id: Ica5d219be22ce1f0839596ff654f0402c7c0e555
1 file changed
tree: a25842024acbf33aec33ea7cb47b697436703399
  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.