Class: Excon::Middleware::NewRelicCrossAppTracing
- Inherits:
-
Object
- Object
- Excon::Middleware::NewRelicCrossAppTracing
- Defined in:
- lib/new_relic/agent/instrumentation/excon/middleware.rb
Instance Method Summary collapse
- #error_call(datum) ⇒ Object
- #finish_trace(datum) ⇒ Object
-
#initialize(stack) ⇒ NewRelicCrossAppTracing
constructor
A new instance of NewRelicCrossAppTracing.
- #request_call(datum) ⇒ Object
- #response_call(datum) ⇒ Object
Constructor Details
#initialize(stack) ⇒ NewRelicCrossAppTracing
Returns a new instance of NewRelicCrossAppTracing.
8 9 10 |
# File 'lib/new_relic/agent/instrumentation/excon/middleware.rb', line 8 def initialize(stack) @stack = stack end |
Instance Method Details
#error_call(datum) ⇒ Object
28 29 30 31 |
# File 'lib/new_relic/agent/instrumentation/excon/middleware.rb', line 28 def error_call(datum) finish_trace(datum) @stack.error_call(datum) end |
#finish_trace(datum) ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/new_relic/agent/instrumentation/excon/middleware.rb', line 33 def finish_trace(datum) trace_data = datum.delete(:newrelic_trace_data) if trace_data t0, segment, wrapped_request = trace_data if datum[:response] wrapped_response = ::NewRelic::Agent::HTTPClients::ExconHTTPResponse.new(datum[:response]) end ::NewRelic::Agent::CrossAppTracing.finish_trace(t0, segment, wrapped_request, wrapped_response) end end |
#request_call(datum) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/new_relic/agent/instrumentation/excon/middleware.rb', line 12 def request_call(datum) begin wrapped_request = ::NewRelic::Agent::HTTPClients::ExconHTTPRequest.new(datum) t0, segment = ::NewRelic::Agent::CrossAppTracing.start_trace(wrapped_request) datum[:newrelic_trace_data] = [t0, segment, wrapped_request] rescue => e NewRelic::Agent.logger.debug(e) end @stack.request_call(datum) end |
#response_call(datum) ⇒ Object
23 24 25 26 |
# File 'lib/new_relic/agent/instrumentation/excon/middleware.rb', line 23 def response_call(datum) finish_trace(datum) @stack.response_call(datum) end |