Class: StandardHealth::Checks::ActiveRecord

Inherits:
StandardHealth::Check show all
Defined in:
lib/standard_health/checks/active_record.rb

Overview

Verifies the primary database connection by executing ‘SELECT 1`. Critical by default — if the database is unreachable, the host app cannot serve meaningful traffic.

Instance Attribute Summary

Attributes inherited from StandardHealth::Check

#critical, #name

Instance Method Summary collapse

Methods inherited from StandardHealth::Check

#critical?, #with_timing

Constructor Details

#initialize(name: :active_record, critical: true) ⇒ ActiveRecord

Returns a new instance of ActiveRecord.



11
12
13
# File 'lib/standard_health/checks/active_record.rb', line 11

def initialize(name: :active_record, critical: true)
  super
end

Instance Method Details

#runObject



15
16
17
18
19
# File 'lib/standard_health/checks/active_record.rb', line 15

def run
  with_timing do
    ::ActiveRecord::Base.connection.execute("SELECT 1")
  end
end