feat: add /api/system/metrics endpoint

This commit is contained in:
Jakob
2025-12-07 11:31:55 +01:00
parent 64058b0f61
commit a01f10b042
3 changed files with 242 additions and 1 deletions

View File

@@ -1773,8 +1773,11 @@ std::string EMSdevice::get_metrics_prometheus(const int8_t tag) {
metric_name = metric_name.substr(last_dot + 1);
}
// sanitize metric name: convert to lowercase and replace non-alphanumeric with underscores
for (char & c : metric_name) {
if (!isalnum(c) && c != '_') {
if (isupper(c)) {
c = tolower(c);
} else if (!isalnum(c) && c != '_') {
c = '_';
}
}