Module: Minitest::Distributed::Coordinators::RedisInstrumentationMiddleware

Extended by:
T::Sig
Defined in:
lib/minitest/distributed/coordinators/redis_instrumentation_middleware.rb

Overview

Redis middleware that logs all Redis commands to a file for debugging.

Instance Method Summary collapse

Instance Method Details

#call(command, redis_config) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/minitest/distributed/coordinators/redis_instrumentation_middleware.rb', line 14

def call(command, redis_config)
  log_file = redis_config.custom[:log_file]
  log_file.info("EXEC: #{command.inspect}")
  result = super
  log_file.info("RESULT: #{result.inspect}")
  result
rescue => e
  log_file.info("ERROR: #{e.class}")
  Kernel.raise
end

#call_pipelined(commands, redis_config) ⇒ Object



26
27
28
29
30
31
32
33
34
35
# File 'lib/minitest/distributed/coordinators/redis_instrumentation_middleware.rb', line 26

def call_pipelined(commands, redis_config)
  log_file = redis_config.custom[:log_file]
  log_file.info("EXEC PIPELINED: #{commands.inspect}")
  result = super
  log_file.info("RESULT PIPELINED: #{result.inspect}")
  result
rescue => e
  log_file.info("ERROR PIPELINED: #{e.class}")
  Kernel.raise
end