diff options
Diffstat (limited to 'src/feature/relay/relay_metrics.c')
-rw-r--r-- | src/feature/relay/relay_metrics.c | 93 |
1 files changed, 55 insertions, 38 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); |