summaryrefslogtreecommitdiff
path: root/src/feature/metrics/metrics_sys.c
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2020-10-19 15:50:45 -0400
committerDavid Goulet <dgoulet@torproject.org>2020-10-27 10:43:42 -0400
commita882d1bf0abbbcf2bc4f8c039f9b82262462292c (patch)
treec37c263e44ba53924929062f473c913e2124dd93 /src/feature/metrics/metrics_sys.c
parentec731290a5a790093961f0fdb06cf69000194adf (diff)
downloadtor-a882d1bf0abbbcf2bc4f8c039f9b82262462292c.tar.gz
tor-a882d1bf0abbbcf2bc4f8c039f9b82262462292c.zip
metrics: New feature module to track tor metrics
Related to #40063 Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/feature/metrics/metrics_sys.c')
-rw-r--r--src/feature/metrics/metrics_sys.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/feature/metrics/metrics_sys.c b/src/feature/metrics/metrics_sys.c
new file mode 100644
index 0000000000..419318068e
--- /dev/null
+++ b/src/feature/metrics/metrics_sys.c
@@ -0,0 +1,37 @@
+/* Copyright (c) 2020, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+/**
+ * @file metrics_sys.c
+ * @brief Setup and tear down the metrics subsystem.
+ **/
+
+#include "lib/subsys/subsys.h"
+
+#include "feature/metrics/metrics.h"
+#include "feature/metrics/metrics_sys.h"
+
+static int
+subsys_metrics_initialize(void)
+{
+ metrics_init();
+ return 0;
+}
+
+static void
+subsys_metrics_shutdown(void)
+{
+ metrics_cleanup();
+}
+
+const subsys_fns_t sys_metrics = {
+ SUBSYS_DECLARE_LOCATION(),
+
+ .name = "metrics",
+ .supported = true,
+ .level = METRICS_SUBSYS_LEVEL,
+
+ .initialize = subsys_metrics_initialize,
+ .shutdown = subsys_metrics_shutdown,
+};
+