Skip to content

Instrument database mode in service ping report

What does this MR do and why?

Addressing: #393573 (closed)

Adding database.mode to the service ping report.

How to set up and validate locally

You can configure your database config/database.yml in any of the 3 modes:

Database Configuration
  1. Single database single-database (no ci: entry)
development:
  main:
    ....
  1. Single Database with CI Connection single-database-ci-connection:
development:
  main:
    database: gitlabhq_development
  ci:
    database: gitlabhq_development # the same as the one you have in main
    database_tasks: false # the default is true
  1. Two databases
development:
  main:
    database: gitlabhq_development
    database_tasks: true # that's the default value anyway
  ci:
    database: gitlabhq_development_ci # Different as the one you have in main
    database_tasks: true

After you configure your database in any of the 3 modes, run these steps in Rails Console to see the database.mode in the service ping report

Rails.cache.delete('usage_data')
data = ::Gitlab::Usage::ServicePingReport.for(output: :all_metrics_values)
puts data[:database] # You should see the database mode in the output

or

Rails.cache.delete('usage_data')
GitlabServicePingWorker.new.perform
RawUsageData.last.payload["database"]

References:

MR acceptance checklist

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

Related to #393573 (closed)

Edited by Omar Qunsul

Merge request reports