lib/skylight/probes/excon.rb in skylight-0.3.12 vs lib/skylight/probes/excon.rb in skylight-0.3.13
- old
+ new
@@ -1,16 +1,21 @@
module Skylight
module Probes
module Excon
class Probe
def install
- # Don't require until installation since it depends on Excon being loaded
- require 'skylight/probes/excon/middleware'
+ if defined?(::Excon::Middleware)
+ # Don't require until installation since it depends on Excon being loaded
+ require 'skylight/probes/excon/middleware'
- idx = ::Excon.defaults[:middlewares].index(::Excon::Middleware::Instrumentor)
+ idx = ::Excon.defaults[:middlewares].index(::Excon::Middleware::Instrumentor)
- # TODO: Handle possibility of idx being nil
- ::Excon.defaults[:middlewares].insert(idx, Skylight::Probes::Excon::Middleware)
+ # TODO: Handle possibility of idx being nil
+ ::Excon.defaults[:middlewares].insert(idx, Skylight::Probes::Excon::Middleware)
+ else
+ puts "[SKYLIGHT] [#{Skylight::VERSION}] The installed version of Excon doesn't " \
+ "support Middlewares. The Excon probe will be disabled."
+ end
end
end
end
register("Excon", "excon", Excon::Probe.new)
\ No newline at end of file