9 #define RELAY_METRICS_ENTRY_PRIVATE
24 #include <event2/dns.h>
43 .type = METRICS_TYPE_COUNTER,
44 .name = METRICS_NAME(relay_load_oom_bytes_total),
45 .help =
"Total number of bytes the OOM has freed by subsystem",
50 .type = METRICS_TYPE_COUNTER,
51 .name = METRICS_NAME(relay_load_onionskins_total),
52 .help =
"Total number of onionskins handled",
57 .type = METRICS_TYPE_GAUGE,
58 .name = METRICS_NAME(relay_load_socket_total),
59 .help =
"Total number of sockets",
64 .type = METRICS_TYPE_COUNTER,
65 .name = METRICS_NAME(relay_load_global_rate_limit_reached_total),
66 .help =
"Total number of global connection bucket limit reached",
71 .type = METRICS_TYPE_COUNTER,
72 .name = METRICS_NAME(relay_exit_dns_query_total),
73 .help =
"Total number of DNS queries done by this relay",
78 .type = METRICS_TYPE_COUNTER,
79 .name = METRICS_NAME(relay_exit_dns_error_total),
80 .help =
"Total number of DNS errors encountered by this relay",
85 .type = METRICS_TYPE_COUNTER,
86 .name = METRICS_NAME(relay_load_tcp_exhaustion_total),
87 .help =
"Total number of times we ran out of TCP ports",
97 static inline const char *
101 case ONION_HANDSHAKE_TYPE_TAP:
103 case ONION_HANDSHAKE_TYPE_FAST:
105 case ONION_HANDSHAKE_TYPE_NTOR:
109 tor_assert_unreached();
118 metrics_store_entry_t *sentry;
133 { .name =
"A", .type = DNS_IPv4_A },
134 { .name =
"PTR", .type = DNS_PTR },
135 { .name =
"AAAA", .type = DNS_IPv6_AAAA },
137 static const size_t num_dns_types =
ARRAY_LENGTH(dns_types);
143 metrics_store_entry_t *sentry;
149 static struct dns_error {
153 { .name =
"success", .key = DNS_ERR_NONE },
154 { .name =
"format", .key = DNS_ERR_FORMAT },
155 { .name =
"serverfailed", .key = DNS_ERR_SERVERFAILED },
156 { .name =
"notexist", .key = DNS_ERR_NOTEXIST },
157 { .name =
"notimpl", .key = DNS_ERR_NOTIMPL },
158 { .name =
"refused", .key = DNS_ERR_REFUSED },
159 { .name =
"truncated", .key = DNS_ERR_TRUNCATED },
160 { .name =
"unknown", .key = DNS_ERR_UNKNOWN },
161 { .name =
"timeout", .key = DNS_ERR_TIMEOUT },
162 { .name =
"shutdown", .key = DNS_ERR_SHUTDOWN },
163 { .name =
"cancel", .key = DNS_ERR_CANCEL },
164 { .name =
"nodata", .key = DNS_ERR_NODATA },
168 for (
size_t i = 0; i < num_dns_types; i++) {
174 for (
size_t j = 0; j < num_errors; j++) {
191 metrics_store_entry_t *sentry;
195 for (
size_t i = 0; i < num_dns_types; i++) {
213 metrics_store_entry_t *sentry;
234 metrics_store_entry_t *sentry;
253 metrics_store_entry_t *sentry;
257 for (uint16_t t = 0; t <= MAX_ONION_HANDSHAKE_TYPE; t++) {
285 metrics_store_entry_t *sentry;
327 for (
size_t i = 0; i < num_base_metrics; i++) {
Headers for util_malloc.c.
const char * metrics_format_label(const char *key, const char *value)
metrics_store_entry_t * metrics_store_add(metrics_store_t *store, metrics_type_t type, const char *name, const char *help)
metrics_store_t * metrics_store_new(void)
void metrics_store_reset(metrics_store_t *store)
Header for lib/metrics/metrics_store.c.
void metrics_store_entry_update(metrics_store_entry_t *entry, const int64_t value)
void metrics_store_entry_add_label(metrics_store_entry_t *entry, const char *label)
Master header file for Tor-specific functionality.
uint64_t oom_stats_n_bytes_removed_dns
static void fill_oom_values(void)
static const char * handshake_type_to_str(const uint16_t type)
static void fill_store(void)
static void fill_tcp_exhaustion_values(void)
static void fill_dns_query_values(void)
static void fill_onionskins_values(void)
static void fill_dns_error_values(void)
void relay_metrics_init(void)
static void fill_global_bw_limit_values(void)
const smartlist_t * relay_metrics_get_stores(void)
void relay_metrics_free(void)
static const relay_metrics_entry_t base_metrics[]
static void fill_socket_values(void)
static metrics_store_t * the_store
Header for feature/relay/relay_metrics.c.
@ RELAY_METRICS_NUM_GLOBAL_RW_LIMIT
@ RELAY_METRICS_NUM_TCP_EXHAUSTION
@ RELAY_METRICS_NUM_SOCKETS
@ RELAY_METRICS_NUM_ONIONSKINS
@ RELAY_METRICS_NUM_DNS_ERRORS
@ RELAY_METRICS_NUM_OOM_BYTES
uint64_t rep_hist_get_n_dns_request(int type)
uint64_t rep_hist_get_circuit_handshake_dropped(uint16_t type)
int rep_hist_get_circuit_handshake_assigned(uint16_t type)
uint64_t rep_hist_get_n_dns_error(int type, uint8_t error)
uint64_t rep_hist_get_n_read_limit_reached(void)
uint64_t rep_hist_get_n_tcp_exhaustion(void)
uint64_t rep_hist_get_n_write_limit_reached(void)
Header file for rephist.c.
smartlist_t * smartlist_new(void)
void smartlist_add(smartlist_t *sl, void *element)
int get_max_sockets(void)
int get_n_open_sockets(void)
Macros to manage assertions, fatal and non-fatal.