Search code examples
javaredislettuce

Redis Lettuce Client Command Latency Event Wasn't Retrieved in the subscriber


Command latency event wasn't retrieved in the subscriber

The code implementation of command latency monitoring using Letuce Redis client in Spring Boot MVC app didn't collecting any command latency event, only connection event recorded. Here's the log captured after the API that issue Redis command invoked,

Log Captured
2023-10-15T15:43:06.116+07:00 INFO 30580 --- [xecutorLoop-3-2] c.m.redis.controller.Controller    : Log Event: ConnectedEvent [/<host>:<port> -> /<host>:<port>]
2023-10-15T15:43:06.167+07:00 INFO 30580 --- [xecutorLoop-3-3] c.m.redis.controller.Controller    : Log Event: ConnectionActivatedEvent [/<host>:<port> -> /<host>:<port>]
2023-10-15T15:43:06.303+07:00 INFO 30580 --- [xecutorLoop-3-4] c.m.redis.controller.Controller    : Log Event: ConnectedEvent [/<host>:<port> -> /<host>:<port>]
2023-10-15T15:43:06.377+07:00 INFO 30580 --- [xecutorLoop-3-5] c.m.redis.controller.Controller    : Log Event: ConnectionActivatedEvent [/<host>:<port> -> /<host>:<port>]

Input Code

Input Code

https://gist.github.com/varvay/a3caa2104709a2d7dfe868a682469d6f

Expected behavior/code

The command latency event captured in the log

Environment

  • Lettuce version(s): 6.2.6.RELEASE
  • Redis version: 6.2.10

Possible Solution

N/A

Additional context

N/A

GitHub Ticket

GitHub Ticket

https://github.com/lettuce-io/lettuce-core/issues/2523


Solution

  • Based on my exploration also supported by response in the GitHub Ticket, Micrometer won't emit latency event to Lettuce event bus. As workaround, I use Lettuce DefaultCommandLatencyCollector instead of MicrometerCommandLatencyRecorder