Module: NewRelic::Security::Instrumentation::Nokogiri::XML

Included in:
Node::Prepend, NodeSet::Prepend
Defined in:
lib/newrelic_security/instrumentation-security/nokogiri/chain.rb,
lib/newrelic_security/instrumentation-security/nokogiri/chain.rb,
lib/newrelic_security/instrumentation-security/nokogiri/prepend.rb,
lib/newrelic_security/instrumentation-security/nokogiri/instrumentation.rb

Defined Under Namespace

Modules: Node, NodeSet

Instance Method Summary collapse

Instance Method Details

#xpath_on_enter(*var) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/newrelic_security/instrumentation-security/nokogiri/instrumentation.rb', line 8

def xpath_on_enter(*var)
  event = nil
  NewRelic::Security::Agent.logger.debug "OnEnter : #{self.class}.#{__method__}"
  paths, _, _, binds = extract_params(var)
  hash = { :paths => paths, :variables => binds }
  event = NewRelic::Security::Agent::Control::Collector.collect(XPATH, [hash])
rescue => exception
  NewRelic::Security::Agent.logger.error "Exception in hook in #{self.class}.#{__method__}, #{exception.inspect}, #{exception.backtrace}"
ensure
  yield
  return event
end

#xpath_on_exit(event) ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/newrelic_security/instrumentation-security/nokogiri/instrumentation.rb', line 21

def xpath_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