From bb0a8dec796f5aff109b4e9c77846590b7a00fe2 Mon Sep 17 00:00:00 2001 From: Taddes Date: Tue, 28 Apr 2026 00:29:33 +0300 Subject: [PATCH] fix: api db error metric (#2245) fix: api db error metric --- syncstorage-spanner/src/error.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/syncstorage-spanner/src/error.rs b/syncstorage-spanner/src/error.rs index c0200729..bdd2af26 100644 --- a/syncstorage-spanner/src/error.rs +++ b/syncstorage-spanner/src/error.rs @@ -178,14 +178,23 @@ impl ReportableError for DbError { } } -/// Whether to ignore a 13 - INTERNAL error based on its status +/// Whether to ignore a 13 - INTERNAL error based on its status message. +/// +/// These errors are transient gRPC/HTTP2 transport errors that should be +/// emitted as metrics rather than reported to Sentry. The RST_STREAM variants +/// are safe to suppress because the server resets the stream before any +/// application state is changed, making them candidates for client retry. +/// Due to gPRC libs being a bit inconsistent with formatting, the array covers +/// possible variants. fn is_ignored_internal(status: &grpcio::RpcStatus) -> bool { + let msg = status.message().to_lowercase(); [ "rst_stream", "rst stream", "received unexpected eos on data frame from server", ] - .contains(&status.message().to_lowercase().as_str()) + .iter() + .any(|s| msg.contains(s)) } impl InternalError for DbError {