portmapper/metrics.rs
1use iroh_metrics::{Counter, MetricsGroup};
2use serde::{Deserialize, Serialize};
3
4/// Enum of metrics for the module
5#[derive(Debug, Default, MetricsGroup, Serialize, Deserialize)]
6#[metrics(name = "portmap")]
7pub struct Metrics {
8 /*
9 * General port mapping metrics
10 */
11 /// Number of probing tasks started.
12 pub probes_started: Counter,
13 /// Number of updates to the local port.
14 pub local_port_updates: Counter,
15 /// Number of mapping tasks started.
16 pub mapping_attempts: Counter,
17 /// Number of failed mapping tasks.
18 pub mapping_failures: Counter,
19 /// Number of times the external address obtained via port mapping was updated.
20 pub external_address_updated: Counter,
21
22 /*
23 * UPnP metrics
24 */
25 /// Number of UPnP probes executed.
26 pub upnp_probes: Counter,
27 /// Number of failed Upnp probes.
28 pub upnp_probes_failed: Counter,
29 /// Number of UPnP probes that found it available.
30 pub upnp_available: Counter,
31 /// Number of UPnP probes that resulted in a gateway different to the previous one,
32 pub upnp_gateway_updated: Counter,
33
34 /*
35 * PCP metrics
36 */
37 /// Number of PCP probes executed.
38 pub pcp_probes: Counter,
39 /// Number of PCP probes that found it available.
40 pub pcp_available: Counter,
41}