Skip to content

Commit

Permalink
have emit system free memory within metrics_time_taken_us and also ad…
Browse files Browse the repository at this point in the history
…d metric time taken for it
  • Loading branch information
zliang-sc committed Aug 18, 2023
1 parent 6fa696b commit eb14f42
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/modules/keydb_modstatsd/modmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -614,15 +614,17 @@ void event_cron_handler(struct RedisModuleCtx *ctx, RedisModuleEvent eid, uint64
// g_stats->timing("handle_client_info_time_taken_us", ustime() - commandStartTime);
// RedisModule_FreeCallReply(reply);

commandStartTime = ustime();
emit_system_free_memory();
g_stats->timing("emit_free_system_memory_time_taken_us", ustime() - commandStartTime);

/* Log Keys */
reply = RedisModule_Call(ctx, "dbsize", "");
long long keys = RedisModule_CallReplyInteger(reply);
RedisModule_FreeCallReply(reply);
g_stats->gauge("keys", keys);
RedisModule_Log(ctx, REDISMODULE_LOGLEVEL_DEBUG, "Emitting metric \"keys\": %llu", keys);
g_stats->timing("metrics_time_taken_us", ustime() - startTime);

emit_system_free_memory();

lastTime = curTime;
}
Expand Down

0 comments on commit eb14f42

Please sign in to comment.