MCPcopy Create free account
hub / github.com/Restream/reindexer / Check

Method Check

cpp_src/server/httpserver.cc:973–1050  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

971}
972
973int HTTPServer::Check(http::Context& ctx) {
974 auto ser = makeRestrictedWrSerializer(ctx);
975 {
976 JsonBuilder builder(ser);
977 builder.Put("version", REINDEX_VERSION);
978
979 size_t startTs = std::chrono::duration_cast<std::chrono::seconds>(startTs_.time_since_epoch()).count();
980 size_t uptime = std::chrono::duration_cast<std::chrono::seconds>(system_clock_w::now() - startTs_).count();
981 builder.Put("start_time", startTs);
982 builder.Put("uptime", uptime);
983 builder.Put("rpc_address", serverConfig_.RPCAddr);
984 builder.Put("rpcs_address", serverConfig_.RPCsAddr);
985 builder.Put("http_address", serverConfig_.HTTPAddr);
986 builder.Put("https_address", serverConfig_.HTTPsAddr);
987 builder.Put("urpc_address", serverConfig_.RPCUnixAddr);
988 builder.Put("storage_path", serverConfig_.StoragePath);
989 builder.Put("rpc_log", serverConfig_.RpcLog);
990 builder.Put("http_log", serverConfig_.HttpLog);
991 builder.Put("log_level", serverConfig_.LogLevel);
992 builder.Put("core_log", serverConfig_.CoreLog);
993 builder.Put("server_log", serverConfig_.ServerLog);
994 {
995 auto heapWatcher = builder.Object("heap_watcher");
996 if (serverConfig_.AllocatorCacheLimit >= 0) {
997 heapWatcher.Put("cache_limit_bytes", serverConfig_.AllocatorCacheLimit);
998 } else {
999 heapWatcher.Put("cache_limit_bytes", "disabled");
1000 }
1001 std::string allocatorCachePartStr;
1002 if (serverConfig_.AllocatorCachePart >= 0) {
1003 allocatorCachePartStr = std::to_string(int(serverConfig_.AllocatorCachePart * 100));
1004 allocatorCachePartStr += '%';
1005 } else {
1006 allocatorCachePartStr = "disabled";
1007 }
1008 heapWatcher.Put("cache_limit_part", allocatorCachePartStr);
1009 }
1010
1011#if REINDEX_WITH_JEMALLOC
1012 if (alloc_ext::JEMallocIsAvailable()) {
1013 size_t val = 0, val1 = 1, sz = sizeof(size_t);
1014
1015 uint64_t epoch = 1;
1016 sz = sizeof(epoch);
1017 std::ignore = alloc_ext::mallctl("epoch", &epoch, &sz, &epoch, sz);
1018
1019 std::ignore = alloc_ext::mallctl("stats.resident", &val, &sz, NULL, 0);
1020 builder.Put("heap_size", val);
1021
1022 std::ignore = alloc_ext::mallctl("stats.allocated", &val, &sz, NULL, 0);
1023 builder.Put("current_allocated_bytes", val);
1024
1025 std::ignore = alloc_ext::mallctl("stats.active", &val1, &sz, NULL, 0);
1026 builder.Put("pageheap_free", val1 - val);
1027
1028 std::ignore = alloc_ext::mallctl("stats.retained", &val, &sz, NULL, 0);
1029 builder.Put("pageheap_unmapped", val);
1030 }

Callers 8

TestInsertFunction · 0.45
TestIteratorsFunction · 0.45
TestSearchFunction · 0.45
TestDeleteFunction · 0.45
TestEraseFunction · 0.45
TestMapFunction · 0.45
TESTFunction · 0.45
authorizedMethod · 0.45

Calls 9

JEMallocIsAvailableFunction · 0.85
mallctlFunction · 0.85
TCMallocIsAvailableFunction · 0.85
instanceFunction · 0.85
PutMethod · 0.45
countMethod · 0.45
ObjectMethod · 0.45
JSONMethod · 0.45
DetachChunkMethod · 0.45

Tested by 7

TestInsertFunction · 0.36
TestIteratorsFunction · 0.36
TestSearchFunction · 0.36
TestDeleteFunction · 0.36
TestEraseFunction · 0.36
TestMapFunction · 0.36
TESTFunction · 0.36