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

Defined in:
lib/httpx/plugins/tracing.rb,
sig/plugins/tracing.rbs

Overview

Connection mixin

Instance Method Summary collapse

Instance Method Details

#idlingObject



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

def idling
  super

  @init_time = nil
end

#initializeObject



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

def initialize(*)
  super

  @init_time = nil
end

#send_request_to_parser(request) ⇒ Object



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

def send_request_to_parser(request)
  if connecting?
    @init_time ||= ::Time.now.utc

    # request span timeframe should include the time it took to connect.
    request.init_time ||= @init_time
  end

  super
end

#terminateObject



131
132
133
134
135
136
# File 'lib/httpx/plugins/tracing.rb', line 131

def terminate
  super

  # ensure that connections which go back to the pool reset their init time.
  @init_time = nil
end