Module: Oboe::Inst::SequelDatabase

Defined in:
lib/oboe/inst/sequel.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



46
47
48
49
50
51
# File 'lib/oboe/inst/sequel.rb', line 46

def self.included(klass)
  ::Oboe::Util.method_alias(klass, :run, ::Sequel::Database)
  ::Oboe::Util.method_alias(klass, :execute_ddl, ::Sequel::Database)
  ::Oboe::Util.method_alias(klass, :execute_dui, ::Sequel::Database)
  ::Oboe::Util.method_alias(klass, :execute_insert, ::Sequel::Database)
end

Instance Method Details

#exec_with_oboe(method, sql, opts = ::Sequel::OPTS, &block) ⇒ Object



66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/oboe/inst/sequel.rb', line 66

def exec_with_oboe(method, sql, opts=::Sequel::OPTS, &block)
  kvs = extract_trace_details(sql, opts)

  Oboe::API.log_entry('sequel', kvs)

  send(method, sql, opts, &block)
rescue => e
  Oboe::API.log_exception('sequel', e)
  raise e
ensure
  Oboe::API.log_exit('sequel')
end

#execute_ddl_with_oboe(sql, opts = ::Sequel::OPTS, &block) ⇒ Object



79
80
81
82
83
84
85
# File 'lib/oboe/inst/sequel.rb', line 79

def execute_ddl_with_oboe(sql, opts=::Sequel::OPTS, &block)
  # If we're already tracing a sequel operation, then this call likely came
  # from Sequel::Dataset.  In this case, just pass it on.
  return execute_ddl_without_oboe(sql, opts, &block) if Oboe.tracing_layer?('sequel')

  exec_with_oboe(:execute_ddl_without_oboe, sql, opts, &block)
end

#execute_dui_with_oboe(sql, opts = ::Sequel::OPTS, &block) ⇒ Object



87
88
89
90
91
92
93
# File 'lib/oboe/inst/sequel.rb', line 87

def execute_dui_with_oboe(sql, opts=::Sequel::OPTS, &block)
  # If we're already tracing a sequel operation, then this call likely came
  # from Sequel::Dataset.  In this case, just pass it on.
  return execute_dui_without_oboe(sql, opts, &block) if Oboe.tracing_layer?('sequel')

  exec_with_oboe(:execute_dui_without_oboe, sql, opts, &block)
end

#execute_insert_with_oboe(sql, opts = ::Sequel::OPTS, &block) ⇒ Object



95
96
97
98
99
100
101
# File 'lib/oboe/inst/sequel.rb', line 95

def execute_insert_with_oboe(sql, opts=::Sequel::OPTS, &block)
  # If we're already tracing a sequel operation, then this call likely came
  # from Sequel::Dataset.  In this case, just pass it on.
  return execute_insert_without_oboe(sql, opts, &block) if Oboe.tracing_layer?('sequel')

  exec_with_oboe(:execute_insert_without_oboe, sql, opts, &block)
end

#run_with_oboe(sql, opts = ::Sequel::OPTS) ⇒ Object



53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/oboe/inst/sequel.rb', line 53

def run_with_oboe(sql, opts=::Sequel::OPTS)
  kvs = extract_trace_details(sql, opts)

  Oboe::API.log_entry('sequel', kvs)

  run_without_oboe(sql, opts)
rescue => e
  Oboe::API.log_exception('sequel', e)
  raise e
ensure
  Oboe::API.log_exit('sequel')
end