blob: 76c54185a774f51b372b330b012de72169f123c7 [file] [log] [blame]
Hugo Benichi50a84c62016-09-02 09:00:59 +09001// LINT: LEGACY_NAMES
2syntax = "proto2";
3
4package clearcut.connectivity;
5
6option java_package = "com.android.server.connectivity.metrics";
7option 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, ...).
Hugo Benichif6840502017-03-08 11:59:36 +090012// Deprecated since version 3, replaced by top-level network_id field in
13// IpConnectivityEvent.
Hugo Benichi50a84c62016-09-02 09:00:59 +090014message NetworkId {
15 // Every network gets assigned a network_id on creation based on order of
16 // creation. Thus network_id N is assigned to the network created directly
17 // after network N-1. Thus there is no PII involved here. Zero means no
18 // network. The value 0 is never assigned to a network.
19 optional int32 network_id = 1;
20};
21
Hugo Benichi4e89a022017-01-05 17:08:31 +090022// LinkLayer describes a physical link layer technology used by a network.
23// It is not intended to map one to one to the TRANSPORT_* constants defined in
24// android.net.NetworkCapabilities. Instead it is intended to be used as
25// a dimension field for metrics events and aggregated metrics.
26// Next tag: 7
27enum LinkLayer {
28 // An unknown link layer technology.
Hugo Benichi807124a2016-11-24 11:25:01 +090029 UNKNOWN = 0;
Hugo Benichi4e89a022017-01-05 17:08:31 +090030
Hugo Benichi807124a2016-11-24 11:25:01 +090031 BLUETOOTH = 1;
32 CELLULAR = 2;
33 ETHERNET = 3;
34 WIFI = 4;
Hugo Benichi4e89a022017-01-05 17:08:31 +090035
36 // Indicates that the link layer dimension is not relevant for the metrics or
37 // event considered.
38 NONE = 5;
39
40 // Indicates that the metrics or event considered may involve several links.
41 MULTIPLE = 6;
Hugo Benichi807124a2016-11-24 11:25:01 +090042};
43
Hugo Benichi7c3a7862016-11-24 11:34:49 +090044// A pair of (key, value) integers for describing histogram-like statistics.
45message Pair {
46 optional int32 key = 1;
47 optional int32 value = 2;
48};
49
Hugo Benichi50a84c62016-09-02 09:00:59 +090050// Logs changes in the system default network. Changes can be 1) acquiring a
51// default network with no previous default, 2) a switch of the system default
52// network to a new default network, 3) a loss of the system default network.
53// This message is associated to android.net.metrics.DefaultNetworkEvent.
54message DefaultNetworkEvent {
55 // A value of 0 means this is a loss of the system default network.
56 optional NetworkId network_id = 1;
57
58 // A value of 0 means there was no previous default network.
59 optional NetworkId previous_network_id = 2;
60
61 // Whether the network supports IPv4, IPv6, or both.
62 enum IPSupport {
63 NONE = 0;
64 IPV4 = 1;
65 IPV6 = 2;
66 DUAL = 3;
67 };
68
69 // Best available information about IP support of the previous network when
70 // disconnecting or switching to a new default network.
71 optional IPSupport previous_network_ip_support = 3;
72
73 // The transport types of the new default network, represented by
74 // TRANSPORT_* constants as defined in NetworkCapabilities.
75 repeated int32 transport_types = 4;
76};
77
78// Logs IpReachabilityMonitor probe events and NUD_FAILED events.
79// This message is associated to android.net.metrics.IpReachabilityEvent.
80message IpReachabilityEvent {
81 // The interface name (wlan, rmnet, lo, ...) on which the probe was sent.
Hugo Benichi4e89a022017-01-05 17:08:31 +090082 // Deprecated since version 2, to be replaced by link_layer field.
Hugo Benichi807124a2016-11-24 11:25:01 +090083 optional string if_name = 1 [deprecated = true];
Hugo Benichi50a84c62016-09-02 09:00:59 +090084
85 // The event type code of the probe, represented by constants defined in
86 // android.net.metrics.IpReachabilityEvent.
Hugo Benichid680d4c2016-10-13 13:16:16 +090087 // NUD_FAILED_ORGANIC and PROVISIONING_LOST_ORGANIC recorded since version 1.
Hugo Benichi50a84c62016-09-02 09:00:59 +090088 optional int32 event_type = 2;
89};
90
91// Logs NetworkMonitor and ConnectivityService events related to the state of
92// a network: connection, evaluation, validation, lingering, and disconnection.
93// This message is associated to android.net.metrics.NetworkEvent.
94message NetworkEvent {
95 // The id of the network on which this event happened.
Hugo Benichif6840502017-03-08 11:59:36 +090096 // Deprecated since version 3.
97 optional NetworkId network_id = 1 [deprecated = true];
Hugo Benichi50a84c62016-09-02 09:00:59 +090098
99 // The type of network event, represented by NETWORK_* constants defined in
100 // android.net.metrics.NetworkEvent.
101 optional int32 event_type = 2;
102
103 // Only valid after finishing evaluating a network for Internet connectivity.
104 // The time it took for this evaluation to complete.
105 optional int32 latency_ms = 3;
106}
107
108// Logs individual captive portal probing events that are performed when
109// evaluating or reevaluating networks for Internet connectivity.
110// This message is associated to android.net.metrics.ValidationProbeEvent.
111message ValidationProbeEvent {
112 // The id of the network for which the probe was sent.
Hugo Benichif6840502017-03-08 11:59:36 +0900113 // Deprecated since version 3.
114 optional NetworkId network_id = 1 [deprecated = true];
Hugo Benichi50a84c62016-09-02 09:00:59 +0900115
116 // The time it took for that probe to complete or time out.
117 optional int32 latency_ms = 2;
118
119 // The type of portal probe, represented by PROBE_* constants defined in
120 // android.net.metrics.ValidationProbeEvent.
121 optional int32 probe_type = 3;
122
123 // The http code result of the probe test.
124 optional int32 probe_result = 4;
125}
126
127// Logs DNS lookup latencies. Repeated fields must have the same length.
128// This message is associated to android.net.metrics.DnsEvent.
Hugo Benichi7c3a7862016-11-24 11:34:49 +0900129// Deprecated since version 2.
Hugo Benichi50a84c62016-09-02 09:00:59 +0900130message DNSLookupBatch {
131 // The id of the network on which the DNS lookups took place.
132 optional NetworkId network_id = 1;
133
134 // The types of the DNS lookups, as defined in android.net.metrics.DnsEvent.
135 repeated int32 event_types = 2;
136
137 // The return values of the DNS resolver for each DNS lookups.
138 repeated int32 return_codes = 3;
139
140 // The time it took for each DNS lookups to complete.
141 repeated int32 latencies_ms = 4;
142};
143
Hugo Benichi7c3a7862016-11-24 11:34:49 +0900144// Represents a collections of DNS lookup latencies and counters for a
145// particular combination of DNS query type and return code.
146// Since version 2.
147message DNSLatencies {
148 // The type of the DNS lookups, as defined in android.net.metrics.DnsEvent.
149 // Acts as a key for a set of DNS query results.
150 // Possible values are: 0 for getaddrinfo, 1 for gethostbyname.
151 optional int32 type = 1;
152
153 // The return value of the DNS resolver for the DNS lookups.
154 // Acts as a key for a set of DNS query results.
155 // Possible values are: 0 for success, or errno code for failures.
156 optional int32 return_code = 2;
157
158 // The number of query operations recorded.
159 optional int32 query_count = 3;
160
161 // The number of query operations returning A IPv4 records.
162 optional int32 a_count = 4;
163
164 // The number of query operations returning AAAA IPv6 records.
165 optional int32 aaaa_count = 5;
166
167 // The time it took for each DNS lookup to complete. The number of repeated
168 // values can be less than query_count in case of event rate-limiting.
169 repeated int32 latencies_ms = 6;
170};
171
172// Represents latency and errno statistics of the connect() system call.
173// Since version 2.
Hugo Benichif6840502017-03-08 11:59:36 +0900174// Next tag: 7
Hugo Benichi7c3a7862016-11-24 11:34:49 +0900175message ConnectStatistics {
176 // The number of connect() operations recorded.
177 optional int32 connect_count = 1;
178
Hugo Benichif6840502017-03-08 11:59:36 +0900179 // The number of connect() operations done in blocking mode.
180 // Since version 3.
181 optional int32 connect_blocking_count = 5;
182
Hugo Benichi7c3a7862016-11-24 11:34:49 +0900183 // The number of connect() operations with IPv6 socket address.
184 optional int32 ipv6_addr_count = 2;
185
Hugo Benichif6840502017-03-08 11:59:36 +0900186 // The time it took for successful blocking connect() operations to complete
187 // The number of repeated values can be less than connect_blocking_count in
188 // case of event rate-limiting.
Hugo Benichi7c3a7862016-11-24 11:34:49 +0900189 repeated int32 latencies_ms = 3;
190
Hugo Benichif6840502017-03-08 11:59:36 +0900191 // The time it took for successful connect() operation to complete in
192 // non-blocking mode. The number of repeated values can be less than
193 // connect_count - connect_blocking_count in case of event rate-limiting.
194 repeated int32 non_blocking_latencies_ms = 6;
195
Hugo Benichi7c3a7862016-11-24 11:34:49 +0900196 // Counts of all error values returned by failed connect() operations.
197 // The Pair key field is the errno code. The Pair value field is the count
198 // for that errno code.
199 repeated Pair errnos_counters = 4;
200};
201
Hugo Benichi50a84c62016-09-02 09:00:59 +0900202// Represents a DHCP event on a single interface, which can be a DHCPClient
203// state transition or a response packet parsing error.
204// This message is associated to android.net.metrics.DhcpClientEvent and
205// android.net.metrics.DhcpErrorEvent.
206message DHCPEvent {
207 // The interface name (wlan, rmnet, lo, ...) on which the event happened.
Hugo Benichi4e89a022017-01-05 17:08:31 +0900208 // Deprecated since version 2, to be replaced by link_layer field.
Hugo Benichi807124a2016-11-24 11:25:01 +0900209 optional string if_name = 1 [deprecated = true];
Hugo Benichi50a84c62016-09-02 09:00:59 +0900210
211 oneof value {
212 // The name of a state in the DhcpClient state machine, represented by
213 // the inner classes of android.net.dhcp.DhcpClient.
214 string state_transition = 2;
215
216 // The error code of a DHCP error, represented by constants defined in
217 // android.net.metrics.DhcpErrorEvent.
218 int32 error_code = 3;
219 }
220
221 // Lifetime duration in milliseconds of a DhcpClient state, or transition
222 // time in milliseconds between specific pairs of DhcpClient's states.
Hugo Benichid680d4c2016-10-13 13:16:16 +0900223 // Only populated since version 1, when state_transition is populated.
Hugo Benichi50a84c62016-09-02 09:00:59 +0900224 optional int32 duration_ms = 4;
225}
226
227// Represents the generation of an Android Packet Filter program.
Hugo Benichid680d4c2016-10-13 13:16:16 +0900228// Since version 1.
Hugo Benichif6840502017-03-08 11:59:36 +0900229// Next tag: 8
Hugo Benichi50a84c62016-09-02 09:00:59 +0900230message ApfProgramEvent {
Hugo Benichif6840502017-03-08 11:59:36 +0900231 // Maximum lifetime of the program in seconds.
Hugo Benichi50a84c62016-09-02 09:00:59 +0900232 optional int64 lifetime = 1;
233
Hugo Benichif6840502017-03-08 11:59:36 +0900234 // Effective lifetime of the program in seconds from the time the
235 // program was installed to the time it was replaced or removed.
236 optional int64 effective_lifetime = 7;
237
Hugo Benichi50a84c62016-09-02 09:00:59 +0900238 // Number of RAs filtered by the APF program.
239 optional int32 filtered_ras = 2;
240
241 // Total number of RAs to filter currently tracked by ApfFilter. Can be more
242 // than filtered_ras if all available program size was exhausted.
243 optional int32 current_ras = 3;
244
245 // Length of the APF program in bytes.
246 optional int32 program_length = 4;
247
248 // True if the APF program is dropping multicast and broadcast traffic.
249 optional bool drop_multicast = 5;
250
251 // True if the interface on which APF runs has an IPv4 address.
252 optional bool has_ipv4_addr = 6;
253}
254
255// Represents Router Advertisement listening statistics for an interface with
256// Android Packet Filter enabled.
Hugo Benichid680d4c2016-10-13 13:16:16 +0900257// Since version 1.
Hugo Benichif6840502017-03-08 11:59:36 +0900258// Next tag: 12
Hugo Benichi50a84c62016-09-02 09:00:59 +0900259message ApfStatistics {
260 // The time interval in milliseconds these stastistics cover.
261 optional int64 duration_ms = 1;
262
263 // The total number of received RAs.
264 optional int32 received_ras = 2;
265
266 // The total number of received RAs that matched a known RA.
267 optional int32 matching_ras = 3;
268
269 // The total number of received RAs ignored due to the MAX_RAS limit.
270 optional int32 dropped_ras = 5;
271
272 // The total number of received RAs with an effective lifetime of 0 seconds.
273 // Effective lifetime for APF is the minimum of all lifetimes in a RA.
274 optional int32 zero_lifetime_ras = 6;
275
276 // The total number of received RAs that could not be parsed.
277 optional int32 parse_errors = 7;
278
279 // The total number of APF program updates triggered by an RA reception.
280 optional int32 program_updates = 8;
281
282 // The maximum APF program size in byte advertised by hardware.
283 optional int32 max_program_size = 9;
Hugo Benichif6840502017-03-08 11:59:36 +0900284
285 // The total number of successful APF program updates triggered by any state
286 // change in ApfFilter. Since version 3.
287 optional int32 program_updates_all = 10;
288
289 // The total number of APF program updates triggered when disabling the
290 // multicast filter. Since version 3.
291 optional int32 program_updates_allowing_multicast = 11;
Hugo Benichi50a84c62016-09-02 09:00:59 +0900292}
293
294// Represents the reception of a Router Advertisement packet for an interface
295// with Android Packet Filter enabled.
Hugo Benichid680d4c2016-10-13 13:16:16 +0900296// Since version 1.
Hugo Benichi50a84c62016-09-02 09:00:59 +0900297message RaEvent {
298 // All lifetime values are expressed in seconds. The default value for an
299 // option lifetime that was not present in the RA option list is -1.
300 // The lifetime of an option (e.g., the Prefix Information Option) is the
301 // minimum lifetime of all such options in the packet.
302
303 // The value of the router lifetime in the RA packet.
304 optional int64 router_lifetime = 1;
305
306 // Prefix valid lifetime from the prefix information option.
307 optional int64 prefix_valid_lifetime = 2;
308
309 // Prefix preferred lifetime from the prefix information option.
310 optional int64 prefix_preferred_lifetime = 3;
311
312 // Route info lifetime.
313 optional int64 route_info_lifetime = 4;
314
315 // Recursive DNS server lifetime.
316 optional int64 rdnss_lifetime = 5;
317
318 // DNS search list lifetime.
319 optional int64 dnssl_lifetime = 6;
320}
321
322// Represents an IP provisioning event in IpManager and how long the
323// provisioning action took.
324// This message is associated to android.net.metrics.IpManagerEvent.
325message IpProvisioningEvent {
326 // The interface name (wlan, rmnet, lo, ...) on which the probe was sent.
Hugo Benichi4e89a022017-01-05 17:08:31 +0900327 // Deprecated since version 2, to be replaced by link_layer field.
Hugo Benichi807124a2016-11-24 11:25:01 +0900328 optional string if_name = 1 [deprecated = true];
Hugo Benichi50a84c62016-09-02 09:00:59 +0900329
330 // The code of the IP provisioning event, represented by constants defined in
331 // android.net.metrics.IpManagerEvent.
332 optional int32 event_type = 2;
333
334 // The duration of the provisioning action that resulted in this event.
335 optional int32 latency_ms = 3;
336}
337
338// Represents one of the IP connectivity event defined in this file.
Hugo Benichif6840502017-03-08 11:59:36 +0900339// Next tag: 19
Hugo Benichi50a84c62016-09-02 09:00:59 +0900340message IpConnectivityEvent {
341 // Time in ms when the event was recorded.
342 optional int64 time_ms = 1;
343
Hugo Benichi4e89a022017-01-05 17:08:31 +0900344 // Physical link layer of the network on which the event happened.
345 // Acts as a dimension key.
Hugo Benichi807124a2016-11-24 11:25:01 +0900346 // Since version 2.
Hugo Benichi4e89a022017-01-05 17:08:31 +0900347 optional LinkLayer link_layer = 15;
Hugo Benichi807124a2016-11-24 11:25:01 +0900348
Hugo Benichif6840502017-03-08 11:59:36 +0900349 // Represents the id given by the system to a physical network on the device.
350 // Every network gets assigned a unique id on creation from a monotonic
351 // counter. The value 0 is never assigned to a network and means no network.
352 // It is used to correlate different types of events to each other for devices
353 // with multiple networks (WiFi, 4G, ...).
354 // Since version 3.
355 optional int32 network_id = 16;
356
357 // The interface name (wlan, rmnet, lo, ...) on which the event happened.
358 // Present if the link_layer field was not inferred from the if_name on
359 // the device, so that post-processing of the serialized proto can backfill
360 // link_layer. Since version 3.
361 optional string if_name = 17;
362
363 // The transport types of the network on which the event happened, expressed
364 // as a bit field of TRANSPORT_* constants as defined in NetworkCapabilities.
365 // Present if the link_layer field was not inferred from the transport types,
366 // so that post-processing of the serialized proto can backfill link_layer
367 // Since version 3.
368 optional int64 transports = 18;
369
Hugo Benichi50a84c62016-09-02 09:00:59 +0900370 oneof event {
371
372 // An event about the system default network.
Hugo Benichi4e89a022017-01-05 17:08:31 +0900373 // The link_layer field is not relevant for this event and set to NONE.
Hugo Benichi50a84c62016-09-02 09:00:59 +0900374 DefaultNetworkEvent default_network_event = 2;
375
376 // An IP reachability probe event.
377 IpReachabilityEvent ip_reachability_event = 3;
378
379 // A network lifecycle event.
380 NetworkEvent network_event = 4;
381
382 // A batch of DNS lookups.
Hugo Benichi4e89a022017-01-05 17:08:31 +0900383 // Deprecated in the nyc-mr2 release since version 2,and replaced by
384 // dns_latencies.
Hugo Benichi7c3a7862016-11-24 11:34:49 +0900385 DNSLookupBatch dns_lookup_batch = 5 [deprecated = true];
386
387 // DNS lookup latency statistics.
388 DNSLatencies dns_latencies = 13;
389
390 // Connect latency and errno statistics.
391 ConnectStatistics connect_statistics = 14;
Hugo Benichi50a84c62016-09-02 09:00:59 +0900392
393 // A DHCP client event or DHCP receive error.
394 DHCPEvent dhcp_event = 6;
395
396 // An IP provisioning event.
397 IpProvisioningEvent ip_provisioning_event = 7;
398
399 // A network validation probe event.
400 ValidationProbeEvent validation_probe_event = 8;
401
402 // An Android Packet Filter program event.
403 ApfProgramEvent apf_program_event = 9;
404
405 // An Android Packet Filter statistics event.
406 ApfStatistics apf_statistics = 10;
407
408 // An RA packet reception event.
409 RaEvent ra_event = 11;
410 };
411};
412
413// The information about IP connectivity events.
414message IpConnectivityLog {
415 // An array of IP connectivity events.
416 repeated IpConnectivityEvent events = 1;
417
418 // The number of events that had to be dropped due to a full buffer.
419 optional int32 dropped_events = 2;
Hugo Benichid680d4c2016-10-13 13:16:16 +0900420
421 // The version number of the metrics events being collected.
Hugo Benichif6840502017-03-08 11:59:36 +0900422 // nyc: not populated, implicitly 0.
Hugo Benichi807124a2016-11-24 11:25:01 +0900423 // nyc-dr1: not populated, implicitly 1 (sailfish and marlin only).
424 // nyc-mr1: not populated, implicitly 1.
425 // nyc-mr2: 2.
Hugo Benichif6840502017-03-08 11:59:36 +0900426 // oc: 3.
Hugo Benichid680d4c2016-10-13 13:16:16 +0900427 optional int32 version = 3;
Hugo Benichi50a84c62016-09-02 09:00:59 +0900428};