[tor-commits] [tor/master] lib/metrics: Fix wrong macro expansion
dgoulet at torproject.org
dgoulet at torproject.org
Tue Oct 27 17:04:25 UTC 2020
commit 362229f184c92712ee5a3027ce5d29024ca5b382
Author: David Goulet <dgoulet at torproject.org>
Date: Tue Oct 27 12:59:29 2020 -0400
lib/metrics: Fix wrong macro expansion
The "METRICS_PREFIX" was not expanded but rather used as a litteral. Fix that
by just removing the define and using "tor_" directly.
Reviewed-by: Alexander Færøy <ahf at torproject.org>
Signed-off-by: David Goulet <dgoulet at torproject.org>
---
src/lib/metrics/metrics_common.h | 6 +-----
src/test/test_hs_metrics.c | 2 +-
2 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/src/lib/metrics/metrics_common.h b/src/lib/metrics/metrics_common.h
index 50f6147007..c684a3ec42 100644
--- a/src/lib/metrics/metrics_common.h
+++ b/src/lib/metrics/metrics_common.h
@@ -11,14 +11,10 @@
#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)
+#define METRICS_NAME(name) METRICS_STR(tor_ ## name)
/** Format output type. */
typedef enum {
diff --git a/src/test/test_hs_metrics.c b/src/test/test_hs_metrics.c
index dd123eb6f1..326212ae1d 100644
--- a/src/test/test_hs_metrics.c
+++ b/src/test/test_hs_metrics.c
@@ -44,7 +44,7 @@ test_metrics(void *arg)
/* Confirm the entry value. */
const smartlist_t *entries = metrics_store_get_all(service->metrics.store,
- "hs_intro_num_total");
+ "tor_hs_intro_num_total");
tt_assert(entries);
tt_int_op(smartlist_len(entries), OP_EQ, 1);
const metrics_store_entry_t *entry = smartlist_get(entries, 0);
More information about the tor-commits
mailing list