1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
use iroh_metrics::{Counter, MetricsGroup};
use serde::{Deserialize, Serialize};
/// Metrics collected by the iroh socket.
#[derive(Debug, Serialize, Deserialize, MetricsGroup)]
#[non_exhaustive]
#[metrics(name = "socket", default)]
pub struct Metrics {
/// Intended to count updates to the local direct address set, but currently unused
/// (never incremented).
pub update_direct_addrs: Counter,
/// Number of bytes sent over IPv4.
pub send_ipv4: Counter,
/// Number of bytes sent over IPv6.
pub send_ipv6: Counter,
/// Number of bytes sent over the relay transport.
pub send_relay: Counter,
/// Number of datagrams dropped because the send queue of a relay connection was full.
pub send_relay_queue_full: Counter,
/// Number of data bytes received over the relay transport.
pub recv_data_relay: Counter,
/// Number of data bytes received over any custom transport.
pub recv_data_custom: Counter,
/// Number of data bytes received over IPv4.
pub recv_data_ipv4: Counter,
/// Number of data bytes received over IPv6.
pub recv_data_ipv6: Counter,
/// Number of QUIC datagrams received.
pub recv_datagrams: Counter,
/// Number of receive events that used GRO (coalesced datagram batches).
///
/// This counts batches, not the individual datagrams within them. See
/// [`Self::recv_datagrams`] for the datagram count.
pub recv_gro_datagrams: Counter,
/// Number of times the home relay changed to a different relay.
///
/// This includes the initial assignment from no home relay to a home relay.
pub relay_home_change: Counter,
/// Number of connections to a relay server that were established.
///
/// Failed dial attempts are not counted. A relay that is reconnected to is counted
/// once per connection, so this grows on every reconnect.
pub relay_conns_success: Counter,
/// Number of failed attempts to connect to a relay server.
///
/// Each attempt is counted, so an unreachable relay increments this on every retry.
pub relay_conns_failed: Counter,
/// Number of connections to a relay server that ended.
///
/// Paired with [`Self::relay_conns_success`], so the number of current connections is
/// `relay_conns_success` - `relay_conns_closed`.
pub relay_conns_closed: Counter,
/// Number of relay connections on which the relay reported rate limiting.
///
/// This is incremented at most once per connection, so it counts the affected
/// connections and not how often the relay reported the problem. Relate it to
/// [`Self::relay_conns_success`] to see how many connections were affected.
pub relay_conns_ratelimited: Counter,
/*
* Holepunching metrics
*/
/// The number of times holepunching is initiated on a connection.
///
/// This can be incremented multiple times for a single connection. Note that only the
/// client-side of a connection will increment this counter.
pub holepunch_attempts: Counter,
/// The number of network paths to peers that are direct.
///
/// This can be incremented multiple times for a single connection.
pub paths_direct: Counter,
/// The number of network paths to peers that are relayed.
///
/// This would typically only be incremented once for a single connection.
pub paths_relay: Counter,
/// The number of network paths to peers that are user defined.
///
/// This would typically only be incremented once for a single connection.
pub paths_custom: Counter,
/// The number of connections that have been direct connections.
///
/// This is only incremented once for each opened connection. See `num_conns_opened` for
/// the number of opened connections.
pub num_conns_direct: Counter,
/*
* Connection Metrics
*
* These all only count connections that completed the TLS handshake successfully. This means
* that short lived 0RTT connections are potentially not included in these counts.
*/
/// Number of connections opened (only handshaked connections are counted).
pub num_conns_opened: Counter,
/// Number of connections closed (only handshaked connections are counted).
pub num_conns_closed: Counter,
/// Number of IP transport paths opened.
pub transport_ip_paths_added: Counter,
/// Number of IP transport paths closed.
pub transport_ip_paths_removed: Counter,
/// Number of relay transport paths opened.
pub transport_relay_paths_added: Counter,
/// Number of relay transport paths closed.
pub transport_relay_paths_removed: Counter,
/// Number of custom transport paths opened.
pub transport_custom_paths_added: Counter,
/// Number of custom transport paths closed.
pub transport_custom_paths_removed: Counter,
/// Number of iterations of the main socket actor loop.
pub actor_tick_main: Counter,
/// Number of actor messages processed by the socket actor loop.
pub actor_tick_msg: Counter,
/// Number of periodic re-STUN timer ticks handled by the socket actor loop.
pub actor_tick_re_stun: Counter,
/// Number of port-mapping change events handled by the socket actor loop.
pub actor_tick_portmap_changed: Counter,
/// Intended to count direct address heartbeat ticks, but currently unused (never incremented).
pub actor_tick_direct_addr_heartbeat: Counter,
/// Number of local network interface (link) change events handled by the socket actor loop.
pub actor_link_change: Counter,
/// Number of times an input watcher or receiver closed in the socket actor loop.
pub actor_tick_other: Counter,
}