Module: NetworkResiliency::Adapter::Redis::Instrumentation
- Defined in:
- lib/network_resiliency/adapter/redis.rb
Instance Method Summary collapse
Instance Method Details
#establish_connection ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/network_resiliency/adapter/redis.rb', line 46 def establish_connection return super unless NetworkResiliency.enabled?(:redis) begin ts = -NetworkResiliency. super rescue ::Redis::CannotConnectError => e # capture error raise ensure ts += NetworkResiliency. # grab underlying exception within Redis wrapper error = e ? e.cause.class : nil NetworkResiliency.record( adapter: "redis", action: "connect", destination: host, error: error, duration: ts, ) end end |