From: Florian Forster Date: Sun, 17 Dec 2023 12:20:28 +0000 (+0100) Subject: src/daemon/metric.[ch]: Add `unit` to `metric_family_t`. X-Git-Tag: 6.0.0-rc0~21^2~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ff1fcad9b3e6046e05900647cffca35bdc673204;p=thirdparty%2Fcollectd.git src/daemon/metric.[ch]: Add `unit` to `metric_family_t`. --- diff --git a/src/daemon/metric.c b/src/daemon/metric.c index 0fed18e7d..465440943 100644 --- a/src/daemon/metric.c +++ b/src/daemon/metric.c @@ -478,6 +478,7 @@ void metric_family_free(metric_family_t *fam) { free(fam->name); free(fam->help); + free(fam->unit); label_set_reset(&fam->resource); metric_list_reset(&fam->metric); free(fam); @@ -498,6 +499,9 @@ metric_family_t *metric_family_clone(metric_family_t const *fam) { if (fam->help != NULL) { ret->help = strdup(fam->help); } + if (fam->unit != NULL) { + ret->unit = strdup(fam->unit); + } ret->type = fam->type; int status = label_set_clone(&ret->resource, fam->resource); diff --git a/src/daemon/metric.h b/src/daemon/metric.h index e741ab9e7..69d890a60 100644 --- a/src/daemon/metric.h +++ b/src/daemon/metric.h @@ -166,6 +166,7 @@ typedef struct { struct metric_family_s { char *name; char *help; + char *unit; metric_type_t type; label_set_t resource;