|
65 | 65 | #include "cuttlefish/host/commands/cvd/utils/common.h" |
66 | 66 | #include "cuttlefish/host/commands/cvd/utils/interrupt_listener.h" |
67 | 67 | #include "cuttlefish/host/commands/cvd/utils/subprocess_waiter.h" |
68 | | -#include "cuttlefish/host/commands/metrics/utils.h" |
| 68 | +#include "cuttlefish/host/commands/metrics/events.h" |
69 | 69 | #include "cuttlefish/host/libs/config/config_constants.h" |
70 | 70 | #include "cuttlefish/host/libs/config/cuttlefish_config.h" |
| 71 | +#include "cuttlefish/host/libs/config/vmm_mode.h" |
71 | 72 | #include "cuttlefish/host/libs/metrics/metrics_defs.h" |
72 | | -#include "external_proto/cf_log.pb.h" |
73 | | -#include "external_proto/clientanalytics.pb.h" |
74 | | -#include "external_proto/log_source_enum.pb.h" |
75 | 73 |
|
76 | 74 | namespace cuttlefish { |
77 | 75 | namespace { |
78 | 76 |
|
79 | | -using logs::proto::wireless::android::cuttlefish::CuttlefishLogEvent; |
80 | | -using wireless_android_play_playlog::ClientInfo; |
81 | | -using wireless_android_play_playlog::LogEvent; |
82 | | -using wireless_android_play_playlog::LogRequest; |
83 | | -using wireless_android_play_playlog::LogSourceEnum::LogSource; |
84 | | - |
85 | 77 | std::optional<std::string> GetConfigPath(cvd_common::Args& args) { |
86 | 78 | std::size_t initial_size = args.size(); |
87 | 79 | std::string config_file; |
@@ -635,32 +627,10 @@ Result<void> CvdStartCommandHandler::LaunchDevice( |
635 | 627 | "Policy (https://policies.google.com/privacy) describes how Google " |
636 | 628 | "handles information generated as you use Google services."; |
637 | 629 | if (kEnableCvdMetrics) { |
638 | | - static constexpr LogSource kLogSourceId = LogSource::CUTTLEFISH_METRICS; |
639 | | - static constexpr char kLogSourceStr[] = "CUTTLEFISH_METRICS"; |
640 | | - static constexpr ClientInfo::ClientType kCppClientType = |
641 | | - ClientInfo::CPLUSPLUS; |
642 | | - |
643 | 630 | LOG(INFO) << "This will automatically send diagnostic information to " |
644 | 631 | "Google, such as crash reports and usage data from the host " |
645 | 632 | "machine managing the Android Virtual Device."; |
646 | | - CuttlefishLogEvent cf_log_event; |
647 | | - |
648 | | - cf_log_event.set_session_id("cvd-todo-session"); |
649 | | - |
650 | | - LogRequest request_proto; |
651 | | - request_proto.set_log_source(kLogSourceId); |
652 | | - request_proto.set_log_source_name(kLogSourceStr); |
653 | | - |
654 | | - ClientInfo& client_info = *request_proto.mutable_client_info(); |
655 | | - client_info.set_client_type(kCppClientType); |
656 | | - |
657 | | - LogEvent& log_event = *request_proto.add_log_event(); |
658 | | - log_event.set_event_time_ms(metrics::GetEpochTimeMs()); |
659 | | - log_event.set_source_extension(cf_log_event.SerializeAsString()); |
660 | | - |
661 | | - std::string request_string = request_proto.SerializeAsString(); |
662 | | - MetricsExitCodes reporting_outcome = |
663 | | - metrics::PostRequest(request_string, metrics::ClearcutServer::kProd); |
| 633 | + int reporting_outcome = metrics::SendVMStart(VmmMode::kUnknown); |
664 | 634 | if (reporting_outcome != MetricsExitCodes::kSuccess) { |
665 | 635 | LOG(ERROR) << "Issue reporting metrics: " << reporting_outcome; |
666 | 636 | } |
@@ -705,6 +675,13 @@ Result<void> CvdStartCommandHandler::LaunchDeviceInterruptible( |
705 | 675 | return start_res; |
706 | 676 | } |
707 | 677 |
|
| 678 | + if (kEnableCvdMetrics) { |
| 679 | + int reporting_outcome = metrics::SendDeviceBoot(VmmMode::kUnknown); |
| 680 | + if (reporting_outcome != MetricsExitCodes::kSuccess) { |
| 681 | + LOG(ERROR) << "Issue reporting metrics: " << reporting_outcome; |
| 682 | + } |
| 683 | + } |
| 684 | + |
708 | 685 | return {}; |
709 | 686 | } |
710 | 687 |
|
|
0 commit comments