if (unit != NULL) {
strbuf_printf(buf, "_%s", unit->prometheus);
} else if (fam->unit != NULL && fam->unit[0] != '{') {
- strbuf_printf(buf, "_%s", fam->unit);
+ strbuf_print(buf, "_");
+ strbuf_print_restricted(buf, fam->unit, VALID_NAME_CHARS, '_');
}
if (fam->type == METRIC_TYPE_COUNTER) {
.unit = "%",
.want = "storage_filesystem_utilization_percent",
},
- /* Not yet supported:
{
.name = "astro.light.speed",
.type = METRIC_TYPE_GAUGE,
.unit = "m/s",
+ .want = "astro_light_speed_m_s",
+ /* Not yet supported. Should be:
.want = "astro_light_speed_meters_per_second",
+ */
},
- */
};
for (size_t i = 0; i < STATIC_ARRAY_SIZE(cases); i++) {