Class: Gitlab::Database::HealthStatus::Indicators::AutovacuumActiveOnTable

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/database/health_status/indicators/autovacuum_active_on_table.rb

Instance Method Summary collapse

Constructor Details

#initialize(context) ⇒ AutovacuumActiveOnTable

Returns a new instance of AutovacuumActiveOnTable.



8
9
10
# File 'lib/gitlab/database/health_status/indicators/autovacuum_active_on_table.rb', line 8

def initialize(context)
  @tables = context.tables
end

Instance Method Details

#evaluateObject



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/gitlab/database/health_status/indicators/autovacuum_active_on_table.rb', line 12

def evaluate
  return Signals::NotAvailable.new(self.class, reason: 'indicator disabled') unless enabled?

  autovacuum_active_on = active_autovacuums_for(tables)

  if autovacuum_active_on.empty?
    Signals::Normal.new(self.class, reason: 'no autovacuum running on any relevant tables')
  else
    Signals::Stop.new(self.class, reason: "autovacuum running on: #{autovacuum_active_on.join(', ')}")
  end
end