lib/httpx/plugins/internal_telemetry.rb in httpx-0.17.0 vs lib/httpx/plugins/internal_telemetry.rb in httpx-0.18.0

- old
+ new

@@ -42,10 +42,15 @@ meter_elapsed_time("Session: initializing...") super meter_elapsed_time("Session: initialized!!!") end + def close(*) + super + meter_elapsed_time("Session -> close") + end + private def build_requests(*) elapsed_time { super } end @@ -53,27 +58,22 @@ def fetch_response(*) response = super meter_elapsed_time("Session -> response") if response response end - - def close(*) - super - meter_elapsed_time("Session -> close") - end end module RequestMethods def self.included(klass) klass.prepend TrackTimeMethods super end def transition(nextstate) - state = @state + prev_state = @state super - meter_elapsed_time("Request##{object_id}[#{@verb} #{@uri}: #{state}] -> #{nextstate}") if nextstate == @state + meter_elapsed_time("Request##{object_id}[#{@verb} #{@uri}: #{prev_state}] -> #{@state}") if prev_state != @state end end module ConnectionMethods def self.included(klass) @@ -82,10 +82,10 @@ end def transition(nextstate) state = @state super - meter_elapsed_time("Connection[#{@origin}]: #{state} -> #{nextstate}") if nextstate == @state + meter_elapsed_time("Connection##{object_id}[#{@origin}]: #{state} -> #{nextstate}") if nextstate == @state end end end register_plugin :internal_telemetry, InternalTelemetry end