diff options
author | David Goulet <dgoulet@torproject.org> | 2020-10-19 15:15:47 -0400 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2020-10-27 10:43:42 -0400 |
commit | ec731290a5a790093961f0fdb06cf69000194adf (patch) | |
tree | da6a2351d3bb17071c64f493edfa292e4257c7ec /src/lib/metrics/metrics_common.c | |
parent | bd582583f610d568bb61d1a108d1ff4f38ef08b5 (diff) | |
download | tor-ec731290a5a790093961f0fdb06cf69000194adf.tar.gz tor-ec731290a5a790093961f0fdb06cf69000194adf.zip |
lib: New metrics library
Used to provide an interface to create metrics store and update the entries.
Related to #40063
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/lib/metrics/metrics_common.c')
-rw-r--r-- | src/lib/metrics/metrics_common.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/lib/metrics/metrics_common.c b/src/lib/metrics/metrics_common.c new file mode 100644 index 0000000000..5941a4d892 --- /dev/null +++ b/src/lib/metrics/metrics_common.c @@ -0,0 +1,29 @@ +/* 2020, The Tor Project, Inc. */ +/* See LICENSE for licensing information */ + +/** + * @file metrics_common.c + * @brief Common code for the metrics library + **/ + +#include <stddef.h> + +#include "orconfig.h" + +#include "lib/log/util_bug.h" + +#include "lib/metrics/metrics_common.h" + +/** Return string representation of a metric type. */ +const char * +metrics_type_to_str(const metrics_type_t type) +{ + switch (type) { + case METRICS_TYPE_COUNTER: + return "counter"; + case METRICS_TYPE_GAUGE: + return "gauge"; + default: + tor_assert_unreached(); + } +} |