From 61c680e82a8762f46b2ee6bcb9e2a50f8c62707b Mon Sep 17 00:00:00 2001 From: elene-margalit Date: Thu, 10 Sep 2020 00:15:20 +0200 Subject: [PATCH] Deleted already unneccessary functions distribution_marshal_count, distribution_marshal_sum and distribution_marshal_text and added another switch case for distribution type in metric.c. --- src/daemon/metric.c | 12 +++--------- src/daemon/metric.h | 12 ------------ 2 files changed, 3 insertions(+), 21 deletions(-) diff --git a/src/daemon/metric.c b/src/daemon/metric.c index b132f01df..2042b4b83 100644 --- a/src/daemon/metric.c +++ b/src/daemon/metric.c @@ -23,7 +23,6 @@ * Authors: * Florian octo Forster * Manoj Srivastava - * Elene Margalitadze **/ #include "collectd.h" @@ -43,14 +42,6 @@ /* Metric names must match the regex `[a-zA-Z_:][a-zA-Z0-9_:]*` */ #define VALID_NAME_CHARS VALID_LABEL_CHARS ":" -int distribution_count_marshal_text(strbuf_t *buf, distribution_t *dist) { - return strbuf_printf(buf, "%" PRIu64, distribution_total_counter(dist)); -} - -int distribution_sum_marshal_text(strbuf_t *buf, distribution_t *dist) { - return strbuf_printf(buf, GAUGE_FORMAT, distribution_total_sum(dist)); -} - int value_marshal_text(strbuf_t *buf, value_t v, metric_type_t type) { switch (type) { case METRIC_TYPE_GAUGE: @@ -58,6 +49,9 @@ int value_marshal_text(strbuf_t *buf, value_t v, metric_type_t type) { return strbuf_printf(buf, GAUGE_FORMAT, v.gauge); case METRIC_TYPE_COUNTER: return strbuf_printf(buf, "%" PRIu64, v.counter); + case METRIC_TYPE_DISTRIBUTION: + ERROR("Distribution metrics are not to be represented as text."); + return EINVAL; default: ERROR("Unknown metric value type: %d", (int)type); return EINVAL; diff --git a/src/daemon/metric.h b/src/daemon/metric.h index 3167cd9b0..e0366a215 100644 --- a/src/daemon/metric.h +++ b/src/daemon/metric.h @@ -59,18 +59,6 @@ typedef union value_u value_t; /* value_marshal_text prints a text representation of v to buf. */ int value_marshal_text(strbuf_t *buf, value_t v, metric_type_t type); -/*distribution_marshal_text prints a text representation of a distribution - * metric to buf.*/ -int distribution_marshal_text(strbuf_t *buf, distribution_t *dist); - -/*distribution_marshal_text prints the total count of gauges registered in a - * distribution metric to buf.*/ -int distribution_count_marshal_text(strbuf_t *buf, distribution_t *dist); - -/*distribution_marshal_text prints the sum of all gauges registered in a - * distribution metric to buf.*/ -int distribution_sum_marshal_text(strbuf_t *buf, distribution_t *dist); - /* * Labels */ -- 2.47.3