Module: NewRelic::Security::Instrumentation::HTTPClient

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

Defined Under Namespace

Modules: Chain, Prepend

Instance Method Summary collapse

Instance Method Details

#do_request_async_on_enter(method, uri, query, body, header) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/newrelic_security/instrumentation-security/httpclient/instrumentation.rb', line 31

def do_request_async_on_enter(method, uri, query, body, header)
  event = nil
  NewRelic::Security::Agent.logger.debug "OnEnter : #{self.class}.#{__method__}"
  uri_s = uri.to_s unless uri.nil?
  event = NewRelic::Security::Agent::Control::Collector.collect(HTTP_REQUEST, [uri_s])
  NewRelic::Security::Instrumentation::InstrumentationUtils.add_tracing_data(header, 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

#do_request_async_on_exit(event) ⇒ Object



45
46
47
48
49
50
51
52
# File 'lib/newrelic_security/instrumentation-security/httpclient/instrumentation.rb', line 45

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

#do_request_on_enter(method, uri, query, body, header) ⇒ Object



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

def do_request_on_enter(method, uri, query, body, header)
  event = nil
  NewRelic::Security::Agent.logger.debug "OnEnter : #{self.class}.#{__method__}"
  uri_s = uri.to_s unless uri.nil?
  event = NewRelic::Security::Agent::Control::Collector.collect(HTTP_REQUEST, [uri_s])
  NewRelic::Security::Instrumentation::InstrumentationUtils.add_tracing_data(header, 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

#do_request_on_exit(event) ⇒ Object



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

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