class GitLab::Exporter::Database::RemoteMirrorsCollector

A helper class to collect remote mirrors metrics.

Constants

QUERY

Public Class Methods

new(**args) click to toggle source
Calls superclass method GitLab::Exporter::Database::Base::new
# File lib/gitlab_exporter/database/remote_mirrors.rb, line 13
def initialize(**args)
  super(**args)

  @project_ids = args[:project_ids]
end

Public Instance Methods

run() click to toggle source
# File lib/gitlab_exporter/database/remote_mirrors.rb, line 19
def run
  return if @project_ids.nil? || @project_ids.empty?

  execute(QUERY % [@project_ids.join(",")]) # rubocop:disable Style/FormatString
end

Private Instance Methods

execute(query) click to toggle source
# File lib/gitlab_exporter/database/remote_mirrors.rb, line 27
def execute(query)
  with_connection_pool do |conn|
    conn.exec(query)
  end
rescue PG::UndefinedTable, PG::UndefinedColumn
  nil
end