Skip to content

Added KVIKIO_REMOTE_VERBOSE option - #815

Merged
rapids-bot[bot] merged 8 commits into
rapidsai:branch-25.10from
TomAugspurger:tom/kvikio-http-verbose
Sep 10, 2025
Merged

rapids-bot[bot] merged 8 commits into
rapidsai:branch-25.10from
TomAugspurger:tom/kvikio-http-verbose

Conversation

@TomAugspurger

@TomAugspurger TomAugspurger commented Sep 9, 2025 •

Copy link
Copy Markdown
Contributor

Our HTTP library, libcurl, includes a CURLOPT_VERBOSE setting that can be useful for debugging. To help our users debug things, I've added a new KVIKIO_REMOTE_VERBOSE option that configures this. By default, it's off (no change). If the user sets KVIKIO_REMOTE_VERBOSE=1 then information from the HTTP requests and responses will be printed to stderr.

@copy-pr-bot

copy-pr-bot Bot commented Sep 9, 2025

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@TomAugspurger

Copy link
Copy Markdown
Contributor Author

/ok to test 15d8939

@TomAugspurger TomAugspurger added improvement Improves an existing functionality non-breaking Introduces a non-breaking change labels Sep 9, 2025
@TomAugspurger

Copy link
Copy Markdown
Contributor Author

/ok to test 6c1d338

@TomAugspurger
TomAugspurger marked this pull request as ready for review September 10, 2025 13:58
@TomAugspurger
TomAugspurger requested review from a team as code owners September 10, 2025 13:58
@TomAugspurger

TomAugspurger commented Sep 10, 2025 •

Copy link
Copy Markdown
Contributor Author

Ok, this should be ready for review.

Maybe the biggest thing to determine: what name should we use? I've gone with KVIKIO_HTTP_VERBOSE, to align with our other curl-related options (KVIKIO_HTTP_MAX_ATTEMPTS, KVIKIO_HTTP_STATUS_CODES, and KVIKIO_HTTP_TIMEOUT).

Alternatively, we could call this something like KVIKIO_REMOTE_VERBOSE, since libcurl does support non-HTTP-based protocols (even if we don't use them yet). I don't have a preference.

Comment thread cpp/src/shim/libcurl.cpp Outdated
setopt(CURLOPT_TIMEOUT, kvikio::defaults::http_timeout());

// Enable verbose output if configured in defaults
if (kvikio::defaults::http_verbose()) { setopt(CURLOPT_VERBOSE, 1L); }

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.

So the purpose of having the http_verbose parameter in the defaults class would be to allow runtime parameter change. Because of how CURL handles are managed in KvikIO, the change will only be applied to newly generated handles, unless we also explicitly reconfigure existing handles. I'm wondering if we really need that. Perhaps we could simply use:

CurlHandle::CurlHandle(...) {
...
    auto const verbose = getenv_or("KVIKIO_HTTP_VERBOSE", false);
    if(verbose) {
        setopt(CURLOPT_VERBOSE, 1L);
    }
...
}

PS: The CURL handles in KvikIO are reused to minimize handle creation overhead. When an object of CurlHandle goes out of scope, it is not cleaned up, but instead handed back to a global singleton LibCurl which tracks a vector of free CURL handles eligible for reuse. So if we want to apply any runtime parameter change to CURL handles, we need to iterate all the free handles in LibCurl.

Comment thread docs/source/runtime_settings.rst Outdated

This setting can also be accessed using :py:func:`kvikio.defaults.http_verbose` (getter) and :py:func:`kvikio.defaults.set` (setter).

**Warning** this may show sensitive contents from headers and data.

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.

Suggested change
**Warning** this may show sensitive contents from headers and data.
.. warning::
This may show sensitive contents from headers and data.

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.

Sample output:

Image

@TomAugspurger

TomAugspurger commented Sep 10, 2025 •

Copy link
Copy Markdown
Contributor Author

Good to know that the handles are reused. I've updated it with the simpler implementation.

You can observe the output with

KVIKIO_REMOTE_VERBOSE=1 pytest -vs python/kvikio/tests/test_http_io.py::test_file_size

@TomAugspurger TomAugspurger changed the title Added KVIKIO_HTTP_VERBOSE option Added KVIKIO_REMOTE_VERBOSE option Sep 10, 2025

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

Thanks for the PR!
Only the doc needs a minor update.

Comment thread cpp/doxygen/main_page.md Outdated
#### HTTP Verbose (KVIKIO_HTTP_VERBOSE)
For debugging HTTP requests, you can enable verbose output that shows detailed information about HTTP communication including headers, request/response bodies, connection details, and SSL handshake information.

Set the environment variable `KVIKIO_HTTP_VERBOSE` to `true`, `on`, or `yes` (case-insensitive) to enable verbose output. Otherwise, verbose output is disabled by default.

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.

Update suggested: KVIKIO_REMOTE_VERBOSE

@TomAugspurger

Copy link
Copy Markdown
Contributor Author

/merge

Comment thread docs/source/runtime_settings.rst Outdated
Co-authored-by: Matthew Murray <41342305+Matt711@users.noreply.github.com>
Comment thread cpp/doxygen/main_page.md Outdated
#### Remote Verbose (KVIKIO_REMOTE_VERBOSE)
For debugging HTTP requests, you can enable verbose output that shows detailed information about HTTP communication including headers, request/response bodies, connection details, and SSL handshake information.

Set the environment variable `KVIKIO_REMOTE_VERBOSE` to `true`, `on`, or `yes` (case-insensitive) to enable verbose output. Otherwise, verbose output is disabled by default.

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.

How about 1? That is my favorite way to enable things.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yep, based on

// Try parsing `env_var_name` as a integer
return static_cast<bool>(std::stoi(env_val));
.

Updated the docs to note that.

@rapids-bot
rapids-bot Bot merged commit c87a022 into rapidsai:branch-25.10 Sep 10, 2025
77 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Improves an existing functionality non-breaking Introduces a non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants