Class: MultiTenant::QueryMonitor

Inherits:
Object
  • Object
show all
Defined in:
lib/activerecord-multi-tenant/query_monitor.rb

Overview

rubocop:enable Style/ClassVars QueryMonitor class to log a warning when a query fails and there is no tenant set start and finish methods are required to be register sql.active_record hook

Instance Method Summary collapse

Instance Method Details

#finish(_name, _id, payload) ⇒ Object



24
25
26
27
28
29
30
# File 'lib/activerecord-multi-tenant/query_monitor.rb', line 24

def finish(_name, _id, payload)
  return unless MultiTenant.query_monitor_enabled?

  return unless payload[:exception].present? && MultiTenant.current_tenant_id.nil?

  Rails.logger.info 'WARNING: Tenant not present - make sure to add MultiTenant.with(tenant) { ... }'
end

#start(_name, _id, _payload) ⇒ Object



22
# File 'lib/activerecord-multi-tenant/query_monitor.rb', line 22

def start(_name, _id, _payload) end