Class: Skylight::Core::Normalizers::ActiveRecord::SQL Private

Inherits:
SQL
  • Object
show all
Defined in:
lib/skylight/core/normalizers/active_record/sql.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Normalizer for SQL requests

API:

  • private

Constant Summary

Constants inherited from SQL

SQL::CAT

Instance Attribute Summary

Attributes inherited from Normalizer

#config

Instance Method Summary collapse

Methods inherited from Normalizer

#initialize, #normalize_after, register

Constructor Details

This class inherits a constructor from Skylight::Core::Normalizers::Normalizer

Instance Method Details

#normalize(trace, name, payload) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# 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