Class: Excon::Connection
- Inherits:
-
Object
- Object
- Excon::Connection
- Defined in:
- lib/ting_yun/instrumentation/excon.rb
Class Method Summary collapse
Instance Method Summary collapse
- #request_with_tingyun_trace(params, &block) ⇒ Object
- #tingyun_connection_params ⇒ Object
- #tingyun_resolved_request_params(request_params) ⇒ Object
Class Method Details
.install_tingyun_instrumentation ⇒ Object
74 75 76 77 |
# File 'lib/ting_yun/instrumentation/excon.rb', line 74 def self.install_tingyun_instrumentation alias request_without_tingyun_trace request alias request request_with_tingyun_trace end |
Instance Method Details
#request_with_tingyun_trace(params, &block) ⇒ Object
63 64 65 66 67 68 69 70 71 72 |
# File 'lib/ting_yun/instrumentation/excon.rb', line 63 def request_with_tingyun_trace(params, &block) orig_response = nil resolved_params = tingyun_resolved_request_params(params) wrapped_request = ::TingYun::Http::ExconHTTPRequest.new(resolved_params) ::TingYun::Agent::CrossAppTracing.trace_http_request(wrapped_request) do orig_response = request_without_tingyun_trace(resolved_params, &block) ::TingYun::Http::ExconHTTPResponse.new(orig_response) end orig_response end |
#tingyun_connection_params ⇒ Object
53 54 55 |
# File 'lib/ting_yun/instrumentation/excon.rb', line 53 def tingyun_connection_params (@connection || @data) end |
#tingyun_resolved_request_params(request_params) ⇒ Object
57 58 59 60 61 |
# File 'lib/ting_yun/instrumentation/excon.rb', line 57 def tingyun_resolved_request_params(request_params) resolved = tingyun_connection_params.merge(request_params) resolved[:headers] = resolved[:headers].merge(request_params[:headers] || {}) resolved end |