From a03fdef87be19b3fb6be76d881ae3ad81898e191 Mon Sep 17 00:00:00 2001 From: Chad Reynolds Date: Mon, 4 May 2026 15:10:56 -0700 Subject: [PATCH 1/2] Tidy up cURL error messages by adding them to log During the GCE environment detection logic, the HTTP request to make the detection would print out error lines if GCE was not detected. This update makes all of the cURL outputs go into the logs, instead. It makes the V2 `metrics/metrics.log` a bit noisier, but that is better than cluttering up the command-line output with the messges. Bug: 508689956 --- base/cvd/cuttlefish/host/libs/metrics/gce_environment.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/base/cvd/cuttlefish/host/libs/metrics/gce_environment.cc b/base/cvd/cuttlefish/host/libs/metrics/gce_environment.cc index 8a28c89d2a9..9d590e6b0fb 100644 --- a/base/cvd/cuttlefish/host/libs/metrics/gce_environment.cc +++ b/base/cvd/cuttlefish/host/libs/metrics/gce_environment.cc @@ -86,7 +86,9 @@ Result GetZoneValue(std::string_view response_string) { Result> DetectGceEnvironment() { CurlGlobalInit curl_init; - std::unique_ptr http_client = CurlHttpClient(); + const bool use_logging_debug_function = true; + std::unique_ptr http_client = + CurlHttpClient(use_logging_debug_function); if (!CF_EXPECT(IsGceEnvironment(*http_client))) { return std::nullopt; } From 4a2fddc9b13d1883f32ffa673d646d11ca98117d Mon Sep 17 00:00:00 2001 From: Chad Reynolds Date: Mon, 4 May 2026 16:06:48 -0700 Subject: [PATCH 2/2] Update constant usage for bools to comments And add a `clang-tidy` check to verify the comments match the parameter names. --- base/cvd/.clang-tidy | 1 + base/cvd/cuttlefish/host/commands/cvd/cli/commands/login.cpp | 3 ++- base/cvd/cuttlefish/host/commands/cvd/fetch/downloaders.cc | 3 +-- .../cuttlefish/host/commands/metrics/metrics_transmission.cc | 3 +-- base/cvd/cuttlefish/host/libs/metrics/gce_environment.cc | 3 +-- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/base/cvd/.clang-tidy b/base/cvd/.clang-tidy index adb705bacd4..9ee035ae90d 100644 --- a/base/cvd/.clang-tidy +++ b/base/cvd/.clang-tidy @@ -2,6 +2,7 @@ # `parse_headers` bazel feature. Checks: &checks >- + bugprone-argument-comment, clang-analyzer-*, clang-diagnostic-*, -clang-diagnostic-pragma-once-outside-header, diff --git a/base/cvd/cuttlefish/host/commands/cvd/cli/commands/login.cpp b/base/cvd/cuttlefish/host/commands/cvd/cli/commands/login.cpp index 5e4dd22226d..a39b8c13e8a 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/cli/commands/login.cpp +++ b/base/cvd/cuttlefish/host/commands/cvd/cli/commands/login.cpp @@ -76,7 +76,8 @@ class CvdLoginCommand : public CvdCommandHandler { } CurlGlobalInit init; - std::unique_ptr http_client = CurlHttpClient(true); + std::unique_ptr http_client = + CurlHttpClient(/*use_logging_debug_function=*/true); CF_EXPECT(http_client.get(), "Failed to create a http client"); if (!oauth2_request.is_ssh) { diff --git a/base/cvd/cuttlefish/host/commands/cvd/fetch/downloaders.cc b/base/cvd/cuttlefish/host/commands/cvd/fetch/downloaders.cc index 86e4bf2357f..cbad08a25fe 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/fetch/downloaders.cc +++ b/base/cvd/cuttlefish/host/commands/cvd/fetch/downloaders.cc @@ -62,8 +62,7 @@ Result Downloaders::Create(const BuildApiFlags& flags, const std::string& cache_base_path) { std::unique_ptr impl(new Downloaders::Impl()); - const bool use_logging_debug_function = true; - impl->curl_ = CurlHttpClient(use_logging_debug_function); + impl->curl_ = CurlHttpClient(/*use_logging_debug_function=*/true); impl->retrying_http_client_ = RetryingServerErrorHttpClient( *impl->curl_, 10, std::chrono::milliseconds(5000)); diff --git a/base/cvd/cuttlefish/host/commands/metrics/metrics_transmission.cc b/base/cvd/cuttlefish/host/commands/metrics/metrics_transmission.cc index 1234da82eb2..eab8df471fa 100644 --- a/base/cvd/cuttlefish/host/commands/metrics/metrics_transmission.cc +++ b/base/cvd/cuttlefish/host/commands/metrics/metrics_transmission.cc @@ -57,9 +57,8 @@ Result TransmitMetricsEvent( const wireless_android_play_playlog::LogRequest& log_request, ClearcutEnvironment environment) { CurlGlobalInit curl_global_init; - const bool use_logging_debug_function = true; std::unique_ptr http_client = - CurlHttpClient(use_logging_debug_function); + CurlHttpClient(/*use_logging_debug_function=*/true); CF_EXPECT(http_client.get() != nullptr, "Unable to create cURL client for metrics transmission"); CF_EXPECT( diff --git a/base/cvd/cuttlefish/host/libs/metrics/gce_environment.cc b/base/cvd/cuttlefish/host/libs/metrics/gce_environment.cc index 9d590e6b0fb..992729c8cbe 100644 --- a/base/cvd/cuttlefish/host/libs/metrics/gce_environment.cc +++ b/base/cvd/cuttlefish/host/libs/metrics/gce_environment.cc @@ -86,9 +86,8 @@ Result GetZoneValue(std::string_view response_string) { Result> DetectGceEnvironment() { CurlGlobalInit curl_init; - const bool use_logging_debug_function = true; std::unique_ptr http_client = - CurlHttpClient(use_logging_debug_function); + CurlHttpClient(/*use_logging_debug_function=*/true); if (!CF_EXPECT(IsGceEnvironment(*http_client))) { return std::nullopt; }