Skip to content

added a new admin endpoint - /logs to fetch log files - #491

Open
akash-a-n wants to merge 1 commit into
mainfrom
qlogs/admin-endpoint
Open

added a new admin endpoint - /logs to fetch log files#491
akash-a-n wants to merge 1 commit into
mainfrom
qlogs/admin-endpoint

Conversation

@akash-a-n

@akash-a-n akash-a-n commented Jul 8, 2026

Copy link
Copy Markdown
Contributor
  • 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.

This change is Reviewable

@akash-a-n
akash-a-n force-pushed the qlogs/admin-endpoint branch from 9bed433 to 74ba272 Compare July 9, 2026 06:47
@akash-a-n
akash-a-n force-pushed the qlogs/admin-endpoint branch from 74ba272 to c161002 Compare July 22, 2026 14:26
…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
@akash-a-n
akash-a-n force-pushed the qlogs/admin-endpoint branch from c161002 to 02c1462 Compare July 22, 2026 15:12

@afrind afrind left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.

@afrind

afrind commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Also, needs update and test failures

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants