The configuration of the metrics-reporter-prometheus plugin is done in the gerrit.config
file.
To access the monitoring URL, a user must be a member of a group that is granted the ‘View Metrics’ capability (provided by this plugin) or the ‘Administrate Server’ capability. Alternatively, authentication using prometheus bearer token is also supported.
This capability can be configured in the ‘Global Capabilities’ section of the ‘All-Projects’ access right.
It is possible to allow anonymous access to the metrics by giving the capability to the ‘Anonymous Users’ group.
When defined, access to the plugins/metrics-reporter-prometheus/metrics URL does not require any authentication and do not check any ACL related to the ‘View Metrics’ global capability. See Prometheus documentation for how to configure the integration with Prometheus.
The matching is done against the Gerrit metrics names as documented on ‘Metrics’. The pattern matching is done internally using regex.Matcher.matches()
and can match anywhere (not necessarly starting at the beginning of the metric name)
By default no metric is excluded.
For examples:
To exclude all metrics matching cache
at some place in their key, use: excludeMetrics = cache.*
To exclude multiple metrics:
[plugin "metrics-reporter-prometheus"]
excludeMetrics = ^http/server/rest_api/.*
excludeMetrics = ^license/cla_check_count
excludeMetrics = ^plugin/latency/.*
excludeMetrics = ^reviewer_suggestion/.*
excludeMetrics = ^sequence/next_id_latency.*