redict/tests/unit/moduleapi
filipe oliveira f0c5052aa8
Enabled background and reply time tracking on blocked on keys/blocked on background work clients (#7491)
This commit enables tracking time of the background tasks and on replies,
opening the door for properly tracking commands that rely on blocking / background
 work via the slowlog, latency history, and commandstats. 

Some notes:
- The time spent blocked waiting for key changes, or blocked on synchronous
  replication is not accounted for. 

- **This commit does not affect latency tracking of commands that are non-blocking
  or do not have background work.** ( meaning that it all stays the same with exception to
  `BZPOPMIN`,`BZPOPMAX`,`BRPOP`,`BLPOP`, etc... and module's commands that rely
  on background threads ). 

-  Specifically for latency history command we've added a new event class named
  `command-unblocking` that will enable latency monitoring on commands that spawn
  background threads to do the work.

- For blocking commands we're now considering the total time of a command as the
  time spent on call() + the time spent on replying when unblocked.

- For Modules commands that rely on background threads we're now considering the
  total time of a command as the time spent on call (main thread) + the time spent on
  the background thread ( if marked within `RedisModule_MeasureTimeStart()` and
  `RedisModule_MeasureTimeEnd()` ) + the time spent on replying (main thread)

To test for this feature we've added a `unit/moduleapi/blockonbackground` test that relies on
a module that blocks the client and sleeps on the background for a given time. 
- check blocked command that uses RedisModule_MeasureTimeStart() is tracking background time
- check blocked command that uses RedisModule_MeasureTimeStart() is tracking background time even in timeout
- check blocked command with multiple calls RedisModule_MeasureTimeStart()  is tracking the total background time
- check blocked command without calling RedisModule_MeasureTimeStart() is not reporting background time
2021-01-29 15:38:30 +02:00
..
auth.tcl Add module APIs for custom authentication 2019-12-17 06:59:59 +00:00
blockedclient.tcl Handle output buffer limits for Module blocked clients (#8141) 2020-12-08 16:41:20 +02:00
blockonbackground.tcl Enabled background and reply time tracking on blocked on keys/blocked on background work clients (#7491) 2021-01-29 15:38:30 +02:00
blockonkeys.tcl Test that module can wake up module blocked on non-empty list key (#8382) 2021-01-22 16:19:37 +02:00
commandfilter.tcl Add runtest-moduleapi with commandfilter coverage. 2019-03-24 12:03:03 +02:00
datatype.tcl Add module data-type support for COPY. (#8112) 2020-12-09 20:22:45 +02:00
defrag.tcl Tests: fix new defrag test to be skipped when not supported (#8185) 2020-12-14 11:13:46 +02:00
fork.tcl fix race in module api test for fork 2020-02-23 16:48:37 +02:00
getkeys.tcl Modules: add RM_GetCommandKeys(). 2020-10-11 16:04:14 +03:00
hooks.tcl Add Swapdb Module Event (#7804) 2020-09-20 13:36:20 +03:00
infotest.tcl Add RM_ServerInfoGetFieldUnsigned 2019-11-04 08:50:29 +02:00
keyspace_events.tcl Make sure we do not propagate nested MULTI/EXEC (#8097) 2020-12-06 13:14:18 +02:00
misc.tcl Add Module API for version and compatibility checks (#7865) 2020-10-11 17:21:58 +03:00
propagate.tcl Remove read-only flag from non-keyspace cmds, different approach for EXEC to propagate MULTI (#8216) 2020-12-22 12:03:49 +02:00
scan.tcl Fix RM_ScanKey module api not to return int encoded strings 2020-06-14 11:20:15 +03:00
stream.tcl Add modules API for streams (#8288) 2021-01-28 16:19:43 +02:00
test_lazyfree.tcl Modules callbacks for lazy free effort, and unlink (#7912) 2020-11-16 10:34:04 +02:00
testrdb.tcl test infra - reduce disk space usage 2020-09-06 09:59:19 +03:00
timer.tcl Add timer module API tests. (#8041) 2020-11-11 22:57:33 +02:00