redict/tests/modules
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.c Fixed some documentation 2019-12-17 07:49:21 +00:00
blockedclient.c Handle output buffer limits for Module blocked clients (#8141) 2020-12-08 16:41:20 +02:00
blockonbackground.c 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.c Fix recent test failures (#8386) 2021-01-23 21:53:58 +02:00
commandfilter.c Make module tests pass with valgrind, and fix a leak in diskless load 2019-10-24 09:45:25 +03:00
datatype.c Add module data-type support for COPY. (#8112) 2020-12-09 20:22:45 +02:00
defragtest.c Modules: add defrag API support. (#8149) 2020-12-13 09:56:01 +02:00
fork.c Moved RMAPI_FUNC_SUPPORTED location such that it will be visible to modules (#8037) 2020-11-09 10:46:23 +02:00
getkeys.c Modules: fix RM_GetCommandKeys API. (#7901) 2020-10-11 18:10:55 +03:00
hooks.c Add Module API for version and compatibility checks (#7865) 2020-10-11 17:21:58 +03:00
infotest.c Add RM_ServerInfoGetFieldUnsigned 2019-11-04 08:50:29 +02:00
keyspace_events.c Make sure we do not propagate nested MULTI/EXEC (#8097) 2020-12-06 13:14:18 +02:00
Makefile Enabled background and reply time tracking on blocked on keys/blocked on background work clients (#7491) 2021-01-29 15:38:30 +02:00
misc.c Add Module API for version and compatibility checks (#7865) 2020-10-11 17:21:58 +03:00
propagate.c 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.c Fix RM_ScanKey module api not to return int encoded strings 2020-06-14 11:20:15 +03:00
stream.c Add modules API for streams (#8288) 2021-01-28 16:19:43 +02:00
test_lazyfree.c Modules callbacks for lazy free effort, and unlink (#7912) 2020-11-16 10:34:04 +02:00
testrdb.c Add module event for repl-diskless-load swapdb (#8153) 2020-12-13 14:36:06 +02:00
timer.c Add timer module API tests. (#8041) 2020-11-11 22:57:33 +02:00