Skip to content

Commit bf1548c

Browse files
committed
bump deps and refactor with the defaults macro
1 parent 3017f07 commit bf1548c

File tree

6 files changed

+31
-83
lines changed

6 files changed

+31
-83
lines changed

Cargo.lock

Lines changed: 23 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,3 @@ unexpected_cfgs = { level = "warn", check-cfg = ["cfg(iroh_docsrs)", "cfg(iroh_l
4040

4141
[workspace.lints.clippy]
4242
unused-async = "warn"
43-
44-
[patch.crates-io]
45-
iroh-metrics = { git = "https://github.com/n0-computer/iroh-metrics", branch = "arqu/histograms" }

iroh-relay/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ http-body-util = "0.1.0"
3232
hyper = { version = "1", features = ["server", "client", "http1"] }
3333
hyper-util = "0.1.1"
3434
iroh-base = { version = "0.92.0", path = "../iroh-base", default-features = false, features = ["key", "relay"] }
35-
iroh-metrics = { git = "https://github.com/n0-computer/iroh-metrics", branch = "arqu/histograms", default-features = false }
35+
iroh-metrics = { version = "0.36", default-features = false }
3636
n0-future = "0.1.2"
3737
num_enum = "0.7"
3838
pin-project = "1"

iroh/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ futures-buffered = "0.2.11"
8282
pkcs8 = "0.11.0-rc.7"
8383

8484
# metrics
85-
iroh-metrics = { git = "https://github.com/n0-computer/iroh-metrics", branch = "arqu/histograms", default-features = false }
85+
iroh-metrics = { version = "0.36", default-features = false }
8686

8787
# local-swarm-discovery
8888
swarm-discovery = { version = "0.4", optional = true }
@@ -104,7 +104,7 @@ parse-size = { version = "=1.0.0", optional = true, features = ['std'] } # pinne
104104
hickory-resolver = "0.25.1"
105105
igd-next = { version = "0.16", features = ["aio_tokio"] }
106106
netdev = { version = "0.36.0" }
107-
portmapper = { version = "0.9", default-features = false }
107+
portmapper = { version = "0.10", default-features = false }
108108
quinn = { package = "iroh-quinn", version = "0.14.0", default-features = false, features = ["runtime-tokio", "rustls-ring"] }
109109
tokio = { version = "1", features = [
110110
"io-util",

iroh/bench/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ publish = false
99
bytes = "1.7"
1010
hdrhistogram = { version = "7.2", default-features = false }
1111
iroh = { path = ".." }
12-
iroh-metrics = "0.35"
12+
iroh-metrics = "0.36"
1313
n0-future = "0.1.1"
1414
n0-snafu = "0.2.0"
1515
quinn = { package = "iroh-quinn", version = "0.14" }

iroh/src/magicsock/metrics.rs

Lines changed: 4 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use serde::{Deserialize, Serialize};
66
#[allow(missing_docs)]
77
#[derive(Debug, Serialize, Deserialize, MetricsGroup)]
88
#[non_exhaustive]
9-
#[metrics(name = "magicsock")]
9+
#[metrics(name = "magicsock", default)]
1010
pub struct Metrics {
1111
pub update_direct_addrs: Counter,
1212

@@ -88,77 +88,12 @@ pub struct Metrics {
8888
/// Number of consecutive failure resets (path recovered).
8989
pub path_failure_resets: Counter,
9090
/// Histogram of packet loss rates (0.0-1.0) observed on UDP paths.
91+
#[default(Histogram::new(vec![0.0, 0.01, 0.05, 0.1, 0.2, 0.5, 1.0]))]
9192
pub path_packet_loss_rate: Histogram,
9293
/// Histogram of RTT variance (in milliseconds) as a congestion indicator.
94+
#[default(Histogram::new(vec![0.0, 1.0, 5.0, 10.0, 20.0, 50.0, 100.0, 200.0]))]
9395
pub path_rtt_variance_ms: Histogram,
9496
/// Histogram of path quality scores (0.0-1.0).
97+
#[default(Histogram::new(vec![0.0, 0.3, 0.5, 0.7, 0.85, 0.95, 1.0]))]
9598
pub path_quality_score: Histogram,
9699
}
97-
98-
impl Default for Metrics {
99-
fn default() -> Self {
100-
Self {
101-
update_direct_addrs: Counter::default(),
102-
send_ipv4: Counter::default(),
103-
send_ipv6: Counter::default(),
104-
send_relay: Counter::default(),
105-
send_relay_error: Counter::default(),
106-
send_data: Counter::default(),
107-
send_data_network_down: Counter::default(),
108-
recv_data_relay: Counter::default(),
109-
recv_data_ipv4: Counter::default(),
110-
recv_data_ipv6: Counter::default(),
111-
recv_datagrams: Counter::default(),
112-
recv_gro_datagrams: Counter::default(),
113-
send_disco_udp: Counter::default(),
114-
send_disco_relay: Counter::default(),
115-
sent_disco_udp: Counter::default(),
116-
sent_disco_relay: Counter::default(),
117-
sent_disco_ping: Counter::default(),
118-
sent_disco_pong: Counter::default(),
119-
sent_disco_call_me_maybe: Counter::default(),
120-
recv_disco_bad_key: Counter::default(),
121-
recv_disco_bad_parse: Counter::default(),
122-
recv_disco_udp: Counter::default(),
123-
recv_disco_relay: Counter::default(),
124-
recv_disco_ping: Counter::default(),
125-
recv_disco_pong: Counter::default(),
126-
recv_disco_call_me_maybe: Counter::default(),
127-
recv_disco_call_me_maybe_bad_disco: Counter::default(),
128-
relay_home_change: Counter::default(),
129-
num_direct_conns_added: Counter::default(),
130-
num_direct_conns_removed: Counter::default(),
131-
num_relay_conns_added: Counter::default(),
132-
num_relay_conns_removed: Counter::default(),
133-
actor_tick_main: Counter::default(),
134-
actor_tick_msg: Counter::default(),
135-
actor_tick_re_stun: Counter::default(),
136-
actor_tick_portmap_changed: Counter::default(),
137-
actor_tick_direct_addr_heartbeat: Counter::default(),
138-
actor_link_change: Counter::default(),
139-
actor_tick_other: Counter::default(),
140-
nodes_contacted: Counter::default(),
141-
nodes_contacted_directly: Counter::default(),
142-
connection_handshake_success: Counter::default(),
143-
connection_became_direct: Counter::default(),
144-
path_marked_outdated: Counter::default(),
145-
path_ping_failures: Counter::default(),
146-
path_failure_resets: Counter::default(),
147-
path_packet_loss_rate: packet_loss_buckets(),
148-
path_rtt_variance_ms: rtt_variance_buckets(),
149-
path_quality_score: quality_score_buckets(),
150-
}
151-
}
152-
}
153-
154-
fn packet_loss_buckets() -> Histogram {
155-
Histogram::new(vec![0.0, 0.01, 0.05, 0.1, 0.2, 0.5, 1.0])
156-
}
157-
158-
fn rtt_variance_buckets() -> Histogram {
159-
Histogram::new(vec![0.0, 1.0, 5.0, 10.0, 20.0, 50.0, 100.0, 200.0])
160-
}
161-
162-
fn quality_score_buckets() -> Histogram {
163-
Histogram::new(vec![0.0, 0.3, 0.5, 0.7, 0.85, 0.95, 1.0])
164-
}

0 commit comments

Comments
 (0)