aboutsummaryrefslogtreecommitdiff
path: root/src/feature/relay/relay_metrics.h
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2021-04-15 14:23:47 -0400
committerDavid Goulet <dgoulet@torproject.org>2021-05-12 11:58:25 -0400
commit9c2fa3498233bbb5f347a03188433c6c5f6de24f (patch)
treef3dc5b9d500198c147ae9e414b7f97abe8c4685b /src/feature/relay/relay_metrics.h
parentbdde4579c2fcb43cf5a32d617b3a5fe72314adf8 (diff)
downloadtor-9c2fa3498233bbb5f347a03188433c6c5f6de24f.tar.gz
tor-9c2fa3498233bbb5f347a03188433c6c5f6de24f.zip
relay: Add the OOM invocation metrics
With this commit, a relay now emits metrics event on the MetricsPort related to the OOM invocation for: - DNS cache - GeoIP database - Cell queues - HSDir caches Everytime the OOM is invoked, the number of bytes is added to the metrics counter for that specific type of invocation. Related to #40367 Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/feature/relay/relay_metrics.h')
-rw-r--r--src/feature/relay/relay_metrics.h10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/feature/relay/relay_metrics.h b/src/feature/relay/relay_metrics.h
index 7bc4760916..7d644badd3 100644
--- a/src/feature/relay/relay_metrics.h
+++ b/src/feature/relay/relay_metrics.h
@@ -12,13 +12,11 @@
#include "lib/container/smartlist.h"
#include "lib/metrics/metrics_common.h"
-#ifdef RELAY_METRICS_ENTRY_PRIVATE
-
/** Metrics key for each reported metrics. This key is also used as an index in
* the base_metrics array. */
typedef enum {
- /* XXX So code compiles. */
- PLACEHOLDER = 0,
+ /** Number of OOM invocation. */
+ RELAY_METRICS_NUM_OOM_BYTES = 0,
} relay_metrics_key_t;
/** The metadata of a relay metric. */
@@ -31,10 +29,10 @@ typedef struct relay_metrics_entry_t {
const char *name;
/* Metrics output help comment. */
const char *help;
+ /* Update value function. */
+ void (*fill_fn)(void);
} relay_metrics_entry_t;
-#endif /* RELAY_METRICS_ENTRY_PRIVATE */
-
/* Init. */
void relay_metrics_init(void);
void relay_metrics_free(void);