commit | 5b481ff4d305457431a9744a3d08e9ed426ea153 | [log] [tgz] |
---|---|---|
author | Dariusz Luksza <dariusz.luksza@gmail.com> | Fri Feb 16 16:41:11 2024 +0000 |
committer | Dariusz Luksza <dariusz.luksza@gmail.com> | Mon Feb 19 09:56:49 2024 +0000 |
tree | bb033e7558b139933e109cc873fa65ad8ae4d6eb | |
parent | 5e5cb69c5cb55217bb54a5d35dd6d539d86c9c6e [diff] |
Add combinedRefsSha1 to metrics Expose new metric providing a "combined refs SHA-1", which could be used to ensure eventual consistency of repository refs. It's based on the `Sha1AllRefs`[1] Groovy script, which will iterate over all repository refs and combine them into a single SHA-1. Then the resulting SHA-1 will be truncated to an integer value so that it can be included in metrics. Exposing this metric should enable Gerrit admins to detect potential inconsistencies between nodes. All git repositories are **eventually consistent** which means that detecting different values for combined refs SHA-1 is **NOT** equivalent to data inconsistency. But not reporting a consistent state (when the combined refs SHA-1 across nodes is the same) for a _reasonable time_ should raise an eyebrow and lead to an investigation if any of the replication events were lost. The _reasonable time_ will differ from repository to repository, for some it may be 2 hours, and for others 24 hours. Meaning, that within that time the repositories should be consistent at least once. It's on the Gerrit admin to find the time window that works best for their repositories. [1] https://gerrit.googlesource.com/plugins/scripts/+/refs/heads/master/multi-primary/localrefdb.groovy#142 Bug: Issue 324975825 Change-Id: I2e4dbea0892776069dea371803653b7dd239f7f8
This plugin allows a systematic collection of repository metrics. Metrics are updated upon a ref-update
receive.
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.
More information about the plugin configuration can be found in the config.md file.