diff options
author | David Goulet <dgoulet@torproject.org> | 2024-01-30 10:13:09 -0500 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2024-01-30 10:13:09 -0500 |
commit | 5a5ca444c80ee5ef17a5f0b0d94720e82f51209c (patch) | |
tree | 2396d70c3034909832f05ef5c6231055b0c6b88b /src/feature/stats/rephist.c | |
parent | 9536c0b0f2e1fb65685471b1728e35ffb61c18f5 (diff) | |
download | tor-5a5ca444c80ee5ef17a5f0b0d94720e82f51209c.tar.gz tor-5a5ca444c80ee5ef17a5f0b0d94720e82f51209c.zip |
metrics: Add new relay metrics to MetricsPort
This commit adds the total number of DROP cell seen, the total number of
DESTROY cell received and the total number of protocol violation that lead to a
circuit close.
Closes #40816
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/feature/stats/rephist.c')
-rw-r--r-- | src/feature/stats/rephist.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/feature/stats/rephist.c b/src/feature/stats/rephist.c index 20610b6011..055081fc7c 100644 --- a/src/feature/stats/rephist.c +++ b/src/feature/stats/rephist.c @@ -280,6 +280,9 @@ static dns_stats_t dns_AAAA_stats; /** DNS query statistics store. It covers all type of queries. */ static dns_stats_t dns_all_stats; +/** Counter of the total number of DROP cell received. */ +static uint64_t relay_circ_n_drop_cell_received = 0; + /** Return the point to the DNS statistics store. Ignore the type for now * because of a libevent problem. */ static inline dns_stats_t * @@ -2815,6 +2818,8 @@ rep_hist_padding_count_write(padding_type_t type) switch (type) { case PADDING_TYPE_DROP: padding_current.write_drop_cell_count++; + /* Padding stats get reset thus why we have two counters. */ + relay_circ_n_drop_cell_received++; break; case PADDING_TYPE_CELL: padding_current.write_pad_cell_count++; @@ -3022,6 +3027,13 @@ rep_hist_consensus_has_changed(const networkstatus_t *ns) OVERLOAD_ONIONSKIN_NTOR_PERIOD_SECS_MAX); } +/** Relay Only: return the total number of DROP cell received. */ +uint64_t +rep_hist_get_drop_cell_received_count(void) +{ + return relay_circ_n_drop_cell_received; +} + #ifdef TOR_UNIT_TESTS /* only exists for unit tests: get HSv2 stats object */ const hs_v2_stats_t * |