lib/httpx/plugins/internal_telemetry.rb in httpx-0.22.5 vs lib/httpx/plugins/internal_telemetry.rb in httpx-0.23.0

- old
+ new

@@ -30,19 +30,35 @@ elapsed = after_time - prev_time warn(+"\e[31m" << "[ELAPSED TIME]: #{label}: #{elapsed} (ms)" << "\e[0m") end end + module NativeResolverMethods + def transition(nextstate) + state = @state + val = super + meter_elapsed_time("Resolver::Native: #{state} -> #{nextstate}") + val + end + end + module InstanceMethods def self.included(klass) klass.prepend TrackTimeMethods super end def initialize(*) meter_elapsed_time("Session: initializing...") super meter_elapsed_time("Session: initialized!!!") + resolver_type = @options.resolver_class + resolver_type = Resolver.resolver_for(resolver_type) + return unless resolver_type <= Resolver::Native + + resolver_type.prepend TrackTimeMethods + resolver_type.prepend NativeResolverMethods + @options = @options.merge(resolver_class: resolver_type) end def close(*) super meter_elapsed_time("Session -> close")