commit | e969becbb610028e6da46d05bd4958ae95c0d37c | [log] [tgz] |
---|---|---|
author | Fabio Ponciroli <ponch78@gmail.com> | Wed Apr 23 19:02:46 2025 +0200 |
committer | Luca Milanesio <luca.milanesio@gmail.com> | Tue Apr 29 11:59:09 2025 -0700 |
tree | d51e37b8ea9c730ada566fbe1f5c675e24d42941 | |
parent | a0af440205c46cdae2806a53266a9140a568a3a9 [diff] |
Amend repository metrics introducing a project_name field The repository name was wrongly used in the metric name, which is against the common paradigm used in Gerrit for tracking repo-specific metrics, similarly to the definition of JGit block cache in JGitMetricModule. Use the typical Gerrit pattern of parametrised metrics by the project_name field and rely on Gerrit's name sanitisation logic. Also, fix the shouldCollectAllRepositoriesMetrics() test, which was wrongly assuming that the metrics are only generated for All-Projects and All-Users, while every test also create a test-specific project which is also then accounted for in the repository metrics. Bug: Issue 413269103 Change-Id: I42440218812183b1dd3c08becc1b31f8bb000e04
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.