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 =
"SELECT\n  schemaname,\n  sequencename,\n  CONCAT(schemaname, '.', sequencename) AS fully_qualified_sequencename,\n  start_value,\n  min_value,\n  max_value,\n  last_value AS current_value\nFROM pg_catalog.pg_sequences;\n".freeze

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