Sha256: 33a3d4f5e12ab10015d44470f448fce9b6a7cfa4e098fb951ba1d0d563d02da6

Contents?: true

Size: 1.01 KB

Versions: 72

Compression:

Stored size: 1.01 KB

Contents

module Excon
  module Middleware
    class Instrumentor < Excon::Middleware::Base
      def error_call(datum)
        if datum.has_key?(:instrumentor)
          datum[:instrumentor].instrument("#{datum[:instrumentor_name]}.error", :error => datum[:error])
        end
        @stack.error_call(datum)
      end

      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

72 entries across 72 versions & 5 rubygems

Version Path
able-neo4j-1.0.0 vendor/bundle/jruby/1.9/gems/excon-0.45.4/lib/excon/middlewares/instrumentor.rb
excon-0.46.0 lib/excon/middlewares/instrumentor.rb
framed_rails-0.2.0 vendor/gems/excon-0.45.3/lib/excon/middlewares/instrumentor.rb
framed_rails-0.1.7 vendor/gems/excon-0.45.3/lib/excon/middlewares/instrumentor.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/excon-0.45.4/lib/excon/middlewares/instrumentor.rb
framed_rails-0.1.5 vendor/gems/excon-0.45.3/lib/excon/middlewares/instrumentor.rb
framed_rails-0.1.4 vendor/gems/excon-0.45.3/lib/excon/middlewares/instrumentor.rb
framed_rails-0.1.3 vendor/gems/excon-0.45.3/lib/excon/middlewares/instrumentor.rb
framed_rails-0.1.2 vendor/gems/excon-0.45.3/lib/excon/middlewares/instrumentor.rb
framed_rails-0.1.0 vendor/gems/excon-0.45.3/lib/excon/middlewares/instrumentor.rb
excon-0.45.4 lib/excon/middlewares/instrumentor.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/excon-0.45.3/lib/excon/middlewares/instrumentor.rb
excon-0.45.3 lib/excon/middlewares/instrumentor.rb
excon-0.45.2 lib/excon/middlewares/instrumentor.rb
excon-0.45.1 lib/excon/middlewares/instrumentor.rb
excon-0.45.0 lib/excon/middlewares/instrumentor.rb
excon-0.44.4 lib/excon/middlewares/instrumentor.rb
excon-0.44.3 lib/excon/middlewares/instrumentor.rb
excon-0.44.2 lib/excon/middlewares/instrumentor.rb
excon-0.44.1 lib/excon/middlewares/instrumentor.rb