Module: ActiveRecord::ConnectionAdapters::HoneycombAdapter

Defined in:
lib/active_record/connection_adapters/honeycomb_adapter.rb

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.builderObject (readonly)

Returns the value of attribute builder.



38
39
40
# File 'lib/active_record/connection_adapters/honeycomb_adapter.rb', line 38

def builder
  @builder
end

.clientObject

Returns the value of attribute client.



37
38
39
# File 'lib/active_record/connection_adapters/honeycomb_adapter.rb', line 37

def client
  @client
end

.loggerObject

Returns the value of attribute logger.



39
40
41
# File 'lib/active_record/connection_adapters/honeycomb_adapter.rb', line 39

def logger
  @logger
end

Class Method Details

.prepended(klazz) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/active_record/connection_adapters/honeycomb_adapter.rb', line 41

def prepended(klazz)
  debug "included into #{klazz.name}"

  if @client
    debug "configured with #{@client.class.name}"
  elsif defined?(::Honeycomb.client)
    debug "initialized with #{::Honeycomb.client.class.name} from honeycomb-beeline"
    @client = ::Honeycomb.client
  else
    raise "Please ensure your database config sets :honeycomb_client in order to use #{self.name} (try ActiveRecord::Honeycomb.munge_config)"
  end

  @builder = @client.builder.add(
    'type' => 'db',
    'meta.package' => 'activerecord',
    'meta.package_version' => ActiveRecord::VERSION::STRING,
  )

  super
end

Instance Method Details

#exec_delete(sql, name, binds = [], *args) ⇒ Object



94
95
96
97
98
99
100
# File 'lib/active_record/connection_adapters/honeycomb_adapter.rb', line 94

def exec_delete(sql, name, binds = [], *args)
  sending_honeycomb_event(sql, name, binds) do |event|
    with_tracing_if_available(event) do
      super
    end
  end
end

#exec_insert(sql, name, binds, *args) ⇒ Object



86
87
88
89
90
91
92
# File 'lib/active_record/connection_adapters/honeycomb_adapter.rb', line 86

def exec_insert(sql, name, binds, *args)
  sending_honeycomb_event(sql, name, binds) do |event|
    with_tracing_if_available(event) do
      super
    end
  end
end

#exec_query(sql, name = 'SQL', binds = [], *args) ⇒ Object



78
79
80
81
82
83
84
# File 'lib/active_record/connection_adapters/honeycomb_adapter.rb', line 78

def exec_query(sql, name = 'SQL', binds = [], *args)
  sending_honeycomb_event(sql, name, binds) do |event|
    with_tracing_if_available(event) do
      super
    end
  end
end

#exec_update(sql, name, binds = [], *args) ⇒ Object



102
103
104
105
106
107
108
# File 'lib/active_record/connection_adapters/honeycomb_adapter.rb', line 102

def exec_update(sql, name, binds = [], *args)
  sending_honeycomb_event(sql, name, binds) do |event|
    with_tracing_if_available(event) do
      super
    end
  end
end

#execute(sql, name = nil, *args) ⇒ Object



70
71
72
73
74
75
76
# File 'lib/active_record/connection_adapters/honeycomb_adapter.rb', line 70

def execute(sql, name = nil, *args)
  sending_honeycomb_event(sql, name, []) do |event|
    with_tracing_if_available(event) do
      super
    end
  end
end