This is an automated email from the git hooks/post-receive script.
dgoulet pushed a commit to branch main in repository tor.
commit 87e820a0c54e57fc282bb5d2472ef775504be8e0 Author: David Goulet dgoulet@torproject.org AuthorDate: Thu Nov 3 09:37:38 2022 -0400
metrics: Add stats for num circ reaching max cell outq
Part of #40708
Signed-off-by: David Goulet dgoulet@torproject.org --- src/core/or/relay.c | 2 ++ src/core/or/relay.h | 1 + src/feature/relay/relay_metrics.c | 6 ++++++ 3 files changed, 9 insertions(+)
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 @@ -314,6 +314,12 @@ fill_dos_values(void) metrics_format_label("type", "circuit_killed_max_cell")); metrics_store_entry_update(sentry, stats_n_circ_max_cell_reached);
+ 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,