Class: StackifyRubyAPM::Normalizers::ActiveRecord::SqlNormalizer Private

Inherits:
Normalizer
  • Object
show all
Includes:
Log
Defined in:
lib/stackify_apm/normalizers/active_record.rb

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.

Constant Summary

Constants included from Log

Log::PREFIX

Instance Method Summary collapse

Methods included from Log

#debug, #error, #fatal, #info, #log, #warn

Methods inherited from Normalizer

register

Constructor Details

#initialize(*args) ⇒ SqlNormalizer

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.

Returns a new instance of SqlNormalizer.



15
16
17
# File 'lib/stackify_apm/normalizers/active_record.rb', line 15

def initialize(*args)
  super(*args)
end

Instance Method Details

#normalize(_transaction, _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.



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/stackify_apm/normalizers/active_record.rb', line 19

def normalize(_transaction, _name, payload)
  return :skip if %w[SCHEMA CACHE].include?(payload[:name])

  statement = query_variables(payload)
  check_prepared_stmt(statement, payload)
  name = payload[:sql] || payload[:name] || 'Default'
  context = Span::Context.new(statement)

  type = format('db.%s.sql', lookup_adapter(payload) || 'unknown').freeze
  [name, type, context]
end