Skip to content

Commit 73423bc

Browse files
committed
feat docs: update 'network-error' corresponding details
commit_hash:6c720f78deb0360bd2ea4067a3c64d493b979152
1 parent f68d3ad commit 73423bc

4 files changed

Lines changed: 24 additions & 13 deletions

File tree

grpc/include/userver/ugrpc/client/completion_status.hpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,19 @@ namespace ugrpc::client {
2525
/// @see @ref CompletionStatus
2626
enum class SpecialCaseCompletionType : std::uint8_t {
2727
/// [special_cases_declaration]
28-
/// @brief Network-level error occurred before receiving a gRPC status.
28+
/// @brief The RPC was interrupted at the network/transport level without a gRPC status.
2929
///
30-
/// Indicates that the underlying network operation failed (e.g., connection lost,
31-
/// socket error) before the server could send a proper gRPC status response.
32-
/// This means that the underlying grpcpp framework returned an error.
33-
/// This is distinct from `grpc::StatusCode::UNAVAILABLE` which is a valid gRPC status.
30+
/// The call did not finish with a gRPC status from the server: the connection was lost, reset
31+
/// or otherwise interrupted. This is distinct from `grpc::StatusCode::UNAVAILABLE`, which is a
32+
/// valid gRPC status.
33+
///
34+
/// For a unary call this is reported only when no concrete gRPC status is available and the
35+
/// response could not be obtained (not received, or received but not parseable). Whenever a
36+
/// concrete status is available instead (for example `UNAVAILABLE` or `CANCELLED`), it is
37+
/// reported as that `grpc::Status` rather than as this special case.
38+
///
39+
/// Surfaces to the caller as @ref ugrpc::client::RpcInterruptedError; for unary calls it is
40+
/// retryable.
3441
kNetworkError,
3542
/// @brief Request timed out with deadline propagation enabled.
3643
///

grpc/include/userver/ugrpc/client/exceptions.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,10 @@ class RpcError : public BaseError {
3434
RpcError(std::string_view call_name, std::string_view additional_info);
3535
};
3636

37-
/// @brief RPC failed without a status. This means that either the call got
38-
/// cancelled using `TryCancel` or the channel is broken.
37+
/// @brief RPC failed without a gRPC status because it was interrupted at the transport level
38+
/// (cancelled via `TryCancel`, or the connection was lost/reset). For a unary call it is thrown
39+
/// only when no concrete gRPC status is available; when a status is available it is instead
40+
/// surfaced as the corresponding @ref ugrpc::client::ErrorWithStatus. Retryable.
3941
/// Note: Deadline expiration throws @ref ugrpc::client::DeadlineExceededError
4042
class RpcInterruptedError final : public RpcError {
4143
public:

scripts/docs/en/userver/grpc/grpc.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,10 @@ These are the metrics provided for each gRPC method:
429429
* `network-error` — other RPCs that finished abruptly without a status,
430430
see ugrpc::client::RpcInterruptedError and
431431
ugrpc::server::RpcInterruptedError.
432-
Such a unary network error is retryable, see
432+
Client-side, a unary call is counted here only when it was interrupted at the
433+
transport level and no concrete gRPC status is available; when a status is
434+
available (for example `UNAVAILABLE` or `CANCELLED`), it is reported under that
435+
status instead. Such a unary network error is retryable, see
433436
@ref scripts/docs/en/userver/grpc/timeouts_retries.md.
434437
* `abandoned-error` — RPCs that we forgot to `Finish`
435438
A client code drops an RPC object and don't wait of a response from a server OR is a bug in `ugrpc` usage.

scripts/docs/en/userver/grpc/timeouts_retries.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,11 @@ Conditions for a retry to occur:
4949
3. The overall Deadline (including from @ref scripts/docs/en/userver/deadline_propagation.md) has not been exceeded;
5050
4. The @ref ugrpc::client::RetryLimiter "retry limiter" (if configured) allows the retry.
5151

52-
@note In addition to the retryable status codes above, a unary network error
52+
@note A unary call interrupted at the transport level is retried like any other error: when a
53+
concrete gRPC status is available (for example `UNAVAILABLE` or `CANCELLED`) it is retried by that
54+
status code; otherwise it is reported as a network error
5355
(@ref ugrpc::client::SpecialCaseCompletionType "kNetworkError", surfaced as
54-
ugrpc::client::RpcInterruptedError) is also retryable. This includes the case when the completion
55-
queue reports `ok=false` on `Finish`, e.g. a response that was received but could not be
56-
deserialized. Note that grpc-core does not retry the latter on its own, because it had already
57-
observed a successful status on the wire; it is the userver retry loop that retries it.
56+
ugrpc::client::RpcInterruptedError), which is also retryable.
5857

5958
### Configuring Retries
6059

0 commit comments

Comments
 (0)