Module: NewRelic::Security::Instrumentation::SQLite3::Database
- Included in:
- Prepend
- Defined in:
- lib/newrelic_security/instrumentation-security/sqlite3/chain.rb,
lib/newrelic_security/instrumentation-security/sqlite3/prepend.rb,
lib/newrelic_security/instrumentation-security/sqlite3/instrumentation.rb
Defined Under Namespace
Instance Method Summary collapse
- #execute_batch2_on_enter(sql) ⇒ Object
- #execute_batch2_on_exit(event) ⇒ Object
- #execute_batch_on_enter(sql, bind_vars, *args) ⇒ Object
- #execute_batch_on_exit(event) ⇒ Object
-
#execute_on_enter(sql, bind_vars, *args) ⇒ Object
TODO: When bind_param(index, value) is called and then execute is called directly in such case bind_params found are nil because bind_param method is in ext c file.
- #execute_on_exit(event) ⇒ Object
Instance Method Details
#execute_batch2_on_enter(sql) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/newrelic_security/instrumentation-security/sqlite3/instrumentation.rb', line 56 def execute_batch2_on_enter(sql) event = nil NewRelic::Security::Agent.logger.debug "OnEnter : #{self.class}.#{__method__}" hash = {} hash[:sql] = sql hash[:parameters] = [] event = NewRelic::Security::Agent::Control::Collector.collect(SQL_DB_COMMAND, [hash], SQLITE) unless NewRelic::Security::Instrumentation::InstrumentationUtils.sql_filter_events?(hash[:sql]) rescue => exception NewRelic::Security::Agent.logger.error "Exception in hook in #{self.class}.#{__method__}, #{exception.inspect}, #{exception.backtrace}" ensure yield return event end |
#execute_batch2_on_exit(event) ⇒ Object
70 71 72 73 74 75 76 77 |
# File 'lib/newrelic_security/instrumentation-security/sqlite3/instrumentation.rb', line 70 def execute_batch2_on_exit(event) NewRelic::Security::Agent.logger.debug "OnExit : #{self.class}.#{__method__}" NewRelic::Security::Agent::Utils.create_exit_event(event) rescue => exception NewRelic::Security::Agent.logger.error "Exception in hook in #{self.class}.#{__method__}, #{exception.inspect}, #{exception.backtrace}" ensure yield end |
#execute_batch_on_enter(sql, bind_vars, *args) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/newrelic_security/instrumentation-security/sqlite3/instrumentation.rb', line 32 def execute_batch_on_enter(sql, bind_vars, *args) event = nil NewRelic::Security::Agent.logger.debug "OnEnter : #{self.class}.#{__method__}" hash = {} hash[:sql] = sql hash[:parameters] = bind_vars.is_a?(String) ? [bind_vars] : bind_vars.flatten hash[:parameters] = hash[:parameters] + args unless args.empty? event = NewRelic::Security::Agent::Control::Collector.collect(SQL_DB_COMMAND, [hash], SQLITE) unless NewRelic::Security::Instrumentation::InstrumentationUtils.sql_filter_events?(hash[:sql]) rescue => exception NewRelic::Security::Agent.logger.error "Exception in hook in #{self.class}.#{__method__}, #{exception.inspect}, #{exception.backtrace}" ensure yield return event end |
#execute_batch_on_exit(event) ⇒ Object
47 48 49 50 51 52 53 54 |
# File 'lib/newrelic_security/instrumentation-security/sqlite3/instrumentation.rb', line 47 def execute_batch_on_exit(event) NewRelic::Security::Agent.logger.debug "OnExit : #{self.class}.#{__method__}" NewRelic::Security::Agent::Utils.create_exit_event(event) rescue => exception NewRelic::Security::Agent.logger.error "Exception in hook in #{self.class}.#{__method__}, #{exception.inspect}, #{exception.backtrace}" ensure yield end |
#execute_on_enter(sql, bind_vars, *args) ⇒ Object
TODO: When bind_param(index, value) is called and then execute is called directly in such case bind_params found are nil because bind_param method is in ext c file.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/newrelic_security/instrumentation-security/sqlite3/instrumentation.rb', line 8 def execute_on_enter(sql, bind_vars, *args) event = nil NewRelic::Security::Agent.logger.debug "OnEnter : #{self.class}.#{__method__}" hash = {} hash[:sql] = sql hash[:parameters] = bind_vars.is_a?(String) ? [bind_vars] : bind_vars.flatten hash[:parameters] = hash[:parameters] + args.map(&:to_s) unless args.empty? event = NewRelic::Security::Agent::Control::Collector.collect(SQL_DB_COMMAND, [hash], SQLITE) unless NewRelic::Security::Instrumentation::InstrumentationUtils.sql_filter_events?(hash[:sql]) rescue => exception NewRelic::Security::Agent.logger.error "Exception in hook in #{self.class}.#{__method__}, #{exception.inspect}, #{exception.backtrace}" ensure yield return event end |
#execute_on_exit(event) ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/newrelic_security/instrumentation-security/sqlite3/instrumentation.rb', line 23 def execute_on_exit(event) NewRelic::Security::Agent.logger.debug "OnExit : #{self.class}.#{__method__}" NewRelic::Security::Agent::Utils.create_exit_event(event) rescue => exception NewRelic::Security::Agent.logger.error "Exception in hook in #{self.class}.#{__method__}, #{exception.inspect}, #{exception.backtrace}" ensure yield end |