summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2020-10-27 10:43:19 -0400
committerDavid Goulet <dgoulet@torproject.org>2020-10-27 10:43:42 -0400
commit5de66739724451801487dbec0eb210c0595cc00f (patch)
tree80650d93149bbcaed23215ccd25b79b71d44b8db /src/lib
parent238340ce54d1e0b2b7ef593697b971e951d9bd23 (diff)
downloadtor-5de66739724451801487dbec0eb210c0595cc00f.tar.gz
tor-5de66739724451801487dbec0eb210c0595cc00f.zip
metrics: Add tor_ namespace to all metrics
Closes #40063 Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/metrics/metrics_common.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/lib/metrics/metrics_common.h b/src/lib/metrics/metrics_common.h
index 5d1a32ea6c..50f6147007 100644
--- a/src/lib/metrics/metrics_common.h
+++ b/src/lib/metrics/metrics_common.h
@@ -11,6 +11,15 @@
#include "lib/cc/torint.h"
+/** Prefix to every metrics exposed. This is insures that the metrics are
+ * always in the same namespace. */
+#define METRICS_PREFIX tor_
+
+/** Helper macro that must be used to construct the right namespaced metrics
+ * name. A name is a string so stringify the result. */
+#define METRICS_STR(val) #val
+#define METRICS_NAME(name) METRICS_STR(METRICS_PREFIX ## name)
+
/** Format output type. */
typedef enum {
/** Prometheus data output format. */