Class: GitLab::Exporter::Database::PgSequencesCollector

Inherits:
Base
  • Object
show all
Defined in:
lib/gitlab_exporter/database/pg_sequences.rb

Overview

A helper class to collect sequences metrics. Mainly used to monitor Cells sequences.

Constant Summary collapse

QUERY =
<<~SQL.freeze
  SELECT
    schemaname,
    sequencename,
    CONCAT(schemaname, '.', sequencename) AS fully_qualified_sequencename,
    start_value,
    min_value,
    max_value,
    last_value AS current_value
  FROM pg_catalog.pg_sequences;
SQL

Constants inherited from Base

Base::POOL_SIZE, Base::POOL_TIMEOUT

Instance Method Summary collapse

Methods inherited from Base

configure_type_map_for_results, connection_pool, #connection_pool, #initialize, #with_connection_pool

Constructor Details

This class inherits a constructor from GitLab::Exporter::Database::Base

Instance Method Details

#runObject



18
19
20
21
22
23
24
# File 'lib/gitlab_exporter/database/pg_sequences.rb', line 18

def run
  with_connection_pool do |conn|
    conn.exec(QUERY).each.with_object({}) do |row, stats|
      stats[row.delete("fully_qualified_sequencename")] = row
    end
  end
end