9#define METRICS_STORE_ENTRY_PRIVATE
29 static char buf[1024];
32 if (smartlist_len(labels) == 0) {
53 tor_assert(entry->type == METRICS_TYPE_HISTOGRAM);
57 for (
size_t i = 0; i < entry->u.histogram.bucket_count; ++i) {
59 if (strlen(labels) > 0) {
61 entry->name, labels, (
double)hb.bucket, hb.value);
64 entry->name, (
double)hb.bucket, hb.value);
68 if (strlen(labels) > 0) {
72 buf_add_printf(data,
"%s_sum{%s} %" PRIi64
"\n", entry->name, labels,
74 buf_add_printf(data,
"%s_count{%s} %" PRIi64
"\n", entry->name, labels,
77 buf_add_printf(data,
"%s_bucket{le=\"+Inf\"} %" PRIi64
"\n", entry->name,
100 switch (entry->type) {
101 case METRICS_TYPE_COUNTER: FALLTHROUGH;
102 case METRICS_TYPE_GAUGE:
105 if (strlen(labels) > 0) {
115 case METRICS_TYPE_HISTOGRAM:
119 tor_assert_unreached();
void buf_add_printf(buf_t *buf, const char *format,...)
Headers for util_malloc.c.
const char * metrics_type_to_str(const metrics_type_t type)
uint64_t metrics_store_hist_entry_get_count(const metrics_store_entry_t *entry)
int64_t metrics_store_hist_entry_get_sum(const metrics_store_entry_t *entry)
int64_t metrics_store_entry_get_value(const metrics_store_entry_t *entry)
int tor_snprintf(char *str, size_t size, const char *format,...)
void prometheus_format_store_entry(const metrics_store_entry_t *entry, buf_t *data, bool no_comment)
static const char * format_labels(smartlist_t *labels)
static void format_histogram(const metrics_store_entry_t *entry, buf_t *data)
Header for feature/metrics/prometheus.c.
char * smartlist_join_strings(smartlist_t *sl, const char *join, int terminate, size_t *len_out)
Macros to manage assertions, fatal and non-fatal.