Tor 0.4.9.3-alpha-dev
Loading...
Searching...
No Matches
relay_metrics.h
Go to the documentation of this file.
1/* Copyright (c) 2021, The Tor Project, Inc. */
2/* See LICENSE for licensing information */
3
4/**
5 * @file relay_metrics.h
6 * @brief Header for feature/relay/relay_metrics.c
7 **/
8
9#ifndef TOR_FEATURE_RELAY_RELAY_METRICS_H
10#define TOR_FEATURE_RELAY_RELAY_METRICS_H
11
14
15/** Metrics key for each reported metrics. This key is also used as an index in
16 * the base_metrics array. */
17typedef enum {
18 /** Number of OOM invocation. */
20 /** Number of onionskines handled. */
22 /** Number of sockets. */
24 /** Number of global connection rate limit. */
26 /** Number of DNS queries. */
28 /** Number of DNS query errors. */
30 /** Number of TCP exhaustion reached. */
32 /** Connections counters (always going up). */
34 /** Connections gauges. */
36 /** Number of streams. */
38 /** Congestion control counters. */
40 /** Congestion control gauges. */
42 /** Denial of Service defenses subsystem. */
44 /** Denial of Service defenses subsystem. */
46 /** Relay flags. */
48 /** Numer of circuits. */
50 /** Timestamp at which the current online keys will expire. */
52 /** Number of times we received an EST_REND cell */
54 /** Number of times we received an EST_INTRO cell */
56 /** Number of times we received an INTRO1 cell */
58 /** Number of times we received a REND1 cell */
60 /** Number of circuit closed by receiving a DESTROY cell. */
62 /** Number of circuits closed due to protocol violation. */
64 /** Number of drop cell seen. */
67
68/** The metadata of a relay metric. */
69typedef struct relay_metrics_entry_t {
70 /* Metric key used as a static array index. */
72 /* Metric type. */
73 metrics_type_t type;
74 /* Metrics output name. */
75 const char *name;
76 /* Metrics output help comment. */
77 const char *help;
78 /* Update value function. */
79 void (*fill_fn)(void);
81
82/* Init. */
83void relay_metrics_init(void);
84void relay_metrics_free(void);
85
86/* Accessors. */
88
89typedef enum {
90 EST_INTRO_SUCCESS,
91 EST_INTRO_MALFORMED,
92 EST_INTRO_UNSUITABLE_CIRCUIT,
93 EST_INTRO_CIRCUIT_DEAD,
94
95 EST_INTRO_ACTION_COUNT
96} est_intro_action_t;
97
98void relay_increment_est_intro_action(est_intro_action_t);
99
100typedef enum {
101 EST_REND_SUCCESS,
102 EST_REND_UNSUITABLE_CIRCUIT,
103 EST_REND_SINGLE_HOP,
104 EST_REND_MALFORMED,
105 EST_REND_DUPLICATE_COOKIE,
106 EST_REND_CIRCUIT_DEAD,
107
108 EST_REND_ACTION_COUNT
109} est_rend_action_t;
110
111void relay_increment_est_rend_action(est_rend_action_t);
112
113typedef enum {
114 INTRO1_SUCCESS,
115 INTRO1_CIRCUIT_DEAD,
116 INTRO1_MALFORMED,
117 INTRO1_UNKNOWN_SERVICE,
118 INTRO1_RATE_LIMITED,
119 INTRO1_CIRCUIT_REUSED,
120 INTRO1_SINGLE_HOP,
121
122 INTRO1_ACTION_COUNT
123} intro1_action_t;
124
125void relay_increment_intro1_action(intro1_action_t);
126
127typedef enum {
128 REND1_SUCCESS,
129 REND1_UNSUITABLE_CIRCUIT,
130 REND1_MALFORMED,
131 REND1_UNKNOWN_COOKIE,
132 REND1_CIRCUIT_DEAD,
133
134 REND1_ACTION_COUNT
135} rend1_action_t;
136
137void relay_increment_rend1_action(rend1_action_t);
138
139#endif /* !defined(TOR_FEATURE_RELAY_RELAY_METRICS_H) */
Header for lib/metrics/metrics_common.c.
metrics_type_t
relay_metrics_key_t
@ RELAY_METRICS_CC_GAUGES
@ RELAY_METRICS_NUM_GLOBAL_RW_LIMIT
@ RELAY_METRICS_NUM_EST_REND
@ RELAY_METRICS_NUM_STREAMS
@ RELAY_METRICS_NUM_CIRCUITS
@ RELAY_METRICS_NUM_TCP_EXHAUSTION
@ RELAY_METRICS_NUM_SOCKETS
@ RELAY_METRICS_NUM_INTRO1_CELLS
@ RELAY_METRICS_NUM_DOS
@ RELAY_METRICS_CONN_COUNTERS
@ RELAY_METRICS_CC_COUNTERS
@ RELAY_METRICS_CONN_GAUGES
@ RELAY_METRICS_CIRC_DESTROY_CELL
@ RELAY_METRICS_NUM_ONIONSKINS
@ RELAY_METRICS_NUM_DNS
@ RELAY_METRICS_RELAY_FLAGS
@ RELAY_METRICS_SIGNING_CERT_EXPIRY
@ RELAY_METRICS_NUM_EST_INTRO
@ RELAY_METRICS_NUM_DNS_ERRORS
@ RELAY_METRICS_NUM_OOM_BYTES
@ RELAY_METRICS_NUM_TRAFFIC
@ RELAY_METRICS_CIRC_DROP_CELL
@ RELAY_METRICS_NUM_REND1_CELLS
@ RELAY_METRICS_CIRC_PROTO_VIOLATION
const smartlist_t * relay_metrics_get_stores(void)
void relay_metrics_init(void)
void relay_metrics_free(void)
Header for smartlist.c.