Module: Honeycomb::Sequel

Defined in:
lib/honeycomb/integrations/sequel.rb

Overview

Wrap sequel commands in a span

Instance Method Summary collapse

Instance Method Details

#honeycomb_clientObject



8
9
10
# File 'lib/honeycomb/integrations/sequel.rb', line 8

def honeycomb_client
  @honeycomb_client || Honeycomb.client
end

#honeycomb_client=(client) ⇒ Object



12
13
14
# File 'lib/honeycomb/integrations/sequel.rb', line 12

def honeycomb_client=(client)
  @honeycomb_client = client
end

#log_connection_yield(sql, conn, args = nil) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/honeycomb/integrations/sequel.rb', line 16

def log_connection_yield(sql, conn, args = nil)
  return super if honeycomb_client.nil?

  honeycomb_client.start_span(name: sql.sub(/\s+.*/, "").upcase) do |span|
    span.add_field "meta.package", "sequel"
    span.add_field "meta.package_version", ::Sequel::VERSION
    span.add_field "type", "db"
    span.add_field "db.sql", sql
    super
  end
end