Skip to content

Commit

Permalink
Log before and after commands are issued
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisBr committed Sep 16, 2024
1 parent f19558b commit 8d46bde
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions ruby/lib/ci/queue/redis/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,18 @@ class Base

module RedisInstrumentation
def call(command, redis_config)
result = super
logger = redis_config.custom[:debug_log]
logger.info("#{command}: #{result}")
logger.info("Running '#{command}'")
result = super
logger.info("Finished '#{command}': #{result}")
result
end

def call_pipelined(commands, redis_config)
result = super
logger = redis_config.custom[:debug_log]
logger.info("#{commands}: #{result}")
logger.info("Running '#{commands}'")
result = super
logger.info("Finished '#{commands}': #{result}")
result
end
end
Expand Down
2 changes: 1 addition & 1 deletion ruby/test/integration/minitest_redis_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def test_debug_log
)
end

assert_includes File.read(log_file.path), 'INFO -- : ["exists", "build:1:worker:1:queue"]: 0'
assert_includes File.read(log_file.path), 'INFO -- : Finished \'["exists", "build:1:worker:1:queue"]\': 0'
assert_empty err
result = normalize(out.lines.last.strip)
assert_equal '--- Ran 11 tests, 8 assertions, 2 failures, 1 errors, 1 skips, 4 requeues in X.XXs', result
Expand Down

0 comments on commit 8d46bde

Please sign in to comment.