diff options
author | David Goulet <dgoulet@torproject.org> | 2020-10-20 12:48:54 -0400 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2020-10-27 10:43:42 -0400 |
commit | 50f44afeb4e2222518b64f022ca74f3fa31f8819 (patch) | |
tree | 25d321a2f876d760798323fa09fdf15fde0eaa22 /src/feature/hs/hs_metrics_entry.c | |
parent | 4f5cea1f592d9e9e6c69fc0e772dd46a0fa43799 (diff) | |
download | tor-50f44afeb4e2222518b64f022ca74f3fa31f8819.tar.gz tor-50f44afeb4e2222518b64f022ca74f3fa31f8819.zip |
hs: New metrics module
At this commit, a new service registers to the module and a store is created.
It also remove itself from the metrics module if it goes away.
In order to hook into the metrics subsystem, this commit attaches the HS
subsystem into the subsystem global list so its get_metrics() call can be
accessible.
HS initialization is still _not_ done through the subsys module as it is
likely require much more testing.
Related to #40063
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/feature/hs/hs_metrics_entry.c')
-rw-r--r-- | src/feature/hs/hs_metrics_entry.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/feature/hs/hs_metrics_entry.c b/src/feature/hs/hs_metrics_entry.c new file mode 100644 index 0000000000..d6b2e0e62b --- /dev/null +++ b/src/feature/hs/hs_metrics_entry.c @@ -0,0 +1,33 @@ +/* Copyright (c) 2020, The Tor Project, Inc. */ +/* See LICENSE for licensing information */ + +/** + * @file hs_metrics_entry.c + * @brief Defines the metrics entry that are collected by an onion service. + **/ + +#define HS_METRICS_ENTRY_PRIVATE + +#include "orconfig.h" + +#include "lib/cc/compat_compiler.h" + +#include "feature/hs/hs_metrics_entry.h" + +/** The base metrics that is a static array of metrics that are added to every + * single new stores. + * + * The key member MUST be also the index of the entry in the array. */ +const hs_metrics_entry_t base_metrics[] = +{ + { + .key = HS_METRICS_NUM_INTRODUCTIONS, + .type = METRICS_TYPE_COUNTER, + .name = "hs_intro_num_total", + .help = "Total number of introduction received", + .port_as_label = false, + }, +}; + +/** Size of base_metrics array that is number of entries. */ +const size_t base_metrics_size = ARRAY_LENGTH(base_metrics); |