Hugo Benichi | 50a84c6 | 2016-09-02 09:00:59 +0900 | [diff] [blame] | 1 | // LINT: LEGACY_NAMES |
| 2 | syntax = "proto2"; |
| 3 | |
| 4 | package clearcut.connectivity; |
| 5 | |
| 6 | option java_package = "com.android.server.connectivity.metrics"; |
| 7 | option java_outer_classname = "IpConnectivityLogClass"; |
| 8 | |
| 9 | // NetworkId represents the id given by the system to a physical network on the |
| 10 | // Android device. It is used to relates events to each other for devices with |
| 11 | // multiple networks (WiFi, 4G, ...). |
| 12 | message NetworkId { |
| 13 | // Every network gets assigned a network_id on creation based on order of |
| 14 | // creation. Thus network_id N is assigned to the network created directly |
| 15 | // after network N-1. Thus there is no PII involved here. Zero means no |
| 16 | // network. The value 0 is never assigned to a network. |
| 17 | optional int32 network_id = 1; |
| 18 | }; |
| 19 | |
Hugo Benichi | 4e89a02 | 2017-01-05 17:08:31 +0900 | [diff] [blame^] | 20 | // LinkLayer describes a physical link layer technology used by a network. |
| 21 | // It is not intended to map one to one to the TRANSPORT_* constants defined in |
| 22 | // android.net.NetworkCapabilities. Instead it is intended to be used as |
| 23 | // a dimension field for metrics events and aggregated metrics. |
| 24 | // Next tag: 7 |
| 25 | enum LinkLayer { |
| 26 | // An unknown link layer technology. |
Hugo Benichi | 807124a | 2016-11-24 11:25:01 +0900 | [diff] [blame] | 27 | UNKNOWN = 0; |
Hugo Benichi | 4e89a02 | 2017-01-05 17:08:31 +0900 | [diff] [blame^] | 28 | |
Hugo Benichi | 807124a | 2016-11-24 11:25:01 +0900 | [diff] [blame] | 29 | BLUETOOTH = 1; |
| 30 | CELLULAR = 2; |
| 31 | ETHERNET = 3; |
| 32 | WIFI = 4; |
Hugo Benichi | 4e89a02 | 2017-01-05 17:08:31 +0900 | [diff] [blame^] | 33 | |
| 34 | // Indicates that the link layer dimension is not relevant for the metrics or |
| 35 | // event considered. |
| 36 | NONE = 5; |
| 37 | |
| 38 | // Indicates that the metrics or event considered may involve several links. |
| 39 | MULTIPLE = 6; |
Hugo Benichi | 807124a | 2016-11-24 11:25:01 +0900 | [diff] [blame] | 40 | }; |
| 41 | |
Hugo Benichi | 7c3a786 | 2016-11-24 11:34:49 +0900 | [diff] [blame] | 42 | // A pair of (key, value) integers for describing histogram-like statistics. |
| 43 | message Pair { |
| 44 | optional int32 key = 1; |
| 45 | optional int32 value = 2; |
| 46 | }; |
| 47 | |
Hugo Benichi | 50a84c6 | 2016-09-02 09:00:59 +0900 | [diff] [blame] | 48 | // Logs changes in the system default network. Changes can be 1) acquiring a |
| 49 | // default network with no previous default, 2) a switch of the system default |
| 50 | // network to a new default network, 3) a loss of the system default network. |
| 51 | // This message is associated to android.net.metrics.DefaultNetworkEvent. |
| 52 | message DefaultNetworkEvent { |
| 53 | // A value of 0 means this is a loss of the system default network. |
| 54 | optional NetworkId network_id = 1; |
| 55 | |
| 56 | // A value of 0 means there was no previous default network. |
| 57 | optional NetworkId previous_network_id = 2; |
| 58 | |
| 59 | // Whether the network supports IPv4, IPv6, or both. |
| 60 | enum IPSupport { |
| 61 | NONE = 0; |
| 62 | IPV4 = 1; |
| 63 | IPV6 = 2; |
| 64 | DUAL = 3; |
| 65 | }; |
| 66 | |
| 67 | // Best available information about IP support of the previous network when |
| 68 | // disconnecting or switching to a new default network. |
| 69 | optional IPSupport previous_network_ip_support = 3; |
| 70 | |
| 71 | // The transport types of the new default network, represented by |
| 72 | // TRANSPORT_* constants as defined in NetworkCapabilities. |
| 73 | repeated int32 transport_types = 4; |
| 74 | }; |
| 75 | |
| 76 | // Logs IpReachabilityMonitor probe events and NUD_FAILED events. |
| 77 | // This message is associated to android.net.metrics.IpReachabilityEvent. |
| 78 | message IpReachabilityEvent { |
| 79 | // The interface name (wlan, rmnet, lo, ...) on which the probe was sent. |
Hugo Benichi | 4e89a02 | 2017-01-05 17:08:31 +0900 | [diff] [blame^] | 80 | // Deprecated since version 2, to be replaced by link_layer field. |
Hugo Benichi | 807124a | 2016-11-24 11:25:01 +0900 | [diff] [blame] | 81 | optional string if_name = 1 [deprecated = true]; |
Hugo Benichi | 50a84c6 | 2016-09-02 09:00:59 +0900 | [diff] [blame] | 82 | |
| 83 | // The event type code of the probe, represented by constants defined in |
| 84 | // android.net.metrics.IpReachabilityEvent. |
Hugo Benichi | d680d4c | 2016-10-13 13:16:16 +0900 | [diff] [blame] | 85 | // NUD_FAILED_ORGANIC and PROVISIONING_LOST_ORGANIC recorded since version 1. |
Hugo Benichi | 50a84c6 | 2016-09-02 09:00:59 +0900 | [diff] [blame] | 86 | optional int32 event_type = 2; |
| 87 | }; |
| 88 | |
| 89 | // Logs NetworkMonitor and ConnectivityService events related to the state of |
| 90 | // a network: connection, evaluation, validation, lingering, and disconnection. |
| 91 | // This message is associated to android.net.metrics.NetworkEvent. |
| 92 | message NetworkEvent { |
| 93 | // The id of the network on which this event happened. |
| 94 | optional NetworkId network_id = 1; |
| 95 | |
| 96 | // The type of network event, represented by NETWORK_* constants defined in |
| 97 | // android.net.metrics.NetworkEvent. |
| 98 | optional int32 event_type = 2; |
| 99 | |
| 100 | // Only valid after finishing evaluating a network for Internet connectivity. |
| 101 | // The time it took for this evaluation to complete. |
| 102 | optional int32 latency_ms = 3; |
| 103 | } |
| 104 | |
| 105 | // Logs individual captive portal probing events that are performed when |
| 106 | // evaluating or reevaluating networks for Internet connectivity. |
| 107 | // This message is associated to android.net.metrics.ValidationProbeEvent. |
| 108 | message ValidationProbeEvent { |
| 109 | // The id of the network for which the probe was sent. |
| 110 | optional NetworkId network_id = 1; |
| 111 | |
| 112 | // The time it took for that probe to complete or time out. |
| 113 | optional int32 latency_ms = 2; |
| 114 | |
| 115 | // The type of portal probe, represented by PROBE_* constants defined in |
| 116 | // android.net.metrics.ValidationProbeEvent. |
| 117 | optional int32 probe_type = 3; |
| 118 | |
| 119 | // The http code result of the probe test. |
| 120 | optional int32 probe_result = 4; |
| 121 | } |
| 122 | |
| 123 | // Logs DNS lookup latencies. Repeated fields must have the same length. |
| 124 | // This message is associated to android.net.metrics.DnsEvent. |
Hugo Benichi | 7c3a786 | 2016-11-24 11:34:49 +0900 | [diff] [blame] | 125 | // Deprecated since version 2. |
Hugo Benichi | 50a84c6 | 2016-09-02 09:00:59 +0900 | [diff] [blame] | 126 | message DNSLookupBatch { |
| 127 | // The id of the network on which the DNS lookups took place. |
| 128 | optional NetworkId network_id = 1; |
| 129 | |
| 130 | // The types of the DNS lookups, as defined in android.net.metrics.DnsEvent. |
| 131 | repeated int32 event_types = 2; |
| 132 | |
| 133 | // The return values of the DNS resolver for each DNS lookups. |
| 134 | repeated int32 return_codes = 3; |
| 135 | |
| 136 | // The time it took for each DNS lookups to complete. |
| 137 | repeated int32 latencies_ms = 4; |
| 138 | }; |
| 139 | |
Hugo Benichi | 7c3a786 | 2016-11-24 11:34:49 +0900 | [diff] [blame] | 140 | // Represents a collections of DNS lookup latencies and counters for a |
| 141 | // particular combination of DNS query type and return code. |
| 142 | // Since version 2. |
| 143 | message DNSLatencies { |
| 144 | // The type of the DNS lookups, as defined in android.net.metrics.DnsEvent. |
| 145 | // Acts as a key for a set of DNS query results. |
| 146 | // Possible values are: 0 for getaddrinfo, 1 for gethostbyname. |
| 147 | optional int32 type = 1; |
| 148 | |
| 149 | // The return value of the DNS resolver for the DNS lookups. |
| 150 | // Acts as a key for a set of DNS query results. |
| 151 | // Possible values are: 0 for success, or errno code for failures. |
| 152 | optional int32 return_code = 2; |
| 153 | |
| 154 | // The number of query operations recorded. |
| 155 | optional int32 query_count = 3; |
| 156 | |
| 157 | // The number of query operations returning A IPv4 records. |
| 158 | optional int32 a_count = 4; |
| 159 | |
| 160 | // The number of query operations returning AAAA IPv6 records. |
| 161 | optional int32 aaaa_count = 5; |
| 162 | |
| 163 | // The time it took for each DNS lookup to complete. The number of repeated |
| 164 | // values can be less than query_count in case of event rate-limiting. |
| 165 | repeated int32 latencies_ms = 6; |
| 166 | }; |
| 167 | |
| 168 | // Represents latency and errno statistics of the connect() system call. |
| 169 | // Since version 2. |
| 170 | message ConnectStatistics { |
| 171 | // The number of connect() operations recorded. |
| 172 | optional int32 connect_count = 1; |
| 173 | |
| 174 | // The number of connect() operations with IPv6 socket address. |
| 175 | optional int32 ipv6_addr_count = 2; |
| 176 | |
| 177 | // The time it took for each successful connect() operation to complete. |
| 178 | // The number of repeated values can be less than connect_count in case of |
| 179 | // event rate-limiting. |
| 180 | repeated int32 latencies_ms = 3; |
| 181 | |
| 182 | // Counts of all error values returned by failed connect() operations. |
| 183 | // The Pair key field is the errno code. The Pair value field is the count |
| 184 | // for that errno code. |
| 185 | repeated Pair errnos_counters = 4; |
| 186 | }; |
| 187 | |
Hugo Benichi | 50a84c6 | 2016-09-02 09:00:59 +0900 | [diff] [blame] | 188 | // Represents a DHCP event on a single interface, which can be a DHCPClient |
| 189 | // state transition or a response packet parsing error. |
| 190 | // This message is associated to android.net.metrics.DhcpClientEvent and |
| 191 | // android.net.metrics.DhcpErrorEvent. |
| 192 | message DHCPEvent { |
| 193 | // The interface name (wlan, rmnet, lo, ...) on which the event happened. |
Hugo Benichi | 4e89a02 | 2017-01-05 17:08:31 +0900 | [diff] [blame^] | 194 | // Deprecated since version 2, to be replaced by link_layer field. |
Hugo Benichi | 807124a | 2016-11-24 11:25:01 +0900 | [diff] [blame] | 195 | optional string if_name = 1 [deprecated = true]; |
Hugo Benichi | 50a84c6 | 2016-09-02 09:00:59 +0900 | [diff] [blame] | 196 | |
| 197 | oneof value { |
| 198 | // The name of a state in the DhcpClient state machine, represented by |
| 199 | // the inner classes of android.net.dhcp.DhcpClient. |
| 200 | string state_transition = 2; |
| 201 | |
| 202 | // The error code of a DHCP error, represented by constants defined in |
| 203 | // android.net.metrics.DhcpErrorEvent. |
| 204 | int32 error_code = 3; |
| 205 | } |
| 206 | |
| 207 | // Lifetime duration in milliseconds of a DhcpClient state, or transition |
| 208 | // time in milliseconds between specific pairs of DhcpClient's states. |
Hugo Benichi | d680d4c | 2016-10-13 13:16:16 +0900 | [diff] [blame] | 209 | // Only populated since version 1, when state_transition is populated. |
Hugo Benichi | 50a84c6 | 2016-09-02 09:00:59 +0900 | [diff] [blame] | 210 | optional int32 duration_ms = 4; |
| 211 | } |
| 212 | |
| 213 | // Represents the generation of an Android Packet Filter program. |
Hugo Benichi | d680d4c | 2016-10-13 13:16:16 +0900 | [diff] [blame] | 214 | // Since version 1. |
Hugo Benichi | 50a84c6 | 2016-09-02 09:00:59 +0900 | [diff] [blame] | 215 | message ApfProgramEvent { |
| 216 | // Lifetime of the program in seconds. |
| 217 | optional int64 lifetime = 1; |
| 218 | |
| 219 | // Number of RAs filtered by the APF program. |
| 220 | optional int32 filtered_ras = 2; |
| 221 | |
| 222 | // Total number of RAs to filter currently tracked by ApfFilter. Can be more |
| 223 | // than filtered_ras if all available program size was exhausted. |
| 224 | optional int32 current_ras = 3; |
| 225 | |
| 226 | // Length of the APF program in bytes. |
| 227 | optional int32 program_length = 4; |
| 228 | |
| 229 | // True if the APF program is dropping multicast and broadcast traffic. |
| 230 | optional bool drop_multicast = 5; |
| 231 | |
| 232 | // True if the interface on which APF runs has an IPv4 address. |
| 233 | optional bool has_ipv4_addr = 6; |
| 234 | } |
| 235 | |
| 236 | // Represents Router Advertisement listening statistics for an interface with |
| 237 | // Android Packet Filter enabled. |
Hugo Benichi | d680d4c | 2016-10-13 13:16:16 +0900 | [diff] [blame] | 238 | // Since version 1. |
Hugo Benichi | 50a84c6 | 2016-09-02 09:00:59 +0900 | [diff] [blame] | 239 | message ApfStatistics { |
| 240 | // The time interval in milliseconds these stastistics cover. |
| 241 | optional int64 duration_ms = 1; |
| 242 | |
| 243 | // The total number of received RAs. |
| 244 | optional int32 received_ras = 2; |
| 245 | |
| 246 | // The total number of received RAs that matched a known RA. |
| 247 | optional int32 matching_ras = 3; |
| 248 | |
| 249 | // The total number of received RAs ignored due to the MAX_RAS limit. |
| 250 | optional int32 dropped_ras = 5; |
| 251 | |
| 252 | // The total number of received RAs with an effective lifetime of 0 seconds. |
| 253 | // Effective lifetime for APF is the minimum of all lifetimes in a RA. |
| 254 | optional int32 zero_lifetime_ras = 6; |
| 255 | |
| 256 | // The total number of received RAs that could not be parsed. |
| 257 | optional int32 parse_errors = 7; |
| 258 | |
| 259 | // The total number of APF program updates triggered by an RA reception. |
| 260 | optional int32 program_updates = 8; |
| 261 | |
| 262 | // The maximum APF program size in byte advertised by hardware. |
| 263 | optional int32 max_program_size = 9; |
| 264 | } |
| 265 | |
| 266 | // Represents the reception of a Router Advertisement packet for an interface |
| 267 | // with Android Packet Filter enabled. |
Hugo Benichi | d680d4c | 2016-10-13 13:16:16 +0900 | [diff] [blame] | 268 | // Since version 1. |
Hugo Benichi | 50a84c6 | 2016-09-02 09:00:59 +0900 | [diff] [blame] | 269 | message RaEvent { |
| 270 | // All lifetime values are expressed in seconds. The default value for an |
| 271 | // option lifetime that was not present in the RA option list is -1. |
| 272 | // The lifetime of an option (e.g., the Prefix Information Option) is the |
| 273 | // minimum lifetime of all such options in the packet. |
| 274 | |
| 275 | // The value of the router lifetime in the RA packet. |
| 276 | optional int64 router_lifetime = 1; |
| 277 | |
| 278 | // Prefix valid lifetime from the prefix information option. |
| 279 | optional int64 prefix_valid_lifetime = 2; |
| 280 | |
| 281 | // Prefix preferred lifetime from the prefix information option. |
| 282 | optional int64 prefix_preferred_lifetime = 3; |
| 283 | |
| 284 | // Route info lifetime. |
| 285 | optional int64 route_info_lifetime = 4; |
| 286 | |
| 287 | // Recursive DNS server lifetime. |
| 288 | optional int64 rdnss_lifetime = 5; |
| 289 | |
| 290 | // DNS search list lifetime. |
| 291 | optional int64 dnssl_lifetime = 6; |
| 292 | } |
| 293 | |
| 294 | // Represents an IP provisioning event in IpManager and how long the |
| 295 | // provisioning action took. |
| 296 | // This message is associated to android.net.metrics.IpManagerEvent. |
| 297 | message IpProvisioningEvent { |
| 298 | // The interface name (wlan, rmnet, lo, ...) on which the probe was sent. |
Hugo Benichi | 4e89a02 | 2017-01-05 17:08:31 +0900 | [diff] [blame^] | 299 | // Deprecated since version 2, to be replaced by link_layer field. |
Hugo Benichi | 807124a | 2016-11-24 11:25:01 +0900 | [diff] [blame] | 300 | optional string if_name = 1 [deprecated = true]; |
Hugo Benichi | 50a84c6 | 2016-09-02 09:00:59 +0900 | [diff] [blame] | 301 | |
| 302 | // The code of the IP provisioning event, represented by constants defined in |
| 303 | // android.net.metrics.IpManagerEvent. |
| 304 | optional int32 event_type = 2; |
| 305 | |
| 306 | // The duration of the provisioning action that resulted in this event. |
| 307 | optional int32 latency_ms = 3; |
| 308 | } |
| 309 | |
| 310 | // Represents one of the IP connectivity event defined in this file. |
Hugo Benichi | 4e89a02 | 2017-01-05 17:08:31 +0900 | [diff] [blame^] | 311 | // Next tag: 16 |
Hugo Benichi | 50a84c6 | 2016-09-02 09:00:59 +0900 | [diff] [blame] | 312 | message IpConnectivityEvent { |
| 313 | // Time in ms when the event was recorded. |
| 314 | optional int64 time_ms = 1; |
| 315 | |
Hugo Benichi | 4e89a02 | 2017-01-05 17:08:31 +0900 | [diff] [blame^] | 316 | // Physical link layer of the network on which the event happened. |
| 317 | // Acts as a dimension key. |
Hugo Benichi | 807124a | 2016-11-24 11:25:01 +0900 | [diff] [blame] | 318 | // Since version 2. |
Hugo Benichi | 4e89a02 | 2017-01-05 17:08:31 +0900 | [diff] [blame^] | 319 | optional LinkLayer link_layer = 15; |
Hugo Benichi | 807124a | 2016-11-24 11:25:01 +0900 | [diff] [blame] | 320 | |
Hugo Benichi | 50a84c6 | 2016-09-02 09:00:59 +0900 | [diff] [blame] | 321 | // Event type. |
| 322 | oneof event { |
| 323 | |
| 324 | // An event about the system default network. |
Hugo Benichi | 4e89a02 | 2017-01-05 17:08:31 +0900 | [diff] [blame^] | 325 | // The link_layer field is not relevant for this event and set to NONE. |
Hugo Benichi | 50a84c6 | 2016-09-02 09:00:59 +0900 | [diff] [blame] | 326 | DefaultNetworkEvent default_network_event = 2; |
| 327 | |
| 328 | // An IP reachability probe event. |
| 329 | IpReachabilityEvent ip_reachability_event = 3; |
| 330 | |
| 331 | // A network lifecycle event. |
| 332 | NetworkEvent network_event = 4; |
| 333 | |
| 334 | // A batch of DNS lookups. |
Hugo Benichi | 4e89a02 | 2017-01-05 17:08:31 +0900 | [diff] [blame^] | 335 | // Deprecated in the nyc-mr2 release since version 2,and replaced by |
| 336 | // dns_latencies. |
Hugo Benichi | 7c3a786 | 2016-11-24 11:34:49 +0900 | [diff] [blame] | 337 | DNSLookupBatch dns_lookup_batch = 5 [deprecated = true]; |
| 338 | |
| 339 | // DNS lookup latency statistics. |
| 340 | DNSLatencies dns_latencies = 13; |
| 341 | |
| 342 | // Connect latency and errno statistics. |
| 343 | ConnectStatistics connect_statistics = 14; |
Hugo Benichi | 50a84c6 | 2016-09-02 09:00:59 +0900 | [diff] [blame] | 344 | |
| 345 | // A DHCP client event or DHCP receive error. |
| 346 | DHCPEvent dhcp_event = 6; |
| 347 | |
| 348 | // An IP provisioning event. |
| 349 | IpProvisioningEvent ip_provisioning_event = 7; |
| 350 | |
| 351 | // A network validation probe event. |
| 352 | ValidationProbeEvent validation_probe_event = 8; |
| 353 | |
| 354 | // An Android Packet Filter program event. |
| 355 | ApfProgramEvent apf_program_event = 9; |
| 356 | |
| 357 | // An Android Packet Filter statistics event. |
| 358 | ApfStatistics apf_statistics = 10; |
| 359 | |
| 360 | // An RA packet reception event. |
| 361 | RaEvent ra_event = 11; |
| 362 | }; |
| 363 | }; |
| 364 | |
| 365 | // The information about IP connectivity events. |
| 366 | message IpConnectivityLog { |
| 367 | // An array of IP connectivity events. |
| 368 | repeated IpConnectivityEvent events = 1; |
| 369 | |
| 370 | // The number of events that had to be dropped due to a full buffer. |
| 371 | optional int32 dropped_events = 2; |
Hugo Benichi | d680d4c | 2016-10-13 13:16:16 +0900 | [diff] [blame] | 372 | |
| 373 | // The version number of the metrics events being collected. |
Hugo Benichi | 807124a | 2016-11-24 11:25:01 +0900 | [diff] [blame] | 374 | // nyc-dev: not populated, implicitly 0. |
| 375 | // nyc-dr1: not populated, implicitly 1 (sailfish and marlin only). |
| 376 | // nyc-mr1: not populated, implicitly 1. |
| 377 | // nyc-mr2: 2. |
Hugo Benichi | d680d4c | 2016-10-13 13:16:16 +0900 | [diff] [blame] | 378 | optional int32 version = 3; |
Hugo Benichi | 50a84c6 | 2016-09-02 09:00:59 +0900 | [diff] [blame] | 379 | }; |