added a new admin endpoint - /logs to fetch log files - #491
Conversation
9bed433 to
74ba272
Compare
74ba272 to
c161002
Compare
…ed bugfix - Implement `GET /logs?type=<mlog|qlog>&connection_id=<hex>` route. - Offload blocking file I/O (`std::ifstream::read`) to `folly::getGlobalCPUExecutor()` to avoid stalling the admin event loop. - Bugfix: create log dir if not exists
c161002 to
02c1462
Compare
afrind
left a comment
There was a problem hiding this comment.
@afrind reviewed 8 files and all commit messages, and made 6 comments.
Reviewable status: all files reviewed, 6 unresolved discussions (waiting on akash-a-n).
src/admin/ConnectionLogsHandler.cpp line 54 at r1 (raw file):
// Read an entire file into an IOBuf. Returns nullptr if the file cannot be // opened, is empty, or exceeds maxBytes. std::unique_ptr<folly::IOBuf> readFileToIOBuf(const std::string& path, size_t maxBytes) {
There's probably a folly helper
src/admin/ConnectionLogsHandler.cpp line 70 at r1 (raw file):
} folly::coro::Task<std::unique_ptr<folly::IOBuf>> readFileTask(std::string path, size_t maxBytes) {
Is co_invoke a different way to wrap a sync task as a coro on another exec?
src/admin/ConnectionLogsHandler.cpp line 125 at r1 (raw file):
.status(503, proxygen::HTTPMessage::getDefaultReason(503)) .header("Content-Type", "application/json") .body(folly::IOBuf::copyBuffer("{\"error\":\"that log type is not configured\"}\n"))
Or maybe there just haven't been any connections yet?
src/admin/ConnectionLogsHandler.cpp line 175 at r1 (raw file):
if (!token.isCancellationRequested()) { proxygen::ResponseBuilder(ds) .status(500, proxygen::HTTPMessage::getDefaultReason(500))
I wonder if we want a generic utility in a common header like sendErrorResponse(code, body)
Also I see you are using json bodies -- do we do that elsewhere?
test/CMakeLists.txt line 6 at r1 (raw file):
# Increase the timeout for gtest_discover_tests to prevent flaky build failures # when linking heavy executables under load. set(CMAKE_TEST_DISCOVERY_TIMEOUT 60)
Why does test discovery do linking and why does it take 60s? What is the current timeout?
test/CMakeLists.txt line 53 at r1 (raw file):
moqx_test_main ) gtest_discover_tests(moqx_relay_test DISCOVERY_TIMEOUT 120)
This seems quite hefty.
|
Also, needs update and test failures |
GET /logs?type=<mlog|qlog>&connection_id=<hex>route.std::ifstream::read) tofolly::getGlobalCPUExecutor()to avoid stalling the admin event loop.This change is