#include "metric.h"
#include "plugin.h"
+typed_value_t typed_value_clone(typed_value_t val) {
+ typed_value_t copy = {
+ .value = val.value,
+ .type = val.type,
+ };
+ if (val.type == METRIC_TYPE_DISTRIBUTION) {
+ copy.value.distribution = distribution_clone(val.value.distribution);
+ }
+ return copy;
+}
+
/* Label names must match the regex `[a-zA-Z_][a-zA-Z0-9_]*`. Label names
* beginning with __ are reserved for internal use.
*
};
typedef union value_u value_t;
+typedef struct {
+ value_t value;
+ metric_type_t type;
+} typed_value_t;
+
+typed_value_t typed_value_clone(typed_value_t val);
+
/* 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);