Add metric for write EAGAIN failures
This commit is contained in:
@@ -26,6 +26,11 @@ thread_local auto bytes_written =
|
|||||||
metric::create_counter("weaseldb_bytes_written_total",
|
metric::create_counter("weaseldb_bytes_written_total",
|
||||||
"Total number of bytes written to clients")
|
"Total number of bytes written to clients")
|
||||||
.create({});
|
.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
|
} // namespace
|
||||||
|
|
||||||
// Static thread-local storage for iovec buffer
|
// Static thread-local storage for iovec buffer
|
||||||
@@ -130,6 +135,8 @@ bool Connection::writeBytes() {
|
|||||||
continue; // Standard practice: retry on signal interruption
|
continue; // Standard practice: retry on signal interruption
|
||||||
}
|
}
|
||||||
if (errno == EAGAIN) {
|
if (errno == EAGAIN) {
|
||||||
|
// Increment EAGAIN failure metric
|
||||||
|
write_eagain_failures.inc();
|
||||||
// Increment bytes written metric before returning
|
// Increment bytes written metric before returning
|
||||||
if (total_bytes_written > 0) {
|
if (total_bytes_written > 0) {
|
||||||
bytes_written.inc(total_bytes_written);
|
bytes_written.inc(total_bytes_written);
|
||||||
|
|||||||
Reference in New Issue
Block a user