aboutsummaryrefslogtreecommitdiff
path: root/src/feature/relay/relay_metrics.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/feature/relay/relay_metrics.c')
-rw-r--r--src/feature/relay/relay_metrics.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/feature/relay/relay_metrics.c b/src/feature/relay/relay_metrics.c
index 466e4da55e..2c24728d9a 100644
--- a/src/feature/relay/relay_metrics.c
+++ b/src/feature/relay/relay_metrics.c
@@ -30,6 +30,7 @@ static void fill_global_bw_limit_values(void);
static void fill_socket_values(void);
static void fill_onionskins_values(void);
static void fill_oom_values(void);
+static void fill_tcp_exhaustion_values(void);
/** The base metrics that is a static array of metrics added to the metrics
* store.
@@ -79,6 +80,13 @@ static const relay_metrics_entry_t base_metrics[] =
.help = "Total number of DNS errors encountered by this relay",
.fill_fn = fill_dns_error_values,
},
+ {
+ .key = RELAY_METRICS_NUM_TCP_EXHAUSTION,
+ .type = METRICS_TYPE_COUNTER,
+ .name = METRICS_NAME(relay_load_tcp_exhaustion_total),
+ .help = "Total number of times we ran out of TCP ports",
+ .fill_fn = fill_tcp_exhaustion_values,
+ },
};
static const size_t num_base_metrics = ARRAY_LENGTH(base_metrics);
@@ -103,6 +111,19 @@ handshake_type_to_str(const uint16_t type)
}
}
+/** Fill function for the RELAY_METRICS_NUM_DNS metrics. */
+static void
+fill_tcp_exhaustion_values(void)
+{
+ metrics_store_entry_t *sentry;
+ const relay_metrics_entry_t *rentry =
+ &base_metrics[RELAY_METRICS_NUM_TCP_EXHAUSTION];
+
+ sentry = metrics_store_add(the_store, rentry->type, rentry->name,
+ rentry->help);
+ metrics_store_entry_update(sentry, rep_hist_get_n_tcp_exhaustion());
+}
+
/** Helper array containing mapping for the name of the different DNS records
* and their corresponding libevent values. */
static struct dns_type {