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 22//option jspb_use_correct_proto2_semantics = false; // <internal> 23option java_package = "com.google.mobiledatadownload"; 24option java_outer_classname = "LogProto"; 25 26// Info about the Android client that logged. 27// Next tag: 3 28message AndroidClientInfo { 29 // Version of the module we are currently running. aMDD will log its own 30 // version that it shares between GMSCore module and library. 31 32 optional int32 module_version = 1 [default = -1]; 33 34 // Package name of the hosting application. 35 // It is to differentiate logs from GMS service and library. 36 optional string host_package_name = 2; 37} 38 39// Attributes of the device and/or MDD 40// Recommended to log this message with each MDD log defined below. This will 41// allow slicing MDD stats on the state of the device. 42// 43// TODO: Make Fields of this proto available as RASTA conditions for 44// experimentation. 45// 46// Next tag: 3 47message MddDeviceInfo { 48 // Indicates low storage space condition on the device. 49 // Currently in O-, it is the result of Android's ACTION_DEVICE_STORAGE_LOW 50 // intent when the storage state was logged. 51 // For O+, MDD will define its own threshold for low storage: b/77856395 52 optional bool device_storage_low = 1; 53 54 reserved 2; 55} 56 57// Metadata associated with each data download event specific to a file group. 58// 59// Next tag: 9 60message DataDownloadFileGroupStats { 61 // Name of the file group. 62 optional string file_group_name = 1; 63 64 // Client set version number used to identify the file group. 65 // Note that this does not uniquely identify the contents of the file group. 66 // It simply reflects a snapshot of client config changes. 67 // For example: say there's a file group 'language-detector-model' that 68 // downloads a different file per user locale. 69 // data_file_group { 70 // file_group_name = 'language-detector-model' 71 // file_group_version_number = 1 72 // file { 73 // url = 'en-model' 74 // } 75 // } 76 // data_file_group { 77 // file_group_name = 'language-detector-model' 78 // file_group_version_number = 1 79 // file { 80 // url = 'es-model' 81 // } 82 // } 83 // Note that even though the actual contents of the file group are different 84 // for each locale, the version is the same because this config was pushed 85 // at the same snapshot. 86 optional int32 file_group_version_number = 2; 87 88 // The package name of the group owner. 89 optional string owner_package = 3; 90 91 // The total number of files in the file group. 92 // 93 // NOTE: This count is only included for storage and file group stats logging 94 optional int32 file_count = 4; 95 96 // The number of inline files in the file group. 97 // 98 // NOTE: This count is only included for storage and file group stats logging 99 optional int32 inline_file_count = 8; 100 101 // Whether the file group has an account associated with it or not. This will 102 // allow us to slice metrics by having account or not. For more info see 103 // <internal> 104 optional bool has_account = 5; 105 106 // The build id for the file group. Unique identifier for a file group config 107 // created when using MDD Ingress API. 108 // For more details see <internal>. 109 optional int64 build_id = 6; 110 111 // The VariantID of the DataFileGroup. This is set up server side via code 112 // review. For more details see <internal>. 113 // Examples: "en", "de-universal", etc. 114 optional string variant_id = 7; 115} 116 117// The status of a MDD file group. This data is logged periodically to get 118// a snapshot of the status of a file group on devices. 119// Next tag: 5 120message MddFileGroupStatus { 121 // Download status of the whole file group. This is an AND over the 122 // download status of each file within the file group. 123 optional MddFileGroupDownloadStatus.Code file_group_download_status = 1; 124 125 // Time since epoch when this file group was first added to mdd. 126 // 127 // Set to -1 if this time is unknown (for legacy groups). 128 // 129 // This matches the field "group_new_files_received_timestamp" in metadata 130 // <internal> 131 optional int64 group_added_timestamp_in_seconds = 2; 132 133 // Time since epoch when this file group was downloaded by mdd. 134 // 135 // Set to -1 if this time is unknown (for legacy groups) and non-downloaded 136 // groups 137 // 138 // This matches the field "group_downloaded_timestamp_in_millis" in metadata 139 // <internal> 140 optional int64 group_downloaded_timestamp_in_seconds = 3; 141 142 // Number of days since this status was last logged (number of days since 143 // daily maintenance was last run). 144 // 145 // Set to -1 if there is an invalid or unknown value. 146 // 147 // See <internal> for more info. 148 optional int32 days_since_last_log = 4; 149} 150 151// Various health reports. 152// Ideally, this should be defined as an empty message that allows extensions 153// and each inner proto should be defined as its extension. 154// TODO: Figure out if there are limitations in nano-proto that might 155// not allow this. 156// 157// Next tag: 74 158message MddLogData { 159 // MDD data download file group stats. 160 optional DataDownloadFileGroupStats data_download_file_group_stats = 10; 161 162 // Sampling interval used while logging this message. The default value 0 is 163 // not a valid value for messages using this filed since it a special value 164 // denoting that message should not be logged. Hence value of 0 means it was 165 // not filled in. 166 optional int64 sampling_interval = 21; 167 168 // Additional info necessary for stable sampling. 169 optional StableSamplingInfo stable_sampling_info = 72; 170 171 // Data download file group download status (logged periodically). 172 optional MddFileGroupStatus mdd_file_group_status = 32; 173 174 // Attributes of the device and/or MDD at the time we log other stats. 175 optional MddDeviceInfo device_info = 40; 176 177 // Android client info. 178 optional AndroidClientInfo android_client_info = 51; 179 180 optional MddStorageStats mdd_storage_stats = 46; 181 182 // MDD download result log. 183 optional MddDownloadResultLog mdd_download_result_log = 63; 184 185 reserved 1 to 9, 11 to 20, 22 to 31, 33 to 39, 41 to 45, 47 to 50, 52 to 62, 186 64 to 71, 73; 187} 188 189// Info on sampling method used for log events. Stable sampling means if a 190// device is selected to log, it will log all events. See <internal> 191// Next tag: 5 192message StableSamplingInfo { 193 // Whether a stable sampling method (as described in <internal>) 194 // was used. 195 optional bool stable_sampling_used = 1; 196 197 // When stable sampling was first enabled on the device. This will be useful 198 // when rolling out and processing logs over multiple days. 199 optional int64 stable_sampling_first_enabled_timestamp_ms = 2; 200 201 // Whether or not this device would log with the 1% cohort. Devices in the 1% 202 // cohort are *always* logging, and will always log without further code 203 // changes. When a device has this set to true, it's expected that the device 204 // is *always* logging and the sampling rate should not be changed to 205 // something that results in this device being excluded from the logging group 206 // (see invalid_sampling_rate_used). 207 // 208 // Most dashboards/metrics depending on linking together multiple events from 209 // the same device should filter to devices/events that have this set to true 210 // (with the caveat that we won't use all data from all devices reporting). 211 // This is useful when we need to change sampling rates, e.g. for an 212 // experiment. 213 optional bool part_of_always_logging_group = 3; 214 215 // If we are using stable sampling, we expect a sampling rate where '100 % 216 // sample_interval == 0'. This ensures that devices logging at 1 percent 217 // sampling interval, will continue to log at other chosen sampling rates too. 218 // This should only be false if we've incorrectly configured our sampling 219 // rates (e.g. a sampling rate of 101 would mean that the 1 percent cohort 220 // devices would not log). 221 optional bool invalid_sampling_rate_used = 4; 222} 223 224// MDD download result log. 225message MddDownloadResultLog { 226 optional MddDownloadResult.Code result = 1; 227 // File group information. 228 optional DataDownloadFileGroupStats data_download_file_group_stats = 2; 229} 230 231// MDD Storage stats 232// Next tag 9 233message MddStorageStats { 234 repeated DataDownloadFileGroupStats data_download_file_group_stats = 1; 235 236 // NOTE: The four repeated fields total_bytes_used, total_inline_bytes_used, 237 // downloaded_group_bytes_used, and downloaded_group_inline_bytes_used have 238 // the same length and an element from all fields with the same index 239 // refers to the same file group. 240 241 // total_bytes_used[x] represents the total bytes used on disk by the 242 // file group index x. 243 repeated uint64 total_bytes_used = 2; 244 245 // total_inline_bytes_used[x] represents the total bytes used on disk by 246 // _inline_ files of file group index x. 247 repeated uint64 total_inline_bytes_used = 7 [packed = true]; 248 249 // Similarly, the downloaded_group_bytes_used[x] 250 // represents the bytes used in the corresponding downloaded file group. 251 repeated uint64 downloaded_group_bytes_used = 3; 252 253 // Similarly, the downloaded_group_inline_bytes_used[x] represents the 254 // bytes of _inline_ files used in the corresponding downloaded file group. 255 repeated uint64 downloaded_group_inline_bytes_used = 8 [packed = true]; 256 257 // Total bytes used by all MDD file groups. 258 // Measured by adding up file sizes for all files that are known to MDD. 259 optional uint64 total_mdd_bytes_used = 4; 260 261 // Total bytes used by MDD download directory. 262 optional uint64 total_mdd_directory_bytes_used = 5; 263 264 // Number of days since this status was last logged (number of days since 265 // daily maintenance was last run). 266 // 267 // Set to -1 if there is an invalid or unknown value. 268 // 269 // See <internal> for more info. 270 optional int32 days_since_last_log = 6; 271}