This is an automated email from the git hooks/post-receive script.
dgoulet pushed a change to branch main in repository tor.
from f39f8b30f4 Merge branch 'maint-0.4.7' new 2737037ccd metrics: Split connections with a counter and gauge new e94c27c0ab metrics: Split cc with counters and gauges new b5afc7d62a Merge branch 'maint-0.4.7'
The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
Summary of changes: src/feature/relay/relay_metrics.c | 151 ++++++++++++++++++++++++-------------- src/feature/relay/relay_metrics.h | 34 +++++---- 2 files changed, 115 insertions(+), 70 deletions(-)
This is an automated email from the git hooks/post-receive script.
dgoulet pushed a commit to branch main in repository tor.
commit 2737037ccd8391adcfe18f90d80a64310df88c84 Author: David Goulet dgoulet@torproject.org AuthorDate: Thu Nov 10 07:29:18 2022 -0500
metrics: Split connections with a counter and gauge
Created and Rejected connections are ever going up counters. While Opened connections are gauges going up and down.
Fixes #40712
Signed-off-by: David Goulet dgoulet@torproject.org --- src/feature/relay/relay_metrics.c | 58 +++++++++++++++++++++++++++------------ src/feature/relay/relay_metrics.h | 18 ++++++------ 2 files changed, 51 insertions(+), 25 deletions(-)
diff --git a/src/feature/relay/relay_metrics.c b/src/feature/relay/relay_metrics.c index c9a3c7944d..6805f0e48b 100644 --- a/src/feature/relay/relay_metrics.c +++ b/src/feature/relay/relay_metrics.c @@ -41,7 +41,8 @@ /** Declarations of each fill function for metrics defined in base_metrics. */ static void fill_cc_values(void); static void fill_circuits_values(void); -static void fill_connections_values(void); +static void fill_conn_counter_values(void); +static void fill_conn_gauge_values(void); static void fill_dns_error_values(void); static void fill_dns_query_values(void); static void fill_dos_values(void); @@ -110,11 +111,18 @@ static const relay_metrics_entry_t base_metrics[] = .fill_fn = fill_tcp_exhaustion_values, }, { - .key = RELAY_METRICS_NUM_CONNECTIONS, - .type = METRICS_TYPE_GAUGE, + .key = RELAY_METRICS_CONN_COUNTERS, + .type = METRICS_TYPE_COUNTER, .name = METRICS_NAME(relay_connections_total), - .help = "Total number of connections", - .fill_fn = fill_connections_values, + .help = "Total number of created/rejected connections", + .fill_fn = fill_conn_counter_values, + }, + { + .key = RELAY_METRICS_CONN_GAUGES, + .type = METRICS_TYPE_GAUGE, + .name = METRICS_NAME(relay_connections), + .help = "Total number of opened connections", + .fill_fn = fill_conn_gauge_values, }, { .key = RELAY_METRICS_NUM_STREAMS, @@ -563,12 +571,12 @@ fill_single_connection_value(metrics_store_entry_t *sentry, metrics_store_entry_update(sentry, value); }
-/** Fill function for the RELAY_METRICS_NUM_CONNECTIONS metric. */ +/** Fill function for the RELAY_METRICS_CONN_COUNTERS metric. */ static void -fill_connections_values(void) +fill_conn_counter_values(void) { const relay_metrics_entry_t *rentry = - &base_metrics[RELAY_METRICS_NUM_CONNECTIONS]; + &base_metrics[RELAY_METRICS_CONN_COUNTERS];
for (unsigned int i = CONN_TYPE_MIN_; i < CONN_TYPE_MAX_ ; i++) { /* Type is unused. Ugly but else we clobber the output. */ @@ -596,6 +604,31 @@ fill_connections_values(void)
sentry = metrics_store_add(the_store, rentry->type, rentry->name, rentry->help); + fill_single_connection_value(sentry, i, "received", "rejected", AF_INET, + rep_hist_get_conn_rejected(i, AF_INET)); + sentry = metrics_store_add(the_store, rentry->type, rentry->name, + rentry->help); + fill_single_connection_value(sentry, i, "received", "rejected", AF_INET6, + rep_hist_get_conn_rejected(i, AF_INET6)); + + /* No counter for "initiated" + "rejected" connections exists. */ + } +} + +/** Fill function for the RELAY_METRICS_CONN_GAUGES metric. */ +static void +fill_conn_gauge_values(void) +{ + const relay_metrics_entry_t *rentry = + &base_metrics[RELAY_METRICS_CONN_GAUGES]; + + for (unsigned int i = CONN_TYPE_MIN_; i < CONN_TYPE_MAX_ ; i++) { + /* Type is unused. Ugly but else we clobber the output. */ + if (i == 10) { + continue; + } + metrics_store_entry_t *sentry = + metrics_store_add(the_store, rentry->type, rentry->name, rentry->help); fill_single_connection_value(sentry, i, "initiated", "opened", AF_INET, rep_hist_get_conn_opened(false, i, AF_INET)); sentry = metrics_store_add(the_store, rentry->type, rentry->name, @@ -611,15 +644,6 @@ fill_connections_values(void) rentry->help); fill_single_connection_value(sentry, i, "received", "opened", AF_INET6, rep_hist_get_conn_opened(true, i, AF_INET6)); - - sentry = metrics_store_add(the_store, rentry->type, rentry->name, - rentry->help); - fill_single_connection_value(sentry, i, "received", "rejected", AF_INET, - rep_hist_get_conn_rejected(i, AF_INET)); - sentry = metrics_store_add(the_store, rentry->type, rentry->name, - rentry->help); - fill_single_connection_value(sentry, i, "received", "rejected", AF_INET6, - rep_hist_get_conn_rejected(i, AF_INET6)); } }
diff --git a/src/feature/relay/relay_metrics.h b/src/feature/relay/relay_metrics.h index 8ac24ebdb4..f9fafd427c 100644 --- a/src/feature/relay/relay_metrics.h +++ b/src/feature/relay/relay_metrics.h @@ -29,20 +29,22 @@ typedef enum { RELAY_METRICS_NUM_DNS_ERRORS = 5, /** Number of TCP exhaustion reached. */ RELAY_METRICS_NUM_TCP_EXHAUSTION = 6, - /** Number of connections. */ - RELAY_METRICS_NUM_CONNECTIONS = 7, + /** Connections counters (always going up). */ + RELAY_METRICS_CONN_COUNTERS = 7, + /** Connections gauges. */ + RELAY_METRICS_CONN_GAUGES = 8, /** Number of streams. */ - RELAY_METRICS_NUM_STREAMS = 8, + RELAY_METRICS_NUM_STREAMS = 9, /** Congestion control counters. */ - RELAY_METRICS_NUM_CC = 9, + RELAY_METRICS_NUM_CC = 10, /** Denial of Service defenses subsystem. */ - RELAY_METRICS_NUM_DOS = 10, + RELAY_METRICS_NUM_DOS = 11, /** Denial of Service defenses subsystem. */ - RELAY_METRICS_NUM_TRAFFIC = 11, + RELAY_METRICS_NUM_TRAFFIC = 12, /** Relay flags. */ - RELAY_METRICS_RELAY_FLAGS = 12, + RELAY_METRICS_RELAY_FLAGS = 13, /** Numer of circuits. */ - RELAY_METRICS_NUM_CIRCUITS = 13, + RELAY_METRICS_NUM_CIRCUITS = 14, } relay_metrics_key_t;
/** The metadata of a relay metric. */
This is an automated email from the git hooks/post-receive script.
dgoulet pushed a commit to branch main in repository tor.
commit e94c27c0ab3c40ce7d421ef9cb2b27e0b6a08e0e Author: David Goulet dgoulet@torproject.org AuthorDate: Thu Nov 10 08:57:39 2022 -0500
metrics: Split cc with counters and gauges
Part of #40712
Signed-off-by: David Goulet dgoulet@torproject.org --- src/feature/relay/relay_metrics.c | 93 +++++++++++++++++++++++---------------- src/feature/relay/relay_metrics.h | 32 +++++++------- 2 files changed, 72 insertions(+), 53 deletions(-)
diff --git a/src/feature/relay/relay_metrics.c b/src/feature/relay/relay_metrics.c index 6805f0e48b..b2c53f389a 100644 --- a/src/feature/relay/relay_metrics.c +++ b/src/feature/relay/relay_metrics.c @@ -39,7 +39,8 @@ #include <event2/dns.h>
/** Declarations of each fill function for metrics defined in base_metrics. */ -static void fill_cc_values(void); +static void fill_cc_counters_values(void); +static void fill_cc_gauges_values(void); static void fill_circuits_values(void); static void fill_conn_counter_values(void); static void fill_conn_gauge_values(void); @@ -132,11 +133,18 @@ static const relay_metrics_entry_t base_metrics[] = .fill_fn = fill_streams_values, }, { - .key = RELAY_METRICS_NUM_CC, + .key = RELAY_METRICS_CC_COUNTERS, .type = METRICS_TYPE_COUNTER, .name = METRICS_NAME(relay_congestion_control_total), .help = "Congestion control related counters", - .fill_fn = fill_cc_values, + .fill_fn = fill_cc_counters_values, + }, + { + .key = RELAY_METRICS_CC_GAUGES, + .type = METRICS_TYPE_GAUGE, + .name = METRICS_NAME(relay_congestion_control), + .help = "Congestion control related gauges", + .fill_fn = fill_cc_gauges_values, }, { .key = RELAY_METRICS_NUM_DOS, @@ -384,14 +392,15 @@ fill_dos_values(void) metrics_store_entry_update(sentry, hs_dos_get_intro2_rejected_count()); }
-/** Fill function for the RELAY_METRICS_NUM_CC metric. */ +/** Fill function for the RELAY_METRICS_CC_COUNTERS metric. */ static void -fill_cc_values(void) +fill_cc_counters_values(void) { - const relay_metrics_entry_t *rentry = &base_metrics[RELAY_METRICS_NUM_CC]; + const relay_metrics_entry_t *rentry = + &base_metrics[RELAY_METRICS_CC_COUNTERS]; + metrics_store_entry_t *sentry = metrics_store_add(the_store, rentry->type, rentry->name, rentry->help); - metrics_store_entry_add_label(sentry, metrics_format_label("state", "starvation")); metrics_store_entry_add_label(sentry, @@ -410,81 +419,89 @@ fill_cc_values(void) sentry = metrics_store_add(the_store, rentry->type, rentry->name, rentry->help); metrics_store_entry_add_label(sentry, - metrics_format_label("state", "slow_start_exit")); + metrics_format_label("state", "flow_control")); metrics_store_entry_add_label(sentry, - metrics_format_label("action", "cwnd")); + metrics_format_label("action", "xoff_num_sent")); metrics_store_entry_update(sentry, - tor_llround(cc_stats_vegas_exit_ss_cwnd_ma)); + cc_stats_flow_num_xoff_sent);
sentry = metrics_store_add(the_store, rentry->type, rentry->name, rentry->help); metrics_store_entry_add_label(sentry, - metrics_format_label("state", "on_circ_close")); + metrics_format_label("state", "flow_control")); metrics_store_entry_add_label(sentry, - metrics_format_label("action", "cwnd")); + metrics_format_label("action", "xon_num_sent")); metrics_store_entry_update(sentry, - tor_llround(cc_stats_circ_close_cwnd_ma)); + cc_stats_flow_num_xon_sent);
sentry = metrics_store_add(the_store, rentry->type, rentry->name, rentry->help); metrics_store_entry_add_label(sentry, - metrics_format_label("state", "on_circ_close")); + metrics_format_label("state", "cc_limits")); metrics_store_entry_add_label(sentry, - metrics_format_label("action", "ss_cwnd")); - metrics_store_entry_update(sentry, - tor_llround(cc_stats_circ_close_ss_cwnd_ma)); + metrics_format_label("action", "above_delta")); + metrics_store_entry_update(sentry, cc_stats_vegas_above_delta);
sentry = metrics_store_add(the_store, rentry->type, rentry->name, rentry->help); metrics_store_entry_add_label(sentry, - metrics_format_label("state", "flow_control")); + metrics_format_label("state", "cc_limits")); metrics_store_entry_add_label(sentry, - metrics_format_label("action", "xoff_num_sent")); - metrics_store_entry_update(sentry, - cc_stats_flow_num_xoff_sent); + metrics_format_label("action", "above_ss_cwnd_max")); + metrics_store_entry_update(sentry, cc_stats_vegas_above_ss_cwnd_max); +}
- sentry = metrics_store_add(the_store, rentry->type, rentry->name, - rentry->help); +/** Fill function for the RELAY_METRICS_CC_GAUGES metric. */ +static void +fill_cc_gauges_values(void) +{ + const relay_metrics_entry_t *rentry = + &base_metrics[RELAY_METRICS_CC_GAUGES]; + + metrics_store_entry_t *sentry = + metrics_store_add(the_store, rentry->type, rentry->name, rentry->help); metrics_store_entry_add_label(sentry, - metrics_format_label("state", "flow_control")); + metrics_format_label("state", "slow_start_exit")); metrics_store_entry_add_label(sentry, - metrics_format_label("action", "xon_num_sent")); + metrics_format_label("action", "cwnd")); metrics_store_entry_update(sentry, - cc_stats_flow_num_xon_sent); + tor_llround(cc_stats_vegas_exit_ss_cwnd_ma));
sentry = metrics_store_add(the_store, rentry->type, rentry->name, rentry->help); metrics_store_entry_add_label(sentry, - metrics_format_label("state", "buffers")); + metrics_format_label("state", "on_circ_close")); metrics_store_entry_add_label(sentry, - metrics_format_label("action", "xon_outbuf")); + metrics_format_label("action", "cwnd")); metrics_store_entry_update(sentry, - tor_llround(cc_stats_flow_xon_outbuf_ma)); + tor_llround(cc_stats_circ_close_cwnd_ma));
sentry = metrics_store_add(the_store, rentry->type, rentry->name, rentry->help); metrics_store_entry_add_label(sentry, - metrics_format_label("state", "buffers")); + metrics_format_label("state", "on_circ_close")); metrics_store_entry_add_label(sentry, - metrics_format_label("action", "xoff_outbuf")); + metrics_format_label("action", "ss_cwnd")); metrics_store_entry_update(sentry, - tor_llround(cc_stats_flow_xoff_outbuf_ma)); + tor_llround(cc_stats_circ_close_ss_cwnd_ma));
sentry = metrics_store_add(the_store, rentry->type, rentry->name, rentry->help); metrics_store_entry_add_label(sentry, - metrics_format_label("state", "cc_limits")); + metrics_format_label("state", "buffers")); metrics_store_entry_add_label(sentry, - metrics_format_label("action", "above_delta")); - metrics_store_entry_update(sentry, cc_stats_vegas_above_delta); + metrics_format_label("action", "xon_outbuf")); + metrics_store_entry_update(sentry, + tor_llround(cc_stats_flow_xon_outbuf_ma));
sentry = metrics_store_add(the_store, rentry->type, rentry->name, rentry->help); metrics_store_entry_add_label(sentry, - metrics_format_label("state", "cc_limits")); + metrics_format_label("state", "buffers")); metrics_store_entry_add_label(sentry, - metrics_format_label("action", "above_ss_cwnd_max")); - metrics_store_entry_update(sentry, cc_stats_vegas_above_ss_cwnd_max); + metrics_format_label("action", "xoff_outbuf")); + metrics_store_entry_update(sentry, + tor_llround(cc_stats_flow_xoff_outbuf_ma));
sentry = metrics_store_add(the_store, rentry->type, rentry->name, rentry->help); diff --git a/src/feature/relay/relay_metrics.h b/src/feature/relay/relay_metrics.h index f9fafd427c..1d2d649d8a 100644 --- a/src/feature/relay/relay_metrics.h +++ b/src/feature/relay/relay_metrics.h @@ -16,35 +16,37 @@ * the base_metrics array. */ typedef enum { /** Number of OOM invocation. */ - RELAY_METRICS_NUM_OOM_BYTES = 0, + RELAY_METRICS_NUM_OOM_BYTES, /** Number of onionskines handled. */ - RELAY_METRICS_NUM_ONIONSKINS = 1, + RELAY_METRICS_NUM_ONIONSKINS, /** Number of sockets. */ - RELAY_METRICS_NUM_SOCKETS = 2, + RELAY_METRICS_NUM_SOCKETS, /** Number of global connection rate limit. */ - RELAY_METRICS_NUM_GLOBAL_RW_LIMIT = 3, + RELAY_METRICS_NUM_GLOBAL_RW_LIMIT, /** Number of DNS queries. */ - RELAY_METRICS_NUM_DNS = 4, + RELAY_METRICS_NUM_DNS, /** Number of DNS query errors. */ - RELAY_METRICS_NUM_DNS_ERRORS = 5, + RELAY_METRICS_NUM_DNS_ERRORS, /** Number of TCP exhaustion reached. */ - RELAY_METRICS_NUM_TCP_EXHAUSTION = 6, + RELAY_METRICS_NUM_TCP_EXHAUSTION, /** Connections counters (always going up). */ - RELAY_METRICS_CONN_COUNTERS = 7, + RELAY_METRICS_CONN_COUNTERS, /** Connections gauges. */ - RELAY_METRICS_CONN_GAUGES = 8, + RELAY_METRICS_CONN_GAUGES, /** Number of streams. */ - RELAY_METRICS_NUM_STREAMS = 9, + RELAY_METRICS_NUM_STREAMS, /** Congestion control counters. */ - RELAY_METRICS_NUM_CC = 10, + RELAY_METRICS_CC_COUNTERS, + /** Congestion control gauges. */ + RELAY_METRICS_CC_GAUGES, /** Denial of Service defenses subsystem. */ - RELAY_METRICS_NUM_DOS = 11, + RELAY_METRICS_NUM_DOS, /** Denial of Service defenses subsystem. */ - RELAY_METRICS_NUM_TRAFFIC = 12, + RELAY_METRICS_NUM_TRAFFIC, /** Relay flags. */ - RELAY_METRICS_RELAY_FLAGS = 13, + RELAY_METRICS_RELAY_FLAGS, /** Numer of circuits. */ - RELAY_METRICS_NUM_CIRCUITS = 14, + RELAY_METRICS_NUM_CIRCUITS, } relay_metrics_key_t;
/** The metadata of a relay metric. */
This is an automated email from the git hooks/post-receive script.
dgoulet pushed a commit to branch main in repository tor.
commit b5afc7d62a36d2bbf6ca7c8c18daff0123d49111 Merge: f39f8b30f4 e94c27c0ab Author: David Goulet dgoulet@torproject.org AuthorDate: Thu Nov 10 09:30:42 2022 -0500
Merge branch 'maint-0.4.7'
src/feature/relay/relay_metrics.c | 151 ++++++++++++++++++++++++-------------- src/feature/relay/relay_metrics.h | 34 +++++---- 2 files changed, 115 insertions(+), 70 deletions(-)
tor-commits@lists.torproject.org