Skip to content

Commit 20a829f

Browse files
committed
Call new fetch metrics helpers from cvd fetch
Note, this is only completing the data gathering steps, not transmission. The new fetch fields do not yet exist in the proto and are not being populated in `metrics_conversion.cc`. Bug: 491965176
1 parent ac784eb commit 20a829f

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

base/cvd/cuttlefish/host/commands/cvd/cli/commands/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ cf_cc_library(
144144
"//cuttlefish/host/commands/cvd/fetch:fetch_cvd_parser",
145145
"//cuttlefish/host/commands/cvd/utils",
146146
"//cuttlefish/host/commands/cvd/utils:common",
147+
"//cuttlefish/host/libs/metrics:fetch_metrics_orchestration",
147148
"//cuttlefish/result",
148149
"//libbase",
149150
"@abseil-cpp//absl/log",

base/cvd/cuttlefish/host/commands/cvd/cli/commands/fetch.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include "cuttlefish/host/commands/cvd/fetch/fetch_cvd.h"
3535
#include "cuttlefish/host/commands/cvd/fetch/fetch_cvd_parser.h"
3636
#include "cuttlefish/host/commands/cvd/utils/common.h"
37+
#include "cuttlefish/host/libs/metrics/fetch_metrics_orchestration.h"
3738
#include "cuttlefish/result/result.h"
3839

3940
namespace cuttlefish {
@@ -55,6 +56,7 @@ Result<void> CvdFetchCommandHandler::Handle(const CommandRequest& request) {
5556
std::vector<std::string> args = request.SubcommandArguments();
5657
const FetchFlags flags = CF_EXPECT(FetchFlags::Parse(args));
5758
CF_EXPECT(EnsureDirectoryExists(flags.target_directory));
59+
GatherFetchStartMetrics(flags);
5860

5961
std::string log_file = GetFetchLogsFileName(flags.target_directory);
6062
ScopedLogger logger(SeverityTarget::FromFile(log_file), "");
@@ -74,6 +76,12 @@ Result<void> CvdFetchCommandHandler::Handle(const CommandRequest& request) {
7476
flags.build_api_flags.max_cache_size_gb);
7577
}
7678
}
79+
80+
if (result.ok()) {
81+
GatherFetchCompleteMetrics(flags.target_directory, *result);
82+
} else {
83+
GatherFetchFailedMetrics(flags.target_directory);
84+
}
7785
CF_EXPECT(std::move(result));
7886
return {};
7987
}

0 commit comments

Comments
 (0)