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:
parent
e5a566f0bb
commit
f31bdfdfb3
@ -57,6 +57,7 @@ String FormatMetricName(const char *metric) { // cleanup spaces and uppercases
|
||||
String formatted = metric;
|
||||
formatted.toLowerCase();
|
||||
formatted.replace(" ", "_");
|
||||
formatted.replace(".", "_");
|
||||
return formatted;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user