Module: HTTPX::Plugins::Tracing::ConnectionMethods

Defined in:
lib/httpx/plugins/tracing.rb

Overview

Connection mixin

Instance Method Summary collapse

Instance Method Details

#idlingObject



123
124
125
126
127
128
129
# File 'lib/httpx/plugins/tracing.rb', line 123

def idling
  super

  # time of initial request(s) is accounted from the moment
  # the connection is back to :idle, and ready to connect again.
  @init_time = ::Time.now.utc
end

#initializeObject



108
109
110
111
112
# File 'lib/httpx/plugins/tracing.rb', line 108

def initialize(*)
  super

  @init_time = ::Time.now.utc
end

#send_request_to_parser(request) ⇒ Object



114
115
116
117
118
119
120
121
# File 'lib/httpx/plugins/tracing.rb', line 114

def send_request_to_parser(request)
  if connecting?
    # request span timeframe should include the time it took to connect.
    request.init_time ||= @init_time
  end

  super
end