commit | 945bccb97cc7e4d9dcc7f83ba2bd31b06f32840e | [log] [tgz] |
---|---|---|
author | Fabio Ponciroli <Ponch78@gmail.com> | Fri Apr 11 22:08:06 2025 +0200 |
committer | Fabio Ponciroli <Ponch78@gmail.com> | Tue Apr 15 14:59:41 2025 +0200 |
tree | 2682408d025b9b33ef2a879c8b39e9909db9b8f5 | |
parent | b2fc96552dffa3498601d0448194a77378e44fd4 [diff] |
Add support for collecting metrics from all repos Currently, the plugin requires an explicit list of repositories to be defined in the configuration. This approach is not scalable in environments with a large number of projects or when new repositories are added frequently. This change introduces a new configuration option: [git-repo-metrics] collectAllRepositories = true When enabled, the plugin will dynamically collect metrics from all existing repositories known to Gerrit, instead of relying on a static list. This reduces the maintenance burden on Gerrit administrators and ensures metrics coverage remains up-to-date as projects are added or removed. The existing configuration using an explicit list of repositories is still supported but collectAllRepositories take precedence when enabled. Bug: Issue 408830824 Change-Id: I6fda393919786a5831d6f92bba576f353defa370
This plugin allows a systematic collection of repository metrics. It‘s primary use-case is with Gerrit, however it’s possible for it to work with multiple Git SCM systems, including bare Git repositories.
Metrics are updated either upon a ref-update
receive or on a time based refresh interval. ref-update
events are received only on primary nodes, so on replicas gracePeriod
will need to be set.
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
Copy the git-repo-metrics.jar into the Gerrit's /plugins directory and wait for the plugin to be automatically loaded.
This plugin can also work with Git repositories hosted by other Git based SCM tools, however the metrics are still expose via Gerrit, so a dedicated Gerrit instance running alongside the current SCM tool is still required. So to make this plugin work with other Git SCM tools, a Gerrit installation needs to be set-up and the basePath
needs to be set to the git data directory of the tool of choice. You will also need to set gracePeriod
and forceCollection
, as when using a different SCM tool than Gerrit the usual hooks aren't triggered. Finally, a configuration option will need to be specified to indicate which Backend is being used. Currently supported backend, other than GERRIT are:
Find more in the configuration section below.
More information about the plugin configuration can be found in the config.md file.