mirror of
https://github.com/tbnobody/OpenDTU.git
synced 2025-12-11 17:30:37 +01:00
Merge branch 'pr2633' into dev
This commit is contained in:
@@ -42,7 +42,7 @@ build_unflags =
|
|||||||
-std=gnu++11
|
-std=gnu++11
|
||||||
|
|
||||||
lib_deps =
|
lib_deps =
|
||||||
ESP32Async/ESPAsyncWebServer @ 3.7.4
|
ESP32Async/ESPAsyncWebServer @ 3.7.6
|
||||||
bblanchon/ArduinoJson @ 7.3.1
|
bblanchon/ArduinoJson @ 7.3.1
|
||||||
https://github.com/bertmelis/espMqttClient.git#v1.7.0
|
https://github.com/bertmelis/espMqttClient.git#v1.7.0
|
||||||
nrf24/RF24 @ 1.4.11
|
nrf24/RF24 @ 1.4.11
|
||||||
|
|||||||
@@ -20,12 +20,14 @@ void WebApiPrometheusClass::init(AsyncWebServer& server, Scheduler& scheduler)
|
|||||||
|
|
||||||
void WebApiPrometheusClass::onPrometheusMetricsGet(AsyncWebServerRequest* request)
|
void WebApiPrometheusClass::onPrometheusMetricsGet(AsyncWebServerRequest* request)
|
||||||
{
|
{
|
||||||
|
static size_t initialResponseBufferSize = 1024;
|
||||||
|
|
||||||
if (!WebApi.checkCredentialsReadonly(request)) {
|
if (!WebApi.checkCredentialsReadonly(request)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
auto stream = request->beginResponseStream("text/plain; charset=utf-8", 40960);
|
auto stream = request->beginResponseStream("text/plain; charset=utf-8", initialResponseBufferSize);
|
||||||
|
|
||||||
stream->print("# HELP opendtu_build Build info\n");
|
stream->print("# HELP opendtu_build Build info\n");
|
||||||
stream->print("# TYPE opendtu_build gauge\n");
|
stream->print("# TYPE opendtu_build gauge\n");
|
||||||
@@ -109,6 +111,10 @@ void WebApiPrometheusClass::onPrometheusMetricsGet(AsyncWebServerRequest* reques
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
stream->addHeader("Cache-Control", "no-cache");
|
stream->addHeader("Cache-Control", "no-cache");
|
||||||
|
if (stream->available() > initialResponseBufferSize) {
|
||||||
|
initialResponseBufferSize = stream->available();
|
||||||
|
MessageOutput.printf("Increased /api/prometheus/metrics initialResponseBufferSize to %" PRIu32 " bytes\r\n", initialResponseBufferSize);
|
||||||
|
}
|
||||||
request->send(stream);
|
request->send(stream);
|
||||||
|
|
||||||
} catch (std::bad_alloc& bad_alloc) {
|
} catch (std::bad_alloc& bad_alloc) {
|
||||||
|
|||||||
Reference in New Issue
Block a user