jedis
jedis copied to clipboard
Adding support for custom JedisProtocol
Supplying a custom JedisProtocol makes it possible to implement custom logging or monitoring or the execution of redis commands. For example, the following JedisProtocol
customization would catch and log all commands sent to the redis server:
class LoggingJedisProtocol extends JedisProtocol {
private static final Logger log = LoggerFactory.getLogger(LoggingJedisProtocol.class);
@Override
public void sendCommand(final RedisOutputStream os, final ProtocolCommand command, final byte[]... args) {
log.trace(command.toString() + "(" + Arrays.stream(args)
.map(a -> new String(a))
.collect(Collectors.joining(", ")) + ")");
super.sendCommand(os, command, args);
}
}
Refer to https://github.com/redis/jedis/discussions/2635 for general discussion around this pull request
Test failure seems random - it was from timing in ControlCommandsTest.clientPause(ControlCommandsTest.java:262)
on
assertTrue(pauseMillis <= latencyMillis1 && latencyMillis1 <= pauseMillis + pauseMillisDelta);
Is there a way to can rerun the test?
@gaspardpetit Please merge/rebase your branch.
Rebased - please let me know if I did this right
@gaspardpetit It's okay. (Could be easier though :))
Hello, I was wondering if there was anything I could do to move this pull request forward? If the approach is not the right one, or you have concerns you would like me to address, please let me know.
I was directed from https://github.com/redis/jedis/discussions/2635, sorry for the late reply..., I think this idea is good, would you like to continue? @gaspardpetit