mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-16 04:39:56 +03:00
chore: reserve string capacity for prometheus metrics
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user