Tor  0.4.6.0-alpha-dev
metrics_common.c
Go to the documentation of this file.
1 /* 2020, The Tor Project, Inc. */
2 /* See LICENSE for licensing information */
3 
4 /**
5  * @file metrics_common.c
6  * @brief Common code for the metrics library
7  **/
8 
9 #include <stddef.h>
10 
11 #include "orconfig.h"
12 
13 #include "lib/log/util_bug.h"
14 
16 
17 /** Return string representation of a metric type. */
18 const char *
20 {
21  switch (type) {
22  case METRICS_TYPE_COUNTER:
23  return "counter";
24  case METRICS_TYPE_GAUGE:
25  return "gauge";
26  default:
27  tor_assert_unreached();
28  }
29 }
metrics_common.h
Header for lib/metrics/metrics_common.c.
metrics_type_to_str
const char * metrics_type_to_str(const metrics_type_t type)
Definition: metrics_common.c:19
util_bug.h
Macros to manage assertions, fatal and non-fatal.
metrics_type_t
metrics_type_t
Definition: metrics_common.h:26