MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / emit_system_free_memory

Function emit_system_free_memory

src/modules/keydb_modstatsd/modmain.cpp:536–547  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

534}
535
536void emit_system_free_memory() {
537 std::ifstream meminfo("/proc/meminfo");
538 std::string line;
539 while (std::getline(meminfo, line)) {
540 if (line.find("MemAvailable:") != std::string::npos) {
541 unsigned long memAvailableInKB;
542 std::sscanf(line.c_str(), "MemAvailable: %lu kB", &memAvailableInKB);
543 g_stats->gauge("systemAvailableMemory_MB", memAvailableInKB / 1024);
544 return;
545 }
546 }
547}
548
549void emit_metrics_for_insufficient_replicas(struct RedisModuleCtx *ctx, long long keys) {
550 // non-empty

Callers 1

event_cron_handlerFunction · 0.85

Calls 2

findMethod · 0.45
gaugeMethod · 0.45

Tested by

no test coverage detected