Merge pull request #6498 from oranagra/rm_latency_add_sample

Module API for LatencyAddSample
This commit is contained in:
Salvatore Sanfilippo
2019-10-28 09:59:26 +01:00
committed by GitHub
4 changed files with 13 additions and 2 deletions

View File

@ -3933,6 +3933,14 @@ void RM__Assert(const char *estr, const char *file, int line) {
_serverAssert(estr, file, line);
}
/* Allows adding event to the latency monitor to be observed by the LATENCY
* command. The call is skipped if the latency is smaller than the configured
* latency-monitor-threshold. */
void RM_LatencyAddSample(const char *event, mstime_t latency) {
if (latency >= server.latency_monitor_threshold)
latencyAddSample(event, latency);
}
/* --------------------------------------------------------------------------
* Blocking clients from modules
* -------------------------------------------------------------------------- */
@ -6457,6 +6465,7 @@ void moduleRegisterCoreAPI(void) {
REGISTER_API(Log);
REGISTER_API(LogIOError);
REGISTER_API(_Assert);
REGISTER_API(LatencyAddSample);
REGISTER_API(StringAppendBuffer);
REGISTER_API(RetainString);
REGISTER_API(StringCompare);