Module: AppPerfRpm::Instruments::ActiveRecord::Adapters::Mysql2
- Includes:
- Utils
- Defined in:
- lib/app_perf_rpm/instruments/active_record/adapters/mysql2.rb
Constant Summary collapse
- IGNORE_STATEMENTS =
{ "SCHEMA" => true, "EXPLAIN" => true, "CACHE" => true }
Instance Method Summary collapse
Methods included from Utils
Instance Method Details
#execute_with_trace(sql, name = nil) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/app_perf_rpm/instruments/active_record/adapters/mysql2.rb', line 20 def execute_with_trace(sql, name = nil) if ::AppPerfRpm::Tracer.tracing? if ignore_trace?(name) execute_without_trace(sql, name) else sanitized_sql = sanitize_sql(sql, :mysql2) AppPerfRpm::Tracer.trace('activerecord') do |span| span. ={ "adapter" => "mysql2", "query" => sanitized_sql, "name" => name } execute_without_trace(sql, name) end end else execute_without_trace(sql, name) end end |
#ignore_trace?(name) ⇒ Boolean
14 15 16 17 18 |
# File 'lib/app_perf_rpm/instruments/active_record/adapters/mysql2.rb', line 14 def ignore_trace?(name) IGNORE_STATEMENTS[name.to_s] || (name && name.to_sym == :skip_logging) || name == 'ActiveRecord::SchemaMigration Load' end |