1- use iroh_metrics:: { Counter , Histogram , MetricsGroup } ;
1+ use iroh_metrics:: { Counter , MetricsGroup } ;
22use serde:: { Deserialize , Serialize } ;
33
44/// Enum of metrics for the module
@@ -14,11 +14,8 @@ pub struct Metrics {
1414 pub send_ipv4 : Counter ,
1515 pub send_ipv6 : Counter ,
1616 pub send_relay : Counter ,
17- pub send_relay_error : Counter ,
1817
1918 // Data packets (non-disco)
20- pub send_data : Counter ,
21- pub send_data_network_down : Counter ,
2219 pub recv_data_relay : Counter ,
2320 pub recv_data_ipv4 : Counter ,
2421 pub recv_data_ipv6 : Counter ,
@@ -50,15 +47,20 @@ pub struct Metrics {
5047
5148 /*
5249 * Connection Metrics
50+ *
51+ * These all only count connections that completed the TLS handshake successfully. This means
52+ * that short lived 0RTT connections are potentially not included in these counts.
5353 */
54- /// The number of direct connections we have made to peers.
55- pub num_direct_conns_added : Counter ,
56- /// The number of direct connections we have lost to peers.
57- pub num_direct_conns_removed : Counter ,
58- /// The number of connections to peers we have added over relay.
59- pub num_relay_conns_added : Counter ,
60- /// The number of connections to peers we have removed over relay.
61- pub num_relay_conns_removed : Counter ,
54+ /// Number of connections opened (only handshaked connections are counted).
55+ pub num_conns_opened : Counter ,
56+ /// Number of connections closed (only handshaked connections are counted).
57+ pub num_conns_closed : Counter ,
58+ /// Number of connections that had only relay paths over their lifetime.
59+ pub num_conns_transport_relay_only : Counter ,
60+ /// Number of connections that had only IP paths over their lifetime.
61+ pub num_conns_transport_ip_only : Counter ,
62+ /// Number of connections that had both IP and relay paths.
63+ pub num_conns_transport_ip_and_relay : Counter ,
6264
6365 pub actor_tick_main : Counter ,
6466 pub actor_tick_msg : Counter ,
@@ -67,36 +69,25 @@ pub struct Metrics {
6769 pub actor_tick_direct_addr_heartbeat : Counter ,
6870 pub actor_link_change : Counter ,
6971 pub actor_tick_other : Counter ,
70-
71- /// Number of endpoints we have attempted to contact.
72- pub endpoints_contacted : Counter ,
73- /// Number of endpoints we have managed to contact directly.
74- pub endpoints_contacted_directly : Counter ,
75-
76- /// Number of connections with a successful handshake.
77- pub connection_handshake_success : Counter ,
78- /// Number of connections with a successful handshake that became direct.
79- pub connection_became_direct : Counter ,
80- /// Histogram of connection latency in milliseconds across all endpoint connections.
81- #[ default( Histogram :: new( vec![ 1.0 , 5.0 , 10.0 , 25.0 , 50.0 , 100.0 , 250.0 , 500.0 , 1000.0 , f64 :: INFINITY ] ) ) ]
82- pub connection_latency_ms : Histogram ,
83-
84- /*
85- * Path Congestion Metrics
86- */
87- /// Number of times a path was marked as outdated due to consecutive ping failures.
88- pub path_marked_outdated : Counter ,
89- /// Number of ping failures recorded across all paths.
90- pub path_ping_failures : Counter ,
91- /// Number of consecutive failure resets (path recovered).
92- pub path_failure_resets : Counter ,
93- /// Histogram of packet loss rates (0.0-1.0) observed on UDP paths.
94- #[ default( Histogram :: new( vec![ 0.0 , 0.01 , 0.05 , 0.1 , 0.2 , 0.5 , 1.0 ] ) ) ]
95- pub path_packet_loss_rate : Histogram ,
96- /// Histogram of RTT variance (in milliseconds) as a congestion indicator.
97- #[ default( Histogram :: new( vec![ 0.0 , 1.0 , 5.0 , 10.0 , 20.0 , 50.0 , 100.0 , 200.0 ] ) ) ]
98- pub path_rtt_variance_ms : Histogram ,
99- /// Histogram of path quality scores (0.0-1.0).
100- #[ default( Histogram :: new( vec![ 0.0 , 0.3 , 0.5 , 0.7 , 0.85 , 0.95 , 1.0 ] ) ) ]
101- pub path_quality_score : Histogram ,
72+ // /// Histogram of connection latency in milliseconds across all endpoint connections.
73+ // #[default(Histogram::new(vec![1.0, 5.0, 10.0, 25.0, 50.0, 100.0, 250.0, 500.0, 1000.0, f64::INFINITY]))]
74+ // pub connection_latency_ms: Histogram,
75+ // /*
76+ // * Path Congestion Metrics
77+ // */
78+ // /// Number of times a path was marked as outdated due to consecutive ping failures.
79+ // pub path_marked_outdated: Counter,
80+ // /// Number of ping failures recorded across all paths.
81+ // pub path_ping_failures: Counter,
82+ // /// Number of consecutive failure resets (path recovered).
83+ // pub path_failure_resets: Counter,
84+ // /// Histogram of packet loss rates (0.0-1.0) observed on UDP paths.
85+ // #[default(Histogram::new(vec![0.0, 0.01, 0.05, 0.1, 0.2, 0.5, 1.0]))]
86+ // pub path_packet_loss_rate: Histogram,
87+ // /// Histogram of RTT variance (in milliseconds) as a congestion indicator.
88+ // #[default(Histogram::new(vec![0.0, 1.0, 5.0, 10.0, 20.0, 50.0, 100.0, 200.0]))]
89+ // pub path_rtt_variance_ms: Histogram,
90+ // /// Histogram of path quality scores (0.0-1.0).
91+ // #[default(Histogram::new(vec![0.0, 0.3, 0.5, 0.7, 0.85, 0.95, 1.0]))]
92+ // pub path_quality_score: Histogram,
10293}
0 commit comments