1/*
2 * Copyright (C) 2020 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16syntax = "proto2";
17
18package cuttlefish;
19
20import "common.proto";
21
22// Wrapper for Cuttlefish Metrics log events.
23// Next index: 22
24message MetricsEvent {
25  // High level event types for this message. This is the broadest
26  // category identifier for MetricsEvent and should be used to indicate
27  // which other fields will be populated. Only used in field event_type.
28  // Next index: 6
29  enum EventType {
30    // An unspecified, unhandled event.
31    CUTTLEFISH_EVENT_TYPE_UNSPECIFIED = 0;
32
33    // The device experienced an error.
34    CUTTLEFISH_EVENT_TYPE_ERROR = 1;
35
36    // The event type is the time the VM instance is instantiated.
37    CUTTLEFISH_EVENT_TYPE_VM_INSTANTIATION = 2;
38
39    // The event type is the time the device boot process is started.
40    CUTTLEFISH_EVENT_TYPE_DEVICE_BOOT = 3;
41
42    // The event type is the time the device lock screen is available.
43    CUTTLEFISH_EVENT_TYPE_LOCK_SCREEN_AVAILABLE = 4;
44
45    // The event type is the time the virtual device was stopped.
46    CUTTLEFISH_EVENT_TYPE_VM_STOP = 5;
47  }
48
49  // Defines the OS that this log was sourced from.
50  // This may not be the same OS which uploaded the log event.
51  // Next index: 5
52  enum OsType {
53    // The log event was sourced from an unspecified os type.
54    CUTTLEFISH_OS_TYPE_UNSPECIFIED = 0;
55
56    // The log event was sourced from Linux x86 os type.
57    CUTTLEFISH_OS_TYPE_LINUX_X86 = 1;
58
59    // The log event was sourced from Linux x86_64 os type.
60    CUTTLEFISH_OS_TYPE_LINUX_X86_64 = 2;
61
62    // The log event was sourced from Linux aarch32 os type.
63    CUTTLEFISH_OS_TYPE_LINUX_AARCH32 = 3;
64
65    // The log event was sourced from Linux aarch64 os type.
66    CUTTLEFISH_OS_TYPE_LINUX_AARCH64 = 4;
67  }
68
69  // Defines the VMM that this log was sourced from.
70  // This may not be the same VMM which uploaded the log event.
71  // Next index: 3
72  enum VmmType {
73    // The log event was sourced from an unspecified vmm type.
74    CUTTLEFISH_VMM_TYPE_UNSPECIFIED = 0;
75
76    // The log event was sourced from a CrOS VM vmm type.
77    CUTTLEFISH_VMM_TYPE_CROSVM = 1;
78
79    // The log event was sourced from a QEMU vmm type.
80    CUTTLEFISH_VMM_TYPE_QEMU = 2;
81  }
82
83  // High level error types for this message. Defines the error
84  // the device received when it experienced an error. This field
85  // should only be present when event_type is ERROR.
86  // Next index: 1
87  enum ErrorType {
88    // An unspecified, unhandled error.
89    CUTTLEFISH_ERROR_TYPE_UNSPECIFIED = 0;
90  }
91
92  // Defines the type of device event contained in this message.
93  // This is the highest level identifier for MetricsEvent messages.
94  optional EventType event_type = 1;
95
96  // Defines the error the device received when it experienced an error.
97  // The field should only be present when event_type is ERROR.
98  optional ErrorType error_type = 2;
99
100  // Time the event occurred in milliseconds since Unix epoch.
101  optional Timestamp event_time_ms = 3;
102
103  // Elapsed time for the event in milliseconds.
104  optional Duration elapsed_time_ms = 4;
105
106  // The type of OS this log event originated from.
107  optional OsType os_type = 5;
108
109  // OS version for the host/guest operating system.
110  // Ex. Android version (9.x, 10.x, etc.) or `uname -r` output
111  optional string os_version = 6;
112
113  // Android guest API level
114  optional int32 api_level = 7;
115
116  // The type of VMM this log event originated from.
117  optional VmmType vmm_type = 8;
118
119  // The version of the VMM that's sending the log event.
120  optional string vmm_version = 9;
121
122  // The company that's sending the log event.
123  optional string company = 10;
124
125  // TODO(moelsherif) : The following fields are not yet implemented.
126
127  // The allowlist of launch_cvd flags attached to the launch_cvd command
128  // associated with this instance
129  repeated string launch_cvd_flags = 11;
130
131  // Exists a -system_image_dir specified in launch_cvd
132  optional bool exists_system_image_spec = 12;
133
134  // Exists a -boot_image specified in launch_cvd
135  optional bool exists_boot_image_spec = 13;
136
137  // Exists a -bootloader specified in launch_cvd
138  optional bool exists_bootloader_spec = 14;
139
140  // Exists a -composite_disk specified in launch_cvd
141  optional bool exists_composite_disk_spec = 15;
142
143  // Exists a -data_image specified in launch_cvd
144  optional bool exists_data_image_spec = 16;
145
146  // Exists a -metadata_image specified in launch_cvd
147  optional bool exists_metadata_image_spec = 17;
148
149  // Exists a -misc_image specified in launch_cvd
150  optional bool exists_misc_image_spec = 18;
151
152  // Exists a -qemu_binary specified in launch_cvd
153  optional bool exists_qemu_binary_spec = 19;
154
155  // Exists a -super_image specified in launch_cvd
156  optional bool exists_super_image_spec = 20;
157
158  // Exists a -vendor_boot_image specified in launch_cvd
159  optional bool exists_vendor_boot_image_spec = 21;
160}
161