chore: reserve string capacity for prometheus metrics

This commit is contained in:
Jakob
2025-12-12 14:08:47 +01:00
parent dcfd0d5b11
commit c11402195f
2 changed files with 27 additions and 3 deletions

View File

@@ -1568,6 +1568,8 @@ std::string System::get_metrics_prometheus() {
std::string result;
std::unordered_map<std::string, bool> seen_metrics;
result.reserve(16000);
// get system data
JsonDocument doc;
JsonObject root = doc.to<JsonObject>();
@@ -1797,6 +1799,8 @@ std::string System::get_metrics_prometheus() {
// process root object
process_object(root, "");
result.shrink_to_fit();
return result;
}