Module: ActiveRecord::SqlAnalyzer

Defined in:
lib/active_record/sql_analyzer.rb,
lib/active_record/sql_analyzer/cli.rb,
lib/active_record/sql_analyzer/logger.rb,
lib/active_record/sql_analyzer/version.rb,
lib/active_record/sql_analyzer/analyzer.rb,
lib/active_record/sql_analyzer/redactor.rb,
lib/active_record/sql_analyzer/cli_processor.rb,
lib/active_record/sql_analyzer/configuration.rb,
lib/active_record/sql_analyzer/compact_logger.rb,
lib/active_record/sql_analyzer/redacted_logger.rb,
lib/active_record/sql_analyzer/backtrace_filter.rb,
lib/active_record/sql_analyzer/monkeypatches/query.rb,
lib/active_record/sql_analyzer/background_processor.rb,
lib/active_record/sql_analyzer/monkeypatches/tagger.rb

Defined Under Namespace

Modules: Monkeypatches Classes: Analyzer, BackgroundProcessor, BacktraceFilter, CLI, CLIProcessor, CompactLogger, Configuration, Logger, RedactedLogger, Redactor

Constant Summary collapse

VERSION =
'0.2.2'

Class Method Summary collapse

Class Method Details

.background_processorObject



25
26
27
# File 'lib/active_record/sql_analyzer.rb', line 25

def self.background_processor
  @background_processor ||= BackgroundProcessor.new
end

.configObject



21
22
23
# File 'lib/active_record/sql_analyzer.rb', line 21

def self.config
  @config
end

.configure {|@config| ... } ⇒ Object

Yields:



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

def self.configure
  @config ||= Configuration.new
  yield @config
  @config
end

.install!Object



29
30
31
32
33
34
35
36
37
38
# File 'lib/active_record/sql_analyzer.rb', line 29

def self.install!
  return if @installed
  @installed = true

  # Install our patch that logs SQL queries
  ActiveRecord::ConnectionAdapters::Mysql2Adapter.prepend(Monkeypatches::Query)

  # Install our patch that enables a `with_tag` method on AR calls
  ActiveRecord::Relation.prepend(Monkeypatches::Tagger)
end