Module: NewRelic::Security::Instrumentation::Curl::Multi

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

Defined Under Namespace

Modules: Chain, Prepend

Instance Method Summary collapse

Instance Method Details

#perform_on_enter(*args) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/newrelic_security/instrumentation-security/curb/instrumentation.rb', line 8

def perform_on_enter(*args)
  event = nil
  NewRelic::Security::Agent.logger.debug "OnEnter : #{self.class}.#{__method__}"
  ic_args = []
  self.requests.each {
    |key, req|
    uri = NewRelic::Security::Instrumentation::InstrumentationUtils.parse_uri(req.url)
    ic_args.push(uri.to_s) if uri
  }
  event = NewRelic::Security::Agent::Control::Collector.collect(HTTP_REQUEST, ic_args)
  self.requests.each { |key, req| NewRelic::Security::Instrumentation::InstrumentationUtils.add_tracing_data(req.headers, event) } if event
  event
rescue => exception
  NewRelic::Security::Agent.logger.error "Exception in hook in #{self.class}.#{__method__}, #{exception.inspect}, #{exception.backtrace}"
ensure
  yield
  return event
end

#perform_on_exit(event) ⇒ Object



27
28
29
30
31
32
33
34
# File 'lib/newrelic_security/instrumentation-security/curb/instrumentation.rb', line 27

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