Skip to content

Log wal locations counters

What does this MR do and why?

We discussed, if we should remove wal_location_source? One of the reasons is that it does not give us precise information, since we are getting wal location from multiple databases(:ci, :main), and each have it's own primary and replicas. Also, in case when we try to read from the replica, but the replica is not available, we will log wal_location_source: replica, but the actual source would be the primary.

In ActiveRecord::Subscriber we already monitor wal location queries, along with the database name(ci|main) and the database role (replica|primary), so instead of logging:

wal_location_source: primary

we could actually log

          'db_ci_wal_count' => 1,
          'db_ci_replica_wal_count' => 0,
          'db_main_wal_count' => 1,
          'db_main_replica_wal_count' => 0,
          'db_replica_wal_count' => 0,
          'db_primary_wal_count' => 2

This can provide us with enough information, what happened.

Note:

We are already logging all load balancing counters for jobs that are finished (job_status: done) This adds wal_counters also for logs when the job was scheduled (job_status: start)

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Nikola Milojevic

Merge request reports