Sample database metrics for replica hosts
What does this MR do and why?
In !75793 (merged), we updated the database host metrics to include all connection classes, defined in Gitlab::Database.base_database_models
, not just ActiveRecord::Base
.
As a follow up to that, this MR extends the metrics collection to include statistics for replica hosts if any are configured.
Related to #346909 (closed)
How to set up and validate locally
- You can collect the metrics for your configured database hosts by executing the following in the rails console:
sampler = Gitlab::Metrics::Samplers::DatabaseSampler.new sampler.sample
labels
andstats
for each host. - You can then view and inspect the Prometheus metrics by running:
sampler.metrics
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Patrick Bair