]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
lib/metrics: Fix wrong macro expansion
authorDavid Goulet <dgoulet@torproject.org>
Tue, 27 Oct 2020 16:59:29 +0000 (12:59 -0400)
committerDavid Goulet <dgoulet@torproject.org>
Tue, 27 Oct 2020 17:00:20 +0000 (13:00 -0400)
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@torproject.org>
Signed-off-by: David Goulet <dgoulet@torproject.org>
src/lib/metrics/metrics_common.h
src/test/test_hs_metrics.c

index 50f6147007191ab8df56521c36eb277dad851f24..c684a3ec42bad3dfe950f145d77859618799400b 100644 (file)
 
 #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 {
index dd123eb6f1f54c611860813e350d9bd8bd8e6779..326212ae1dbf3ee0bb5cf6a8944eff23ae33513c 100644 (file)
@@ -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);