Allow plugins to set a custom metrics prefix
By specifying the prefix in the gerrit.config, i.e.
[plugin "my-plugin"]
metricsPrefix = "my-root"
the metrics emitted by the plugin will be recorded under:
/gerrit/my-root/metric-name
rather than the default:
/gerrit/plugins/my-plugin/metric-name
Change-Id: Id45682c30e66e266ff5360f8f3fa4fa636151b1d
Signed-off-by: David Pursehouse <dpursehouse@collab.net>
diff --git a/Documentation/dev-plugins.txt b/Documentation/dev-plugins.txt
index d085731..9752d14 100644
--- a/Documentation/dev-plugins.txt
+++ b/Documentation/dev-plugins.txt
@@ -2220,7 +2220,17 @@
Note that metrics cannot be recorded from plugin init steps that
are run during site initialization.
-Plugin metrics are recorded under `plugins/${plugin-name}/${metric-name}`.
+By default, plugin metrics are recorded under
+`plugins/${plugin-name}/${metric-name}`. This can be changed by
+setting `plugins.${plugin-name}.metricsPrefix` in the `gerrit.config`
+file. For example:
+
+----
+ [plugin "my-plugin"]
+ metricsPrefix = my-metrics
+----
+
+will cause the metrics to be recorded under `my-metrics/${metric-name}`.
See the replication metrics in the
link:https://gerrit.googlesource.com/plugins/replication/+/master/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationMetrics.java[