class Skylight::Core::Normalizers::ActiveRecord::SQL

Normalizer for SQL requests

Public Instance Methods

normalize(trace, name, payload) click to toggle source
# File lib/skylight/core/normalizers/active_record/sql.rb, line 10
def normalize(trace, name, payload)
  ret = super
  return :skip if ret == :skip

  name, title, description, meta = ret

  meta ||= {}

  # FIXME: This may not be correct if the class has a different connection
  begin
    config = ::ActiveRecord::Base.connection_config
    meta[:adapter] = config[:adapter]
    meta[:database] = config[:database]
  rescue => e
    trace.instrumenter.warn "Unable to get ActiveRecord config; e=#{e}"
  end

  [name, title, description, meta]
end