Sha256: e74f4d159e3e21b9864f1fb9037306a4844426d81a4d1e9b454dd1d335c9c51f

Contents?: true

Size: 808 Bytes

Versions: 6

Compression:

Stored size: 808 Bytes

Contents

module Excon
  module Middleware
    class Instrumentor < Excon::Middleware::Base
      def request_call(datum)
        if datum.has_key?(:instrumentor)
          if datum[:retries_remaining] < datum[:retry_limit]
            event_name = "#{datum[:instrumentor_name]}.retry"
          else
            event_name = "#{datum[:instrumentor_name]}.request"
          end
          datum[:instrumentor].instrument(event_name, datum) do
            @stack.request_call(datum)
          end
        else
          @stack.request_call(datum)
        end
      end

      def response_call(datum)
        if datum.has_key?(:instrumentor)
          datum[:instrumentor].instrument("#{datum[:instrumentor_name]}.response", datum[:response])
        end
        @stack.response_call(datum)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
excon-0.18.5 lib/excon/middlewares/instrumentor.rb
excon-0.18.4 lib/excon/middlewares/instrumentor.rb
excon-0.18.3 lib/excon/middlewares/instrumentor.rb
excon-0.18.2 lib/excon/middlewares/instrumentor.rb
excon-0.18.1 lib/excon/middlewares/instrumentor.rb
excon-0.18.0 lib/excon/middlewares/instrumentor.rb