Disable replication lag tracking by configuration

Introduce the new configuration settings
ref-database.replicationLagEnabled for disabling the metric to trace
the auto-replication lag between sites.

The rationale for disabling this metric lies in the use of
mono-repos with very frequent updates which would cause the ref
refs/multi-site/version/* to be continuously updated causing
packed-refs locks and consuming precious resources on the
global-refdb.

When using pull-replication and apply-object, the value of using the
refs/multi-site/version/* for tracking is not very useful anyway
because it gets replicated outside the batch.

Bug: Issue 313856493
Change-Id: I6b32e0423ed894793f55ed57c60cc356ebe2a31a
diff --git a/src/main/resources/Documentation/about.md b/src/main/resources/Documentation/about.md
index d7c5648..1587bd9 100644
--- a/src/main/resources/Documentation/about.md
+++ b/src/main/resources/Documentation/about.md
@@ -96,6 +96,8 @@
 
 `metric=plugins/multi-site/multi_site/subscriber/subscriber_message_consumer_failure_counter/subscriber_msg_consumer_poll_failure_counter, type=com.codahale.metrics.Meter`
 
+### Replication lag
+
 * Subscriber replication lag (sec behind the producer)
 
 `metric=site/multi_site/subscriber/subscriber_replication_status/sec_behind, type=com.google.gerrit.metrics.dropwizard.CallbackMetricImpl`
@@ -103,3 +105,6 @@
 * Subscriber replication lag (millisec behind the producer)
 
 `metric=site/multi_site/subscriber/subscriber_replication_status/msec_behind, type=com.google.gerrit.metrics.dropwizard.CallbackMetricImpl`
+
+> **NOTE**: The replication lag metrics are omitted when `ref-database.replicationLagEnabled` configuration
+> setting in `multi-site.config` is set to `false`.
\ No newline at end of file
diff --git a/src/main/resources/Documentation/config.md b/src/main/resources/Documentation/config.md
index 0485d5b..7547fd9 100644
--- a/src/main/resources/Documentation/config.md
+++ b/src/main/resources/Documentation/config.md
@@ -95,10 +95,18 @@
 :   Enable the use of a shared ref-database
     Defaults: true
 
+```ref-database.replicationLagEnabled```
+:   Enable the metrics to trace the auto-replication lag between sites
+    updating the `refs/multi-site/version/*` to the _epoch_ timestamp in
+    milliseconds. Please note that the `replication-lag` REST-API is also
+    disabled if this setting is false.
+    Defaults: true
+
 ```ref-database.replicationLagRefreshInterval```
 :   Enable the auto-refresh of the metrics to trace the auto-replication
     lag by polling on a regular basis. Set to zero for disabling the polling
-    mechanism.
+    mechanism. Disabled automatically when `ref-database.replicationLagEnable`
+    is set to false.
     Defaults: 60 min
 
 ```ref-database.enforcementRules.<policy>```
diff --git a/src/main/resources/Documentation/http-endpoints.md b/src/main/resources/Documentation/http-endpoints.md
index ff56fdf..3774a38 100644
--- a/src/main/resources/Documentation/http-endpoints.md
+++ b/src/main/resources/Documentation/http-endpoints.md
@@ -39,4 +39,6 @@
 * limit=LIMIT
 
 maximum number of projects to return
-*default:10*
\ No newline at end of file
+*default:10*
+
+> **NOTE** This endpoint is disabled when `ref-database.replicationLagEnabled` is set to `false`.
\ No newline at end of file