1// Copyright 2022 Google LLC 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14// Logging protos for MobileDataDownload 15 16syntax = "proto2"; 17 18package mobiledatadownload.logs; 19 20import "log_enums.proto"; 21 22option java_package = "com.google.mobiledatadownload"; 23option java_outer_classname = "LogProto"; 24 25// Info about the Android client that logged. 26// Next tag: 3 27message AndroidClientInfo { 28 // Version of the module we are currently running. aMDD will log its own 29 // version that it shares between GMSCore module and library. 30 31 optional int32 module_version = 1 [default = -1]; 32 33 // Package name of the hosting application. 34 // It is to differentiate logs from GMS service and library. 35 optional string host_package_name = 2; 36} 37 38// Attributes of the device and/or MDD 39// Recommended to log this message with each MDD log defined below. This will 40// allow slicing MDD stats on the state of the device. 41// 42// TODO: Make Fields of this proto available as RASTA conditions for 43// experimentation. 44// 45// Next tag: 3 46message MddDeviceInfo { 47 // Indicates low storage space condition on the device. 48 // Currently in O-, it is the result of Android's ACTION_DEVICE_STORAGE_LOW 49 // intent when the storage state was logged. 50 // For O+, MDD will define its own threshold for low storage: b/77856395 51 optional bool device_storage_low = 1; 52 53 reserved 2; 54} 55 56// Metadata associated with each data download event specific to a file group. 57// 58// Next tag: 9 59message DataDownloadFileGroupStats { 60 // Name of the file group. 61 optional string file_group_name = 1; 62 63 // Client set version number used to identify the file group. 64 // Note that this does not uniquely identify the contents of the file group. 65 // It simply reflects a snapshot of client config changes. 66 // For example: say there's a file group 'language-detector-model' that 67 // downloads a different file per user locale. 68 // data_file_group { 69 // file_group_name = 'language-detector-model' 70 // file_group_version_number = 1 71 // file { 72 // url = 'en-model' 73 // } 74 // } 75 // data_file_group { 76 // file_group_name = 'language-detector-model' 77 // file_group_version_number = 1 78 // file { 79 // url = 'es-model' 80 // } 81 // } 82 // Note that even though the actual contents of the file group are different 83 // for each locale, the version is the same because this config was pushed 84 // at the same snapshot. 85 optional int32 file_group_version_number = 2; 86 87 // The package name of the group owner. 88 optional string owner_package = 3; 89 90 // The total number of files in the file group. 91 // 92 // NOTE: This count is only included for storage and file group stats logging 93 optional int32 file_count = 4; 94 95 // The number of inline files in the file group. 96 // 97 // NOTE: This count is only included for storage and file group stats logging 98 optional int32 inline_file_count = 8; 99 100 // Whether the file group has an account associated with it or not. This will 101 // allow us to slice metrics by having account or not. For more info see 102 // <internal> 103 optional bool has_account = 5; 104 105 // The build id for the file group. Unique identifier for a file group config 106 // created when using MDD Ingress API. 107 // For more details see <internal>. 108 optional int64 build_id = 6; 109 110 // The VariantID of the DataFileGroup. This is set up server side via code 111 // review. For more details see <internal>. 112 // Examples: "en", "de-universal", etc. 113 optional string variant_id = 7; 114} 115 116// The status of a MDD file group. This data is logged periodically to get 117// a snapshot of the status of a file group on devices. 118// Next tag: 5 119message MddFileGroupStatus { 120 // Download status of the whole file group. This is an AND over the 121 // download status of each file within the file group. 122 optional MddFileGroupDownloadStatus.Code file_group_download_status = 1; 123 124 // Time since epoch when this file group was first added to mdd. 125 // 126 // Set to -1 if this time is unknown (for legacy groups). 127 // 128 // This matches the field "group_new_files_received_timestamp" in metadata 129 // <internal> 130 optional int64 group_added_timestamp_in_seconds = 2; 131 132 // Time since epoch when this file group was downloaded by mdd. 133 // 134 // Set to -1 if this time is unknown (for legacy groups) and non-downloaded 135 // groups 136 // 137 // This matches the field "group_downloaded_timestamp_in_millis" in metadata 138 // <internal> 139 optional int64 group_downloaded_timestamp_in_seconds = 3; 140 141 // Number of days since this status was last logged (number of days since 142 // daily maintenance was last run). 143 // 144 // Set to -1 if there is an invalid or unknown value. 145 // 146 // See <internal> for more info. 147 optional int32 days_since_last_log = 4; 148} 149 150// Various health reports. 151// Ideally, this should be defined as an empty message that allows extensions 152// and each inner proto should be defined as its extension. 153// TODO: Figure out if there are limitations in nano-proto that might 154// not allow this. 155// 156// Next tag: 74 157message MddLogData { 158 // MDD data download file group stats. 159 optional DataDownloadFileGroupStats data_download_file_group_stats = 10; 160 161 // Sampling interval used while logging this message. The default value 0 is 162 // not a valid value for messages using this filed since it a special value 163 // denoting that message should not be logged. Hence value of 0 means it was 164 // not filled in. 165 optional int64 sampling_interval = 21; 166 167 // Additional info necessary for stable sampling. 168 optional StableSamplingInfo stable_sampling_info = 72; 169 170 // Data download file group download status (logged periodically). 171 optional MddFileGroupStatus mdd_file_group_status = 32; 172 173 // Attributes of the device and/or MDD at the time we log other stats. 174 optional MddDeviceInfo device_info = 40; 175 176 // Android client info. 177 optional AndroidClientInfo android_client_info = 51; 178 179 optional MddStorageStats mdd_storage_stats = 46; 180 181 // MDD download result log. 182 optional MddDownloadResultLog mdd_download_result_log = 63; 183 184 // MDD download latency log. 185 optional MddDownloadLatency mdd_download_latency = 67; 186 187 // MDD Api Result event 188 optional MddLibApiResultLog mdd_lib_api_result_log = 71; 189 190 // MDD File Group Network Stats. Additional info necessary for Network Stats. 191 optional MddNetworkStats mdd_network_stats = 49; 192 193 reserved 1 to 9, 11 to 20, 22 to 31, 33 to 39, 41 to 45, 47 to 48, 50, 194 52 to 62, 64 to 66, 68 to 70, 73; 195} 196 197// Info on sampling method used for log events. Stable sampling means if a 198// device is selected to log, it will log all events. See <internal> 199// Next tag: 5 200message StableSamplingInfo { 201 // Whether a stable sampling method (as described in <internal>) 202 // was used. 203 optional bool stable_sampling_used = 1; 204 205 // When stable sampling was first enabled on the device. This will be useful 206 // when rolling out and processing logs over multiple days. 207 optional int64 stable_sampling_first_enabled_timestamp_ms = 2; 208 209 // Whether or not this device would log with the 1% cohort. Devices in the 1% 210 // cohort are *always* logging, and will always log without further code 211 // changes. When a device has this set to true, it's expected that the device 212 // is *always* logging and the sampling rate should not be changed to 213 // something that results in this device being excluded from the logging group 214 // (see invalid_sampling_rate_used). 215 // 216 // Most dashboards/metrics depending on linking together multiple events from 217 // the same device should filter to devices/events that have this set to true 218 // (with the caveat that we won't use all data from all devices reporting). 219 // This is useful when we need to change sampling rates, e.g. for an 220 // experiment. 221 optional bool part_of_always_logging_group = 3; 222 223 // If we are using stable sampling, we expect a sampling rate where '100 % 224 // sample_interval == 0'. This ensures that devices logging at 1 percent 225 // sampling interval, will continue to log at other chosen sampling rates too. 226 // This should only be false if we've incorrectly configured our sampling 227 // rates (e.g. a sampling rate of 101 would mean that the 1 percent cohort 228 // devices would not log). 229 optional bool invalid_sampling_rate_used = 4; 230} 231 232// MDD download result log. 233message MddDownloadResultLog { 234 optional MddDownloadResult.Code result = 1; 235 // File group information. 236 optional DataDownloadFileGroupStats data_download_file_group_stats = 2; 237} 238 239// MDD Storage stats 240// Next tag 9 241message MddStorageStats { 242 repeated DataDownloadFileGroupStats data_download_file_group_stats = 1; 243 244 // NOTE: The four repeated fields total_bytes_used, total_inline_bytes_used, 245 // downloaded_group_bytes_used, and downloaded_group_inline_bytes_used have 246 // the same length and an element from all fields with the same index 247 // refers to the same file group. 248 249 // total_bytes_used[x] represents the total bytes used on disk by the 250 // file group index x. 251 repeated uint64 total_bytes_used = 2; 252 253 // total_inline_bytes_used[x] represents the total bytes used on disk by 254 // _inline_ files of file group index x. 255 repeated uint64 total_inline_bytes_used = 7 [packed = true]; 256 257 // Similarly, the downloaded_group_bytes_used[x] 258 // represents the bytes used in the corresponding downloaded file group. 259 repeated uint64 downloaded_group_bytes_used = 3; 260 261 // Similarly, the downloaded_group_inline_bytes_used[x] represents the 262 // bytes of _inline_ files used in the corresponding downloaded file group. 263 repeated uint64 downloaded_group_inline_bytes_used = 8 [packed = true]; 264 265 // Total bytes used by all MDD file groups. 266 // Measured by adding up file sizes for all files that are known to MDD. 267 optional uint64 total_mdd_bytes_used = 4; 268 269 // Total bytes used by MDD download directory. 270 optional uint64 total_mdd_directory_bytes_used = 5; 271 272 // Number of days since this status was last logged (number of days since 273 // daily maintenance was last run). 274 // 275 // Set to -1 if there is an invalid or unknown value. 276 // 277 // See <internal> for more info. 278 optional int32 days_since_last_log = 6; 279} 280 281// MDD download latency log. 282// Next tag: 4 283message MddDownloadLatency { 284 // The number of download attempts needed to fully download the file group. 285 optional int32 download_attempt_count = 1; 286 // The download latency in milliseconds, which is the time elapsed between 287 // download started and download complete. 288 optional int64 download_latency_ms = 2; 289 // The total MDD download latency in milliseconds, which is the time elapsed 290 // between new config received from P/H and download complete. 291 // True E2E download latency = PH propagation latency + MDD total download 292 // latency. Here we are talking about the later. 293 optional int64 total_latency_ms = 3; 294} 295 296// MDD Lib API result log. 297// This log will be generated for each MDD Lib API call. 298// 299// Next tag: 5 300message MddLibApiResultLog { 301 // The API which generated this result. 302 optional MddLibApiName.Code api_used = 1; 303 304 // The result of the API call. 305 optional MddLibApiResult.Code result = 2; 306 307 // Will be populated with relevant file group details depending on the api 308 // type. See MddLibApiName for more details. 309 repeated DataDownloadFileGroupStats data_download_file_group_stats = 3; 310 311 // The latency in nano seconds. 312 optional int64 latency_ns = 4; 313} 314 315// MDD File Group Network stats. 316message MddGroupNetworkStats { 317 optional DataDownloadFileGroupStats data_download_file_group_stats = 1; 318 319 // The total bytes downloaded through Wifi by the file group. 320 optional int64 total_wifi_bytes = 2; 321 322 // The total bytes downloaded through Cellular by the file group. 323 optional int64 total_cellular_bytes = 3; 324 325 // The total bytes downloaded through ways other than wifi or Cellular by the 326 // file group. E.g. import from local storage & etc. 327 optional int64 total_other_bytes = 4; 328} 329 330// MDD Network stats 331message MddNetworkStats { 332 message GroupStats { 333 optional DataDownloadFileGroupStats data_download_file_group_stats = 1; 334 335 // The total bytes downloaded through Wifi by the file group. 336 optional uint64 total_wifi_bytes = 2; 337 338 // The total bytes downloaded through Cellular by the file group. 339 optional uint64 total_cellular_bytes = 3; 340 } 341 342 repeated GroupStats group_stats = 1; 343 344 // Total bytes downloaded by all MDD file groups through Wifi. 345 optional uint64 total_mdd_wifi_bytes = 2; 346 347 // Total bytes downloaded by all MDD file groups through Cellular. 348 optional uint64 total_mdd_cellular_bytes = 3; 349}