mirror of
https://github.com/openbsd/src.git
synced 2026-06-18 23:33:33 +02:00
Print the new statistics added to the RDE.
OK tb@
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: output.c,v 1.69 2026/02/13 18:27:40 claudio Exp $ */
|
||||
/* $OpenBSD: output.c,v 1.70 2026/03/02 12:09:10 claudio Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
|
||||
@@ -227,6 +227,7 @@ show_neighbor_msgstats(struct peer *p)
|
||||
p->stats.msg_rcvd_open + p->stats.msg_rcvd_notification +
|
||||
p->stats.msg_rcvd_update + p->stats.msg_rcvd_keepalive +
|
||||
p->stats.msg_rcvd_rrefresh);
|
||||
|
||||
printf(" Update statistics:\n");
|
||||
printf(" %-15s %-10s %-10s %-10s\n", "", "Sent", "Received",
|
||||
"Pending");
|
||||
@@ -247,6 +248,13 @@ show_neighbor_msgstats(struct peer *p)
|
||||
p->stats.refresh_sent_borr, p->stats.refresh_rcvd_borr);
|
||||
printf(" %-15s %10llu %10llu\n", "End-of-RR",
|
||||
p->stats.refresh_sent_eorr, p->stats.refresh_rcvd_eorr);
|
||||
|
||||
printf(" Queue statistics:\n");
|
||||
printf(" %-15s %-10s %-10s\n", "", "Count", "Size");
|
||||
printf(" %-15s %10llu %10llu\n", "ibuf queue",
|
||||
p->stats.ibufq_msg_count, p->stats.ibufq_payload_size);
|
||||
printf(" %-15s %10llu %-10s\n", "rib queue",
|
||||
p->stats.rib_entry_count, "-");
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1117,6 +1125,8 @@ show_rib_mem(struct rde_memstats *stats)
|
||||
fmt_mem(stats->aset_size));
|
||||
printf("%10lld prefix-set elements using %s of memory\n",
|
||||
stats->pset_cnt, fmt_mem(stats->pset_size));
|
||||
printf("%10lld aspa-set elements using %s of memory\n",
|
||||
stats->aspa_cnt, fmt_mem(stats->aspa_size));
|
||||
printf("RIB using %s of memory\n", fmt_mem(pts +
|
||||
stats->prefix_cnt * sizeof(struct prefix) +
|
||||
stats->adjout_prefix_cnt * sizeof(struct adjout_prefix) +
|
||||
@@ -1128,9 +1138,14 @@ show_rib_mem(struct rde_memstats *stats)
|
||||
stats->aspath_size + stats->attr_cnt * sizeof(struct attr) +
|
||||
stats->attr_data));
|
||||
printf("Sets and filters using %s of memory\n",
|
||||
fmt_mem(stats->aset_size + stats->pset_size +
|
||||
fmt_mem(stats->aset_size + stats->pset_size + stats->aspa_size +
|
||||
stats->filter_set_size));
|
||||
|
||||
printf("\nRDE queue statistics\n");
|
||||
printf("%10lld messages queued holding %s of data\n",
|
||||
stats->rde_ibufq_msg_count, fmt_mem(stats->rde_ibufq_payload_size));
|
||||
printf("%10lld rib entries queued\n", stats->rde_rib_entry_count);
|
||||
|
||||
printf("\nRDE timing statistics\n");
|
||||
printf("%10lld usec spent in the event loop for %llu rounds\n",
|
||||
stats->rde_event_loop_usec, stats->rde_event_loop_count);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: output_json.c,v 1.60 2026/02/13 18:27:40 claudio Exp $ */
|
||||
/* $OpenBSD: output_json.c,v 1.61 2026/03/02 12:09:10 claudio Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2020 Claudio Jeker <claudio@openbsd.org>
|
||||
@@ -217,6 +217,18 @@ json_neighbor_stats(struct peer *p)
|
||||
|
||||
json_do_end();
|
||||
|
||||
json_do_object("queue", 0);
|
||||
|
||||
json_do_object("count", 1);
|
||||
json_do_uint("ibuf_queue", p->stats.ibufq_msg_count);
|
||||
json_do_uint("rib_entry", p->stats.rib_entry_count);
|
||||
json_do_end();
|
||||
json_do_object("size", 1);
|
||||
json_do_uint("ibuf_queue", p->stats.ibufq_payload_size);
|
||||
json_do_end();
|
||||
|
||||
json_do_end();
|
||||
|
||||
json_do_end();
|
||||
}
|
||||
|
||||
@@ -953,8 +965,17 @@ json_rib_mem(struct rde_memstats *stats)
|
||||
UINT64_MAX);
|
||||
json_rib_mem_element("prefix_set", stats->pset_cnt, stats->pset_size,
|
||||
UINT64_MAX);
|
||||
json_rib_mem_element("aspa_set", stats->aspa_cnt, stats->aspa_size,
|
||||
UINT64_MAX);
|
||||
json_rib_mem_element("total", UINT64_MAX,
|
||||
stats->aset_size + stats->pset_size, UINT64_MAX);
|
||||
stats->aset_size + stats->pset_size + stats->aspa_size, UINT64_MAX);
|
||||
json_do_end();
|
||||
|
||||
json_do_object("queue", 0);
|
||||
json_rib_mem_element("ibuf_queue", stats->rde_ibufq_msg_count,
|
||||
stats->rde_ibufq_payload_size, UINT64_MAX);
|
||||
json_rib_mem_element("rib_entry", stats->rde_rib_entry_count,
|
||||
UINT64_MAX, UINT64_MAX);
|
||||
json_do_end();
|
||||
|
||||
json_do_object("evloop", 0);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: output_ometric.c,v 1.24 2026/02/13 18:27:40 claudio Exp $ */
|
||||
/* $OpenBSD: output_ometric.c,v 1.25 2026/03/02 12:09:10 claudio Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2022 Claudio Jeker <claudio@openbsd.org>
|
||||
@@ -47,8 +47,10 @@ struct ometric *peer_withdraw_transmit, *peer_withdraw_pending,
|
||||
struct ometric *peer_rr_req_transmit, *peer_rr_req_receive;
|
||||
struct ometric *peer_rr_borr_transmit, *peer_rr_borr_receive;
|
||||
struct ometric *peer_rr_eorr_transmit, *peer_rr_eorr_receive;
|
||||
struct ometric *peer_queue_count, *peer_queue_size;
|
||||
struct ometric *rde_mem_size, *rde_mem_count, *rde_mem_ref_count;
|
||||
struct ometric *rde_set_size, *rde_set_count, *rde_table_count;
|
||||
struct ometric *rde_queue_size, *rde_queue_count;
|
||||
struct ometric *rde_evloop_count, *rde_evloop_time;
|
||||
|
||||
struct timespec start_time, end_time;
|
||||
@@ -152,6 +154,11 @@ ometric_head(struct parse_result *arg)
|
||||
peer_rr_eorr_receive = ometric_new(OMT_COUNTER,
|
||||
"bgpd_peer_route_refresh_eorr_receive",
|
||||
"number of ext. route-refresh EORR messages received from peer");
|
||||
peer_queue_count = ometric_new(OMT_GAUGE,
|
||||
"bgpd_peer_queue_usage_objects", "number of object on queue");
|
||||
peer_queue_size = ometric_new(OMT_GAUGE,
|
||||
"bgpd_peer_queue_memory_usage_bytes",
|
||||
"memory usage of queue in bytes");
|
||||
|
||||
/* RDE memory statistics */
|
||||
rde_mem_size = ometric_new(OMT_GAUGE,
|
||||
@@ -168,6 +175,11 @@ ometric_head(struct parse_result *arg)
|
||||
rde_table_count = ometric_new(OMT_GAUGE,
|
||||
"bgpd_rde_set_usage_tables", "number of as_set tables");
|
||||
|
||||
rde_queue_size = ometric_new(OMT_GAUGE,
|
||||
"bgpd_rde_queue_bytes", "memory usage of queued objects in bytes");
|
||||
rde_queue_count = ometric_new(OMT_GAUGE,
|
||||
"bgpd_rde_queue_objects", "number of object in queue");
|
||||
|
||||
rde_evloop_count = ometric_new(OMT_COUNTER,
|
||||
"bgpd_rde_evloop", "number of times the evloop ran");
|
||||
rde_evloop_time = ometric_new(OMT_COUNTER,
|
||||
@@ -257,6 +269,13 @@ ometric_neighbor_stats(struct peer *p, struct parse_result *arg)
|
||||
ometric_set_int(peer_rr_eorr_transmit, p->stats.refresh_sent_eorr, ol);
|
||||
ometric_set_int(peer_rr_eorr_receive, p->stats.refresh_rcvd_eorr, ol);
|
||||
|
||||
ometric_set_int_with_labels(peer_queue_count, p->stats.ibufq_msg_count,
|
||||
OKV("type"), OKV("ibuf_queue"), ol);
|
||||
ometric_set_int_with_labels(peer_queue_count, p->stats.rib_entry_count,
|
||||
OKV("type"), OKV("rib_entry"), ol);
|
||||
ometric_set_int_with_labels(peer_queue_size,
|
||||
p->stats.ibufq_payload_size, OKV("type"), OKV("ibuf_queue"), ol);
|
||||
|
||||
olabels_free(ol);
|
||||
free(descr);
|
||||
}
|
||||
@@ -342,10 +361,22 @@ ometric_rib_mem(struct rde_memstats *stats)
|
||||
OKV("type"), OKV("as_set"), NULL);
|
||||
ometric_set_int_with_labels(rde_set_size, stats->pset_size,
|
||||
OKV("type"), OKV("prefix_set"), NULL);
|
||||
ometric_set_int_with_labels(rde_set_size, stats->aspa_size,
|
||||
OKV("type"), OKV("aspa_set"), NULL);
|
||||
ometric_set_int_with_labels(rde_set_count, stats->pset_cnt,
|
||||
OKV("type"), OKV("prefix_set"), NULL);
|
||||
ometric_set_int_with_labels(rde_set_count, stats->aspa_cnt,
|
||||
OKV("type"), OKV("aspa_set"), NULL);
|
||||
ometric_rib_mem_element("set_total", UINT64_MAX,
|
||||
stats->aset_size + stats->pset_size, UINT64_MAX);
|
||||
stats->aset_size + stats->pset_size + stats->aspa_size, UINT64_MAX);
|
||||
|
||||
ometric_set_int_with_labels(rde_queue_count, stats->rde_ibufq_msg_count,
|
||||
OKV("type"), OKV("ibuf_queue"), NULL);
|
||||
ometric_set_int_with_labels(rde_queue_count, stats->rde_rib_entry_count,
|
||||
OKV("type"), OKV("rib_entry"), NULL);
|
||||
ometric_set_int_with_labels(rde_queue_size,
|
||||
stats->rde_ibufq_payload_size, OKV("type"), OKV("ibuf_queue"),
|
||||
NULL);
|
||||
|
||||
ometric_set_int(rde_evloop_count, stats->rde_event_loop_count, NULL);
|
||||
ometric_set_float_with_labels(rde_evloop_time,
|
||||
|
||||
Reference in New Issue
Block a user