**/
#include "collectd.h"
+
#include "metric.h"
#include "plugin.h"
label_set_reset(&m->label);
meta_data_destroy(m->meta);
- if(m->family->type == METRIC_TYPE_DISTRIBUTION) {
- distribution_destroy(m->value.distribution);
- }
-
memset(m, 0, sizeof(*m));
return 0;
}
for (size_t i = 0; i < src.num; i++) {
-
- ret.ptr[i] = (metric_t){
+ ret.ptr[i] = (metric_t){
.family = fam,
+ .value = src.ptr[i].value,
.time = src.ptr[i].time,
.interval = src.ptr[i].interval,
- };
-
- if(src.ptr[i].family->type == METRIC_TYPE_DISTRIBUTION) {
- ret.ptr[i].value.distribution = distribution_clone(src.ptr[i].value.distribution);
- }
- else {
- ret.ptr[i].value = src.ptr[i].value;
- }
+ };
int status = label_set_clone(&ret.ptr[i].label, src.ptr[i].label);
if (status != 0) {
return fam->metric.ptr;
}
-
#include "utils/metadata/meta_data.h"
#include "utils/strbuf/strbuf.h"
#include "utils_time.h"
-#include "distribution.h"
#define VALUE_TYPE_GAUGE 1
#define VALUE_TYPE_DERIVE 2
METRIC_TYPE_COUNTER = 0,
METRIC_TYPE_GAUGE = 1,
METRIC_TYPE_UNTYPED = 2,
- METRIC_TYPE_DISTRIBUTION = 3,
} metric_type_t;
typedef uint64_t counter_t;
counter_t counter;
gauge_t gauge;
derive_t derive;
- distribution_t *distribution;
};
typedef union value_u value_t;
char const *metric_label_get(metric_t const *m, char const *name);
/* metric_reset frees all labels and meta data stored in the metric and resets
- * the metric to zero. If the metric is a distribution metric, the function frees the according distribution.*/
+ * the metric to zero. */
int metric_reset(metric_t *m);
/* metric_list_t is an unordered list of metrics. */
* metric_family_free(). */
metric_family_t *metric_family_clone(metric_family_t const *fam);
-/*The static function metric_list_clone creates a clone of the argument metric_list_t src. For each metric_t element
- *in the src list it checks if its value is a distribution metric and if yes, calls the distribution_clone function
- *for the value and saves the pointer to the returned distribution_t clone into the metric_list_t dest. If
- *the value is not a distribution_t, it simply sets the value of the element in the destination list to the value
- *of the element in the source list. */
-
#endif