]> git.ipfire.org Git - thirdparty/collectd.git/commit
write_prometheus plugin: Store resource attributes with the metric, not the metric...
authorFlorian Forster <octo@collectd.org>
Mon, 19 Feb 2024 20:56:02 +0000 (21:56 +0100)
committerFlorian Forster <octo@collectd.org>
Tue, 20 Feb 2024 15:00:28 +0000 (16:00 +0100)
commit2e07ddaa84b2a593b2fe6af92beb9b7cb71d5442
treebf7357aee4f61aed98595fc7942d69731cf0f70d
parent70829e9a4cef615be585e7d8d4d3c4db6806d714
write_prometheus plugin: Store resource attributes with the metric, not the metric family.

For Prometheus output, the plugin groups all metrics with the same name into
one `metric_family_t`. This caused problems when collectd handled metrics from
multiple resources.

To solve this issue, we're somewhat abusing the data structure and store
per-metric resource attributes in the `family` field. That means for the
metrics stored in the *write_prometheus plugin* `(metric_t).family` does not
point back to the metric family containing the metric.

Fixes: #4283
src/write_prometheus.c
src/write_prometheus_test.c