core/homeassistant/components/prometheus
Andrew Rowson 770eeaf82f Encode prometheus metric names per the prom spec (#26639)
Referencing issue #26418.

Prometheus metric names can only contain chars a-zA-Z0-9, : and _
(https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels).

HA currently generates invalid prometheus names, e.g. if the unit for a
sensor is a non-ASCII character containing  ° or μ. To resolve, we need
to sanitize the name before creating, replacing non-valid characters
with a valid representation. In this case, I've used
"u{unicode-hex-code}".

Also updated the test case to make sure that the ° case is handled.
2019-09-19 12:51:49 +02:00
..
__init__.py Encode prometheus metric names per the prom spec (#26639) 2019-09-19 12:51:49 +02:00
manifest.json Prometheus metrics naming based on device_class and unit_of_measurement (#24103) 2019-08-10 14:35:04 +02:00