]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
relay: Code and objects to initialize metrics store
authorDavid Goulet <dgoulet@torproject.org>
Thu, 15 Apr 2021 16:46:23 +0000 (12:46 -0400)
committerDavid Goulet <dgoulet@torproject.org>
Wed, 12 May 2021 15:58:25 +0000 (11:58 -0400)
Signed-off-by: David Goulet <dgoulet@torproject.org>
src/feature/relay/relay_metrics.c
src/feature/relay/relay_metrics.h

index 3364861592c27c86811de24d4b1af0fd3ff5aa67..3d392847e1403613a1bd1ce5f4354456ca9db683 100644 (file)
 
 #include "feature/relay/relay_metrics.h"
 
+/** The base metrics that is a static array of metrics added to the metrics
+ * store.
+ *
+ * The key member MUST be also the index of the entry in the array. */
+static const relay_metrics_entry_t base_metrics[] = {};
+static const size_t num_base_metrics = ARRAY_LENGTH(base_metrics);
+
 /** The only and single store of all the relay metrics. */
 static metrics_store_t *the_store;
 
index 3a13eb20428cfac6db6284390450560e2fd19ee1..7bc4760916704ce270421570d0442a39d22cf2ac 100644 (file)
 #define TOR_FEATURE_RELAY_RELAY_METRICS_H
 
 #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,
+} relay_metrics_key_t;
+
+/** The metadata of a relay metric. */
+typedef struct relay_metrics_entry_t {
+  /* Metric key used as a static array index. */
+  relay_metrics_key_t key;
+  /* Metric type. */
+  metrics_type_t type;
+  /* Metrics output name. */
+  const char *name;
+  /* Metrics output help comment. */
+  const char *help;
+} relay_metrics_entry_t;
+
+#endif /* RELAY_METRICS_ENTRY_PRIVATE */
 
 /* Init. */
 void relay_metrics_init(void);