]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
format_graphite: More cleanups.
authorFlorian Forster <octo@google.com>
Fri, 17 Jul 2020 10:43:01 +0000 (12:43 +0200)
committerFlorian Forster <octo@google.com>
Wed, 29 Jul 2020 11:40:03 +0000 (13:40 +0200)
*   Struct "metric_t": unnecessary fields "type", "plugin", "ds" have
    been removed. The field "value_ds_type" has been renamed to
    "value_type".
*   The reference counted, multiple instance "meta_data_list_head_t" type
    has been removed. Manually doing the reference counting all over the
    place is error prone and it seems like premature optimization.
*   The "<type>_destroy" functions must handle NULL gracefully. Removed
    NULL-checks around their invocation to improve readability.

# Conflicts:
# src/daemon/metrics_list_test.c

src/utils/format_graphite/format_graphite.c

index 8a4d66c377bf7d9d37db592aca16aced3a061d5e..6e671c49e638019bb7b0d7a5813818fb1f5e8cfc 100644 (file)
@@ -54,17 +54,17 @@ static int gr_format_values(char *ret, size_t ret_len, const metric_t *metric_p,
       offset += ((size_t)status);                                              \
   } while (0)
 
-  if (metric_p->value_ds_type == DS_TYPE_GAUGE)
+  if (metric_p->value_type == DS_TYPE_GAUGE)
     BUFFER_ADD(GAUGE_FORMAT, metric_p->value.gauge);
   else if (rate != -1)
     BUFFER_ADD("%f", rate);
-  else if (metric_p->value_ds_type == DS_TYPE_COUNTER)
+  else if (metric_p->value_type == DS_TYPE_COUNTER)
     BUFFER_ADD("%" PRIu64, (uint64_t)metric_p->value.counter);
-  else if (metric_p->value_ds_type == DS_TYPE_DERIVE)
+  else if (metric_p->value_type == DS_TYPE_DERIVE)
     BUFFER_ADD("%" PRIi64, metric_p->value.derive);
   else {
     P_ERROR("gr_format_values: Unknown data source type: %i",
-            metric_p->value_ds_type);
+            metric_p->value_type);
     return -1;
   }