Fix the db-specific replica metrics are not stored in logs
requested to merge 346923-the-db-specific-replica-metrics-are-not-properly-stored-in-logs into master
What does this MR do and why?
- Fix the
Gitlab::Metrics::Subscribers::ActiveRecord.load_balancing_metric_keys
to return the proper metric keys for database replicas. - Change the per-database metrics to not include the db-role, from today's
db_(primary|replica)_(main|ci|main_replica|ci_replica)_(metric)
intodb_(main|main_replica|ci|ci_replica)_(metric)
.
How to set up and validate locally
-
Enable the database load balancing
-
Start GDK with
GITLAB_MULTIPLE_DATABASE_METRICS=true gdk start
-
Visit any page such as
http://127.0.0.1:3000
-
In the
log
development_json.log` look for the following snippet"db_count": 2, "db_write_count": 0, "db_cached_count": 0, "db_replica_count": 2, "db_main_replica_count": 2, ...
-
Ensure you don't have 0s everywhere and the numbers match.
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.
Related issues
Related to #346923 (closed)
Edited by Douglas Barbosa Alexandre