]> git.ipfire.org Git - thirdparty/collectd.git/commit
write_prometheus plugin: Improve label sanitation.
authorFlorian Forster <octo@collectd.org>
Sat, 23 Dec 2023 19:27:44 +0000 (20:27 +0100)
committerFlorian Forster <octo@collectd.org>
Thu, 28 Dec 2023 19:13:31 +0000 (20:13 +0100)
commitab8639d3f31dab81de5da085e3b77fff27cea43f
treebd83643d38c2f4bb32a8f06268d6692f9cd6a3ec
parentebc1acd2c82eb210f53727d9fe26c9847d2bb8f7
write_prometheus plugin: Improve label sanitation.

This copies the behavior of the OpenTelemetry Prometheus translator:

1.  Replace all invalid characters with underscores.
2.  If the name starts with a single underscore, add the prefix `key`.
3.  If the name stars with a digit, add the prefix `key_`.
src/write_prometheus.c
src/write_prometheus_test.c