• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 *  Copyright (c) 2023, The OpenThread Authors.
3 *  All rights reserved.
4 *
5 *  Redistribution and use in source and binary forms, with or without
6 *  modification, are permitted provided that the following conditions are met:
7 *  1. Redistributions of source code must retain the above copyright
8 *     notice, this list of conditions and the following disclaimer.
9 *  2. Redistributions in binary form must reproduce the above copyright
10 *     notice, this list of conditions and the following disclaimer in the
11 *     documentation and/or other materials provided with the distribution.
12 *  3. Neither the name of the copyright holder nor the
13 *     names of its contributors may be used to endorse or promote products
14 *     derived from this software without specific prior written permission.
15 *
16 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20 *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 *  POSSIBILITY OF SUCH DAMAGE.
27 */
28syntax = "proto2";
29option optimize_for = LITE_RUNTIME;
30
31package threadnetwork;
32
33// Thread Telemetry data definition.
34// The field range for your data definition is determined as:
35// ---------------------------------------------------------------------------
36// | Field Range  | Logging From
37// | [1 - 500)    | Primary fields logged from OTBR-agent/OpenThread.
38// | [500-600)    | OTBR vendor fields logged from OTBR-agent/OpenThread.
39// | Other        | Reserved for now.
40// ---------------------------------------------------------------------------
41// Usage:
42// Delete field: do not directly delete field. Deprecate it instead.
43message TelemetryData {
44  message Duration {
45    // Signed seconds of the span of time. Must be from -315,576,000,000
46    // to +315,576,000,000 inclusive. Note: these bounds are computed from:
47    // 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
48    optional int64 seconds = 1;
49
50    // Signed fractions of a second at nanosecond resolution of the span
51    // of time. Durations less than one second are represented with a 0
52    // `seconds` field and a positive or negative `nanos` field. For durations
53    // of one second or more, a non-zero value for the `nanos` field must be
54    // of the same sign as the `seconds` field. Must be from -999,999,999
55    // to +999,999,999 inclusive.
56    optional int32 nanos = 2;
57  }
58
59  message WpanStats {
60    optional int32 phy_rx = 1;
61    optional int32 phy_tx = 2;
62    optional int32 mac_unicast_rx = 3;
63    optional int32 mac_unicast_tx = 4;
64    optional int32 mac_broadcast_rx = 5;
65    optional int32 mac_broadcast_tx = 6;
66    optional int32 mac_tx_ack_req = 7;
67    optional int32 mac_tx_no_ack_req = 8;
68    optional int32 mac_tx_acked = 9;
69    optional int32 mac_tx_data = 10;
70    optional int32 mac_tx_data_poll = 11;
71    optional int32 mac_tx_beacon = 12;
72    optional int32 mac_tx_beacon_req = 13;
73    optional int32 mac_tx_other_pkt = 14;
74    optional int32 mac_tx_retry = 15;
75    optional int32 mac_rx_data = 16;
76    optional int32 mac_rx_data_poll = 17;
77    optional int32 mac_rx_beacon = 18;
78    optional int32 mac_rx_beacon_req = 19;
79    optional int32 mac_rx_other_pkt = 20;
80    optional int32 mac_rx_filter_whitelist = 21;
81    optional int32 mac_rx_filter_dest_addr = 22;
82    optional int32 mac_tx_fail_cca = 23;
83    optional int32 mac_rx_fail_decrypt = 24;
84    optional int32 mac_rx_fail_no_frame = 25;
85    optional int32 mac_rx_fail_unknown_neighbor = 26;
86    optional int32 mac_rx_fail_invalid_src_addr = 27;
87    optional int32 mac_rx_fail_fcs = 28;
88    optional int32 mac_rx_fail_other = 29;
89    optional int32 ip_tx_success = 30;
90    optional int32 ip_rx_success = 31;
91    optional int32 ip_tx_failure = 32;
92    optional int32 ip_rx_failure = 33;
93    optional uint32 node_type = 34;
94    optional uint32 channel = 35;
95    optional int32 radio_tx_power = 36;
96    optional float mac_cca_fail_rate = 37;
97  }
98
99  message WpanTopoFull {
100    optional uint32 rloc16 = 1;
101    optional uint32 router_id = 2;
102    optional uint32 leader_router_id = 3;
103    // Deprecate bytes ext_address.
104    reserved 4;
105    optional bytes leader_address = 5;
106    optional uint32 leader_weight = 6;
107    optional uint32 leader_local_weight = 7;
108    optional bytes network_data = 8;
109    optional uint32 network_data_version = 9;
110    optional bytes stable_network_data = 10;
111    optional uint32 stable_network_data_version = 11;
112    optional uint32 preferred_router_id = 12;
113    optional uint32 partition_id = 13;
114    optional uint32 child_table_size = 14;
115    optional uint32 neighbor_table_size = 15;
116    optional int32 instant_rssi = 16;
117    optional uint64 extended_pan_id = 17;
118  }
119
120  message TopoEntry {
121    // deprecate bytes ext_address.
122    reserved 1;
123    optional uint32 rloc16 = 2;
124    // link quality with data range: 0~3.
125    optional uint32 link_quality_in = 3;
126    // the most recent RSSI measurement (8 bit).
127    optional int32 average_rssi = 4;
128    optional Duration age = 5;
129    optional bool rx_on_when_idle = 6;
130    optional bool full_function = 7;
131    optional bool secure_data_request = 8;
132    optional bool full_network_data = 9;
133    optional int32 last_rssi = 10;
134    optional uint32 link_frame_counter = 11;
135    optional uint32 mle_frame_counter = 12;
136    optional bool is_child = 13;
137    optional Duration timeout = 14;
138    optional uint32 network_data_version = 15;
139    optional float mac_frame_error_rate = 16;
140    optional float ip_message_error_rate = 17;
141    optional int32 version = 18;
142  }
143
144  enum NodeType {
145    NODE_TYPE_UNSPECIFIED = 0;
146    NODE_TYPE_ROUTER = 1;
147    NODE_TYPE_END = 2;
148    NODE_TYPE_SLEEPY_END = 3;
149    NODE_TYPE_MINIMAL_END = 4;
150
151    NODE_TYPE_OFFLINE = 5;
152    NODE_TYPE_DISABLED = 6;
153    NODE_TYPE_DETACHED = 7;
154
155    NODE_TYPE_NL_LURKER = 0x10;
156    NODE_TYPE_COMMISSIONER = 0x20;
157    NODE_TYPE_LEADER = 0x40;
158  }
159
160  message PacketsAndBytes {
161    optional int64 packet_count = 1;
162    optional int64 byte_count = 2;
163  }
164
165  message Nat64TrafficCounters {
166    optional int64 ipv4_to_ipv6_packets = 1;
167    optional int64 ipv4_to_ipv6_bytes = 2;
168    optional int64 ipv6_to_ipv4_packets = 3;
169    optional int64 ipv6_to_ipv4_bytes = 4;
170  }
171
172  message Nat64ProtocolCounters {
173    optional Nat64TrafficCounters tcp = 1;
174    optional Nat64TrafficCounters udp = 2;
175    optional Nat64TrafficCounters icmp = 3;
176  }
177
178  message Nat64PacketCounters {
179    optional int64 ipv4_to_ipv6_packets = 1;
180    optional int64 ipv6_to_ipv4_packets = 2;
181  }
182
183  message Nat64ErrorCounters {
184    optional Nat64PacketCounters unknown = 1;
185    optional Nat64PacketCounters illegal_packet = 2;
186    optional Nat64PacketCounters unsupported_protocol = 3;
187    optional Nat64PacketCounters no_mapping = 4;
188  }
189
190  message BorderRoutingCounters {
191    reserved 1 to 8;
192    // The number of Router Advertisement packets received by otbr-agent on the
193    // infra link
194    optional int64 ra_rx = 9;
195
196    // The number of Router Advertisement packets successfully transmitted by
197    // otbr-agent on the infra link.
198    optional int64 ra_tx_success = 10;
199
200    // The number of Router Advertisement packets failed to transmit by
201    // otbr-agent on the infra link.
202    optional int64 ra_tx_failure = 11;
203
204    // The number of Router Solicitation packets received by otbr-agent on the
205    // infra link
206    optional int64 rs_rx = 12;
207
208    // The number of Router Solicitation packets successfully transmitted by
209    // otbr-agent on the infra link.
210    optional int64 rs_tx_success = 13;
211
212    // The number of Router Solicitation packets failed to transmit by
213    // otbr-agent on the infra link.
214    optional int64 rs_tx_failure = 14;
215
216    // The counters for inbound unicast packets
217    optional PacketsAndBytes inbound_unicast = 15;
218
219    // The counters for inbound multicast packets
220    optional PacketsAndBytes inbound_multicast = 16;
221
222    // The counters for outbound unicast packets
223    optional PacketsAndBytes outbound_unicast = 17;
224
225    // The counters for outbound multicast packets
226    optional PacketsAndBytes outbound_multicast = 18;
227
228    // The inbound and outbound NAT64 traffic through the border router
229    optional Nat64ProtocolCounters nat64_protocol_counters = 19;
230
231    // Error counters for NAT64 translator on the border router
232    optional Nat64ErrorCounters nat64_error_counters = 20;
233
234    // The counter for inbound Internet when DHCPv6 PD enabled
235    optional PacketsAndBytes inbound_internet = 21;
236
237    // The counter for outbound Internet when DHCPv6 PD enabled
238    optional PacketsAndBytes outbound_internet = 22;
239  }
240
241  enum Dhcp6PdState {
242    DHCP6_PD_STATE_UNSPECIFIED = 0;
243
244    // DHCPv6 PD is disabled on the border router.
245    DHCP6_PD_STATE_DISABLED = 1;
246
247    // DHCPv6 PD is enabled but won't try to request and publish a prefix.
248    DHCP6_PD_STATE_STOPPED = 2;
249
250    // DHCPv6 PD is enabled and will try to request and publish a prefix.
251    DHCP6_PD_STATE_RUNNING = 3;
252  }
253
254  message PdProcessedRaInfo {
255    // The number of platform generated RA handled by ApplyPlatfromGeneratedRa.
256    optional uint32 num_platform_ra_received = 1;
257
258    // The number of PIO processed for adding OMR prefixes.
259    optional uint32 num_platform_pio_processed = 2;
260
261    // The timestamp of last processed RA message.
262    optional uint32 last_platform_ra_msec = 3;
263  }
264
265  message SrpServerRegistrationInfo {
266    // The number of active hosts/services registered on the SRP server.
267    optional uint32 fresh_count = 1;
268
269    // The number of hosts/services in 'Deleted' state on the SRP server.
270    optional uint32 deleted_count = 2;
271
272    // The sum of lease time in milliseconds of all active hosts/services on the
273    // SRP server.
274    optional uint64 lease_time_total_ms = 3;
275
276    // The sum of key lease time in milliseconds of all active hosts/services on
277    // the SRP server.
278    optional uint64 key_lease_time_total_ms = 4;
279
280    // The sum of remaining lease time in milliseconds of all active
281    // hosts/services on the SRP server.
282    optional uint64 remaining_lease_time_total_ms = 5;
283
284    // The sum of remaining key lease time in milliseconds of all active
285    // hosts/services on the SRP server.
286    optional uint64 remaining_key_lease_time_total_ms = 6;
287  }
288
289  message SrpServerResponseCounters {
290    // The number of successful responses
291    optional uint32 success_count = 1;
292
293    // The number of server failure responses
294    optional uint32 server_failure_count = 2;
295
296    // The number of format error responses
297    optional uint32 format_error_count = 3;
298
299    // The number of 'name exists' responses
300    optional uint32 name_exists_count = 4;
301
302    // The number of refused responses
303    optional uint32 refused_count = 5;
304
305    // The number of other responses
306    optional uint32 other_count = 6;
307  }
308
309  enum SrpServerState {
310    SRP_SERVER_STATE_UNSPECIFIED = 0;
311    SRP_SERVER_STATE_DISABLED = 1;
312    SRP_SERVER_STATE_RUNNING = 2;
313    SRP_SERVER_STATE_STOPPED = 3;
314  }
315
316  // The address mode used by the SRP server
317  enum SrpServerAddressMode {
318    SRP_SERVER_ADDRESS_MODE_UNSPECIFIED = 0;
319    SRP_SERVER_ADDRESS_MODE_UNICAST = 1;
320    SRP_SERVER_ADDRESS_MODE_STATE_ANYCAST = 2;
321  }
322
323  enum UpstreamDnsQueryState {
324    UPSTREAMDNS_QUERY_STATE_UNSPECIFIED = 0;
325    UPSTREAMDNS_QUERY_STATE_ENABLED = 1;
326    UPSTREAMDNS_QUERY_STATE_DISABLED = 2;
327  }
328
329  message SrpServerInfo {
330    // The state of the SRP server
331    optional SrpServerState state = 1;
332
333    // Listening port number
334    optional uint32 port = 2;
335    // The address mode {unicast, anycast} of the SRP server
336    optional SrpServerAddressMode address_mode = 3;
337
338    // The registration information of hosts on the SRP server
339    optional SrpServerRegistrationInfo hosts = 4;
340
341    // The registration information of services on the SRP server
342    optional SrpServerRegistrationInfo services = 5;
343
344    // The counters of response codes sent by the SRP server
345    optional SrpServerResponseCounters response_counters = 6;
346  }
347
348  message TrelPacketCounters {
349    // The number of packets successfully transmitted through TREL
350    optional uint64 trel_tx_packets = 1;
351
352    // The number of bytes successfully transmitted through TREL
353    optional uint64 trel_tx_bytes = 2;
354
355    // The number of packet transmission failures through TREL
356    optional uint64 trel_tx_packets_failed = 3;
357
358    // The number of packets successfully received through TREL
359    optional uint64 tre_rx_packets = 4;
360
361    // The number of bytes successfully received through TREL
362    optional uint64 trel_rx_bytes = 5;
363  }
364
365  message TrelInfo {
366    // Whether TREL is enabled.
367    optional bool is_trel_enabled = 1;
368
369    // The number of TREL peers.
370    optional uint32 num_trel_peers = 2;
371
372    // TREL packet counters
373    optional TrelPacketCounters counters = 3;
374  }
375
376  message DnsServerResponseCounters {
377    // The number of successful responses
378    optional uint32 success_count = 1;
379
380    // The number of server failure responses
381    optional uint32 server_failure_count = 2;
382
383    // The number of format error responses
384    optional uint32 format_error_count = 3;
385
386    // The number of name error responses
387    optional uint32 name_error_count = 4;
388
389    // The number of 'not implemented' responses
390    optional uint32 not_implemented_count = 5;
391
392    // The number of other responses
393    optional uint32 other_count = 6;
394
395    // The number of queries handled by Upstream DNS server.
396    optional uint32 upstream_dns_queries = 7;
397
398    // The number of responses handled by Upstream DNS server.
399    optional uint32 upstream_dns_responses = 8;
400
401    // The number of upstream DNS failures.
402    optional uint32 upstream_dns_failures = 9;
403  }
404
405  message DnsServerInfo {
406    // The counters of response codes sent by the DNS server
407    optional DnsServerResponseCounters response_counters = 1;
408
409    // The number of DNS queries resolved at the local SRP server
410    optional uint32 resolved_by_local_srp_count = 2;
411
412    // The state of upstream DNS query
413    optional UpstreamDnsQueryState upstream_dns_query_state = 3;
414  }
415
416  message MdnsResponseCounters {
417    // The number of successful responses
418    optional uint32 success_count = 1;
419
420    // The number of 'not found' responses
421    optional uint32 not_found_count = 2;
422
423    // The number of 'invalid arg' responses
424    optional uint32 invalid_args_count = 3;
425
426    // The number of 'duplicated' responses
427    optional uint32 duplicated_count = 4;
428
429    // The number of 'not implemented' responses
430    optional uint32 not_implemented_count = 5;
431
432    // The number of unknown error responses
433    optional uint32 unknown_error_count = 6;
434
435    // The number of aborted responses
436    optional uint32 aborted_count = 7;
437
438    // The number of invalid state responses
439    optional uint32 invalid_state_count = 8;
440  }
441
442  message MdnsInfo {
443    // The response counters of host registrations
444    optional MdnsResponseCounters host_registration_responses = 1;
445
446    // The response counters of service registrations
447    optional MdnsResponseCounters service_registration_responses = 2;
448
449    // The response counters of host resolutions
450    optional MdnsResponseCounters host_resolution_responses = 3;
451
452    // The response counters of service resolutions
453    optional MdnsResponseCounters service_resolution_responses = 4;
454
455    // The EMA (Exponential Moving Average) latencies of mDNS operations
456
457    // The EMA latency of host registrations in milliseconds
458    optional uint32 host_registration_ema_latency_ms = 5;
459
460    // The EMA latency of service registrations in milliseconds
461    optional uint32 service_registration_ema_latency_ms = 6;
462
463    // The EMA latency of host resolutions in milliseconds
464    optional uint32 host_resolution_ema_latency_ms = 7;
465
466    // The EMA latency of service resolutions in milliseconds
467    optional uint32 service_resolution_ema_latency_ms = 8;
468  }
469
470  enum Nat64State {
471    NAT64_STATE_UNSPECIFIED = 0;
472    NAT64_STATE_DISABLED = 1;
473    NAT64_STATE_NOT_RUNNING = 2;
474    NAT64_STATE_IDLE = 3;
475    NAT64_STATE_ACTIVE = 4;
476  }
477
478  message BorderRoutingNat64State {
479    optional Nat64State prefix_manager_state = 1;
480    optional Nat64State translator_state = 2;
481  }
482
483  message Nat64Mapping {
484    optional uint64 mapping_id = 1;
485    optional bytes hashed_ipv6_address = 2;
486    optional Nat64ProtocolCounters counters = 3;
487  }
488
489  message WpanBorderRouter {
490    // Border routing counters
491    optional BorderRoutingCounters border_routing_counters = 1;
492
493    // Information about the SRP server
494    optional SrpServerInfo srp_server = 2;
495
496    // Information about the DNS server
497    optional DnsServerInfo dns_server = 3;
498
499    // Information about the mDNS publisher
500    optional MdnsInfo mdns = 4;
501
502    // TODO(b/285457467): remove this reserved proto field.
503    reserved 5;
504
505    // Information about the state of components of NAT64
506    optional BorderRoutingNat64State nat64_state = 6;
507
508    // Information about the mappings of NAT64 translator
509    repeated Nat64Mapping nat64_mappings = 7;
510
511    // DHCPv6 PD state
512    optional Dhcp6PdState dhcp6_pd_state = 8;
513
514    // DHCPv6 PD prefix
515    optional bytes hashed_pd_prefix = 9;
516
517    // DHCPv6 PD processed RA Info
518    optional PdProcessedRaInfo pd_processed_ra_info= 10;
519
520    // Information about TREL.
521    optional TrelInfo trel_info = 11;
522  }
523
524  message RcpStabilityStatistics {
525    optional uint32 rcp_timeout_count = 1;
526    optional uint32 rcp_reset_count = 2;
527    optional uint32 rcp_restoration_count = 3;
528    optional uint32 spinel_parse_error_count = 4;
529    optional int32 rcp_firmware_update_count = 5;
530    optional uint32 thread_stack_uptime = 6;
531  }
532
533  message RcpInterfaceStatistics {
534    optional uint32 rcp_interface_type = 1;
535    optional uint64 transferred_frames_count = 2;
536    optional uint64 transferred_valid_frames_count = 3;
537    optional uint64 transferred_garbage_frames_count = 4;
538    optional uint64 rx_frames_count = 5;
539    optional uint64 rx_bytes_count = 6;
540    optional uint64 tx_frames_count = 7;
541    optional uint64 tx_bytes_count = 8;
542  }
543
544  message WpanRcp {
545    optional RcpStabilityStatistics rcp_stability_statistics = 1;
546    optional RcpInterfaceStatistics rcp_interface_statistics = 2;
547  }
548
549  message CoexMetrics {
550    // Use uint32 instead of int64 to save space for payload, and align with the
551    // raw data size.
552    optional uint32 count_tx_request = 1;
553    optional uint32 count_tx_grant_immediate = 2;
554    optional uint32 count_tx_grant_wait = 3;
555    optional uint32 count_tx_grant_wait_activated = 4;
556    optional uint32 count_tx_grant_wait_timeout = 5;
557    optional uint32 count_tx_grant_deactivated_during_request = 6;
558    optional uint32 tx_average_request_to_grant_time_us = 7;
559    optional uint32 count_rx_request = 8;
560    optional uint32 count_rx_grant_immediate = 9;
561    optional uint32 count_rx_grant_wait = 10;
562    optional uint32 count_rx_grant_wait_activated = 11;
563    optional uint32 count_rx_grant_wait_timeout = 12;
564    optional uint32 count_rx_grant_deactivated_during_request = 13;
565    optional uint32 count_rx_grant_none = 14;
566    optional uint32 rx_average_request_to_grant_time_us = 15;
567  }
568
569  message LinkMetricsEntry {
570    optional int32 link_margin = 1;
571    optional int32 rssi = 2;
572  }
573
574  message LowPowerMetrics {
575    repeated LinkMetricsEntry link_metrics_entries = 1;
576  }
577
578  optional WpanStats wpan_stats = 1;
579  optional WpanTopoFull wpan_topo_full = 2;
580  repeated TopoEntry topo_entries = 3;
581  optional WpanBorderRouter wpan_border_router = 4;
582  optional WpanRcp wpan_rcp = 5;
583  // Deprecate CoexMetrics with int64 as its fields types to save storage.
584  reserved 6;
585  optional CoexMetrics coex_metrics = 7;
586  optional LowPowerMetrics low_power_metrics = 8;
587}
588