Module: NetworkResiliency::Adapter::Redis::Instrumentation

Defined in:
lib/network_resiliency/adapter/redis.rb

Instance Method Summary collapse

Instance Method Details

#call(command) ⇒ Object



130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# File 'lib/network_resiliency/adapter/redis.rb', line 130

def call(command)
  return super unless NetworkResiliency.enabled?(:redis)
  return super unless command.is_a?(Array)

  command_key = command.first.to_s

  # larger commands may have larger timeouts
  command_size = command.size.order_of_magnitude
  destination = [
    host,
    command_key,
    (command_size if command_size > 1),
  ].compact.join(":")

  idempotent = idempotent?(command_key)

  with_resilience(:request, destination, idempotent) { super }
end

#establish_connectionObject



124
125
126
127
128
# File 'lib/network_resiliency/adapter/redis.rb', line 124

def establish_connection
  return super unless NetworkResiliency.enabled?(:redis)

  with_resilience(:connect, host, true) { super }
end