aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2022-11-03 09:37:38 -0400
committerDavid Goulet <dgoulet@torproject.org>2022-11-03 09:37:38 -0400
commit87e820a0c54e57fc282bb5d2472ef775504be8e0 (patch)
tree791eb7dcdfdd62503baf124554bb4ad70aef2ad5
parent619dd35321c13684d5496b660a3404d2d3fe2827 (diff)
downloadtor-87e820a0c54e57fc282bb5d2472ef775504be8e0.tar.gz
tor-87e820a0c54e57fc282bb5d2472ef775504be8e0.zip
metrics: Add stats for num circ reaching max cell outq
Part of #40708 Signed-off-by: David Goulet <dgoulet@torproject.org>
-rw-r--r--src/core/or/relay.c2
-rw-r--r--src/core/or/relay.h1
-rw-r--r--src/feature/relay/relay_metrics.c6
3 files changed, 9 insertions, 0 deletions
diff --git a/src/core/or/relay.c b/src/core/or/relay.c
index d77c47100a..39a7b783ab 100644
--- a/src/core/or/relay.c
+++ b/src/core/or/relay.c
@@ -128,6 +128,7 @@ uint64_t stats_n_relay_cells_delivered = 0;
/** Stats: how many circuits have we closed due to the cell queue limit being
* reached (see append_cell_to_circuit_queue()) */
uint64_t stats_n_circ_max_cell_reached = 0;
+uint64_t stats_n_circ_max_cell_outq_reached = 0;
/**
* Update channel usage state based on the type of relay cell and
@@ -3252,6 +3253,7 @@ append_cell_to_circuit_queue(circuit_t *circ, channel_t *chan,
/* This DoS defense only applies at the Guard as in the p_chan is likely
* a client IP attacking the network. */
if (exitward && CIRCUIT_IS_ORCIRC(circ)) {
+ stats_n_circ_max_cell_outq_reached++;
dos_note_circ_max_outq(CONST_TO_OR_CIRCUIT(circ)->p_chan);
}
diff --git a/src/core/or/relay.h b/src/core/or/relay.h
index 24466bccd0..3a1f3b0ae5 100644
--- a/src/core/or/relay.h
+++ b/src/core/or/relay.h
@@ -15,6 +15,7 @@
extern uint64_t stats_n_relay_cells_relayed;
extern uint64_t stats_n_relay_cells_delivered;
extern uint64_t stats_n_circ_max_cell_reached;
+extern uint64_t stats_n_circ_max_cell_outq_reached;
const char *relay_command_to_string(uint8_t command);
diff --git a/src/feature/relay/relay_metrics.c b/src/feature/relay/relay_metrics.c
index cc36736831..c7f6fe8846 100644
--- a/src/feature/relay/relay_metrics.c
+++ b/src/feature/relay/relay_metrics.c
@@ -317,6 +317,12 @@ fill_dos_values(void)
sentry = metrics_store_add(the_store, rentry->type, rentry->name,
rentry->help);
metrics_store_entry_add_label(sentry,
+ metrics_format_label("type", "circuit_killed_max_cell_outq"));
+ metrics_store_entry_update(sentry, stats_n_circ_max_cell_outq_reached);
+
+ sentry = metrics_store_add(the_store, rentry->type, rentry->name,
+ rentry->help);
+ metrics_store_entry_add_label(sentry,
metrics_format_label("type", "marked_address"));
metrics_store_entry_update(sentry, dos_get_num_cc_marked_addr());