use crate::runtime::MetricType;
use alloc::{vec, vec::Vec};
pub const NUM_FLOODFILLS: &str = "netdb_floodfill_count";
pub const NUM_QUERIED: &str = "netdb_num_queried";
pub const NUM_RI_QUERY_SUCCESSES: &str = "netdb_num_router_info_query_success_count";
pub const NUM_RI_QUERY_FAILURES: &str = "netdb_num_router_info_query_failure_count";
pub const RI_NUM_QUERIED: &str = "netdb_router_info_queried";
pub const NUM_LS_QUERY_SUCCESSES: &str = "netdb_num_lease_set_query_success_count";
pub const NUM_LS_QUERY_FAILURES: &str = "netdb_num_lease_set_query_failure_count";
pub const LS_NUM_QUERIED: &str = "netdb_lease_set_queried";
pub const QUERY_DURATION_BUCKET: &str = "netdb_query_durations";
pub const ACTIVE_QUERIES: &str = "netdb_active_query_count";
pub fn register_metrics(mut metrics: Vec<MetricType>) -> Vec<MetricType> {
metrics.push(MetricType::Counter {
name: NUM_FLOODFILLS,
description: "number of know floodfills",
});
metrics.push(MetricType::Counter {
name: NUM_RI_QUERY_SUCCESSES,
description: "number of failed router info queries",
});
metrics.push(MetricType::Counter {
name: NUM_RI_QUERY_FAILURES,
description: "number of successful router info queries",
});
metrics.push(MetricType::Counter {
name: NUM_LS_QUERY_SUCCESSES,
description: "number of failed lease set queries",
});
metrics.push(MetricType::Counter {
name: NUM_LS_QUERY_FAILURES,
description: "number of successful lease set queries",
});
metrics.push(MetricType::Gauge {
name: ACTIVE_QUERIES,
description: "number of active queries",
});
metrics.push(MetricType::Histogram {
name: QUERY_DURATION_BUCKET,
description: "how long queries take",
buckets: vec![
100f64, 300f64, 500f64, 1000f64, 1500f64, 2500f64, 4000f64, 6000f64, 7000f64,
],
});
metrics.push(MetricType::Histogram {
name: RI_NUM_QUERIED,
description: "how many routers were queried for the lookup",
buckets: vec![1f64, 2f64, 3f64, 4f64, 5f64, 7f64, 9f64, 11f64, 15f64],
});
metrics.push(MetricType::Histogram {
name: LS_NUM_QUERIED,
description: "how many routers were queried for the lookup",
buckets: vec![1f64, 2f64, 3f64, 4f64, 5f64, 7f64, 9f64, 11f64, 15f64],
});
metrics.push(MetricType::Histogram {
name: NUM_QUERIED,
description: "how many routers were queried for the lookup",
buckets: vec![1f64, 2f64, 3f64, 4f64, 5f64, 7f64, 9f64, 11f64, 15f64],
});
metrics
}