Add period char replacement for prometheus

This was a problem for me when trying to get output from an SDS011 Nova
PM sensor. When parsed by the pometheus code it returns labels / metrics
like:

```# TYPE tasmota_sensors_pm2.5_ gauge
tasmota_sensors_pm2.5_{sensor="sds0x1"} 2.2```

 The error from prometheus was:
 ```"append failed" err="invalid metric type \\"5_ gauge\\"```
This commit is contained in:
Alex Brown 2021-03-17 22:26:24 -04:00
parent e5a566f0bb
commit f31bdfdfb3
No known key found for this signature in database
GPG Key ID: 7ED3AD05C48127EA
1 changed files with 1 additions and 0 deletions

View File

@ -57,6 +57,7 @@ String FormatMetricName(const char *metric) { // cleanup spaces and uppercases
String formatted = metric;
formatted.toLowerCase();
formatted.replace(" ", "_");
formatted.replace(".", "_");
return formatted;
}