module BaselineRedRpm::Instruments::ActiveRecord::Adapters::Mysql2
Constants
- IGNORE_STATEMENTS
Public Instance Methods
execute_with_trace(sql, name = nil)
click to toggle source
# File lib/baseline_red_rpm/instruments/active_record/adapters/mysql2.rb, line 22 def execute_with_trace(sql, name = nil) if ::BaselineRedRpm::Tracer.tracing? unless ignore_trace?(name) adapter = connection_config.fetch(:adapter) sanitized_sql = sanitize_sql(sql, adapter) span = BaselineRedRpm.tracer.start_span(name || 'SQL', tags: { "component" => "ActiveRecord", "span.kind" => "client", "db.statement" => sanitized_sql, "db.user" => connection_config.fetch(:username, 'unknown'), "db.instance" => connection_config.fetch(:database), "db.vendor" => adapter, "db.type" => "sql" }) BaselineRedRpm::Utils.log_source_and_backtrace(span, :active_record) end end execute_without_trace(sql, name) rescue Exception => e if span span.set_tag('error', true) span.log_error(e) end raise ensure span.finish if span end
ignore_trace?(name)
click to toggle source
# File lib/baseline_red_rpm/instruments/active_record/adapters/mysql2.rb, line 16 def ignore_trace?(name) IGNORE_STATEMENTS[name.to_s] || (name && name.to_sym == :skip_logging) || name == 'ActiveRecord::SchemaMigration Load' end