LATENCY HISTORY

Since 1.1.0Observability

Syntax

LATENCY HISTORY event

Returns the samples the latency monitor has recorded for one event, oldest first: for each, the Unix time in seconds and how many milliseconds it took. Use it to see when an event was slow and whether it is getting worse; LATENCY LATEST gives only each event's last sample, and LATENCY GRAPH draws the same samples as a chart.

event is one of the monitor's event names, such as command, fast-command or expire-cycle (see LATENCY). Names are lower case and matched exactly: COMMAND is not command. An event with no samples, or a name that is no event's, gives an empty array.

Samples are recorded only while latency-monitor-threshold is above 0 (its default, 0, turns the monitor off), for what took at least that many milliseconds. Each event keeps its last 160 samples, one a second, the highest of that second, as in Redis, since 1.2.1. 1.2.0 kept 180, every sample, even two in the same second. LATENCY RESET clears them.

Reply

An array of [time, milliseconds] pairs; an empty array if there are none.

Examples

> CONFIG SET latency-monitor-threshold 100
OK
> DEBUG SLEEP 0.25
OK
> DEBUG SLEEP 0.15
OK
> LATENCY HISTORY command
1) 1) (integer) 1794254263
   2) (integer) 250
2) 1) (integer) 1794254263
   2) (integer) 150
> LATENCY HISTORY expire-cycle
(empty array)
> LATENCY HISTORY
(error) ERR wrong number of arguments for 'latency|history' command