| 534 | } |
| 535 | |
| 536 | void 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 | |
| 549 | void emit_metrics_for_insufficient_replicas(struct RedisModuleCtx *ctx, long long keys) { |
| 550 | // non-empty |
no test coverage detected