From 5d289ddd42a102b8521e69133ec7b4f786cd073c Mon Sep 17 00:00:00 2001 From: Andrew Noyes Date: Wed, 10 Sep 2025 16:48:27 -0400 Subject: [PATCH] Add metric for write EAGAIN failures --- src/connection.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/connection.cpp b/src/connection.cpp index b2c462c..f977389 100644 --- a/src/connection.cpp +++ b/src/connection.cpp @@ -26,6 +26,11 @@ thread_local auto bytes_written = metric::create_counter("weaseldb_bytes_written_total", "Total number of bytes written to clients") .create({}); +thread_local auto write_eagain_failures = + metric::create_counter( + "weaseldb_write_eagain_failures_total", + "Total number of write operations that failed with EAGAIN") + .create({}); } // namespace // Static thread-local storage for iovec buffer @@ -130,6 +135,8 @@ bool Connection::writeBytes() { continue; // Standard practice: retry on signal interruption } if (errno == EAGAIN) { + // Increment EAGAIN failure metric + write_eagain_failures.inc(); // Increment bytes written metric before returning if (total_bytes_written > 0) { bytes_written.inc(total_bytes_written);