use crate::runtime::MetricType;
use alloc::vec::Vec;
pub const NUM_ACTIVE_CONNECTIONS: &str = "transport_active_connections_count";
pub const NUM_CONNECTIONS: &str = "transport_connections_count";
pub const NUM_REJECTED: &str = "transport_rejected_connections_count";
pub const NUM_ACCEPTED: &str = "transport_accepted_connections_count";
pub const NUM_INITIATED: &str = "transport_initiated_count";
pub const NUM_DIAL_FAILURES: &str = "transport_dial_failure_count";
pub const NUM_INTRODUCER_DIAL_FAILURES: &str = "transport_introducer_dial_failure_count";
pub const NUM_IPV4: &str = "transport_ipv4_router_count";
pub const NUM_IPV6: &str = "transport_ipv6_router_count";
pub const CONNECTIONS_OPENED: &str = "transport_connections_opened_count";
pub const CONNECTIONS_CLOSED: &str = "transport_connections_closed_count";
pub const NUM_NETDB_QUERIES: &str = "transport_ri_query_count";
pub const NUM_NETDB_QUERY_SUCCESSES: &str = "transport_ri_query_successes";
pub const NUM_NETDB_QUERY_FAILURES: &str = "transport_ri_query_failures";
pub fn register_metrics(mut metrics: Vec<MetricType>) -> Vec<MetricType> {
metrics.push(MetricType::Counter {
name: NUM_INITIATED,
description: "number of initiated connections",
});
metrics.push(MetricType::Counter {
name: NUM_DIAL_FAILURES,
description: "number of dial failures",
});
metrics.push(MetricType::Counter {
name: NUM_INTRODUCER_DIAL_FAILURES,
description: "number of dial failures caused by introducer errors",
});
metrics.push(MetricType::Counter {
name: NUM_REJECTED,
description: "number of rejected connections",
});
metrics.push(MetricType::Counter {
name: NUM_NETDB_QUERIES,
description: "number of netdb queries",
});
metrics.push(MetricType::Counter {
name: NUM_NETDB_QUERY_SUCCESSES,
description: "number of successful netdb queries",
});
metrics.push(MetricType::Counter {
name: NUM_NETDB_QUERY_FAILURES,
description: "number of failed netdb queries",
});
metrics.push(MetricType::Counter {
name: CONNECTIONS_OPENED,
description: "how many connections have been opened",
});
metrics.push(MetricType::Counter {
name: CONNECTIONS_CLOSED,
description: "how many connections have been closed",
});
metrics.push(MetricType::Counter {
name: NUM_CONNECTIONS,
description: "total number of connections",
});
metrics.push(MetricType::Gauge {
name: NUM_ACTIVE_CONNECTIONS,
description: "number of active connections",
});
metrics.push(MetricType::Gauge {
name: NUM_IPV4,
description: "number of active ipv4 connections",
});
metrics.push(MetricType::Gauge {
name: NUM_IPV6,
description: "number of active ipv6 connections",
});
metrics
}