transport: add error attributes indicating stream network state (#28546)

* transport: add error attributes indicating stream network state

* add missing case
pull/28556/head
Mark D. Roth 3 years ago committed by GitHub
parent 32b087e674
commit b2939f58d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/core/lib/gprpp/status_helper.cc
  2. 4
      src/core/lib/gprpp/status_helper.h
  3. 2
      src/core/lib/iomgr/error.cc
  4. 3
      src/core/lib/iomgr/error.h
  5. 14
      src/core/lib/transport/error_utils.h

@ -83,6 +83,8 @@ const char* GetStatusIntPropertyUrl(StatusIntProperty key) {
return TYPE_URL(TYPE_INT_TAG "channel_connectivity_state");
case StatusIntProperty::kLbPolicyDrop:
return TYPE_URL(TYPE_INT_TAG "lb_policy_drop");
case StatusIntProperty::kStreamNetworkState:
return TYPE_URL(TYPE_INT_TAG "stream_network_state");
}
GPR_UNREACHABLE_CODE(return "unknown");
}

@ -37,7 +37,6 @@ struct upb_arena;
namespace grpc_core {
/// This enum should have the same value of grpc_error_ints
// TODO(veblush): Use camel-case names once migration to absl::Status is done.
enum class StatusIntProperty {
/// 'errno' from the operating system
kErrorNo,
@ -72,10 +71,11 @@ enum class StatusIntProperty {
ChannelConnectivityState,
/// LB policy drop
kLbPolicyDrop,
/// stream network state
kStreamNetworkState,
};
/// This enum should have the same value of grpc_error_strs
// TODO(veblush): Use camel-case names once migration to absl::Status is done.
enum class StatusStrProperty {
/// top-level textual description of this error
kDescription,

@ -252,6 +252,8 @@ static const char* error_int_name(grpc_error_ints key) {
return "channel_connectivity_state";
case GRPC_ERROR_INT_LB_POLICY_DROP:
return "lb_policy_drop";
case GRPC_ERROR_INT_STREAM_NETWORK_STATE:
return "stream_network_state";
case GRPC_ERROR_INT_MAX:
GPR_UNREACHABLE_CODE(return "unknown");
}

@ -96,6 +96,9 @@ typedef enum {
/// LB policy drop
GRPC_ERROR_INT_LB_POLICY_DROP =
static_cast<int>(grpc_core::StatusIntProperty::kLbPolicyDrop),
/// stream network state
GRPC_ERROR_INT_STREAM_NETWORK_STATE =
static_cast<int>(grpc_core::StatusIntProperty::kStreamNetworkState),
/// Must always be last
GRPC_ERROR_INT_MAX,

@ -27,6 +27,20 @@
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/transport/http2_errors.h"
namespace grpc_core {
enum class StreamNetworkState {
// Stream was never sent on the wire (e.g., because the transport became
// disconnected by the time the call got down to it).
kNotSentOnWire,
// Stream was sent on the wire but was not seen by the server application
// code (e.g., client sent data but then received a GOAWAY with a lower
// stream ID).
kNotSeenByServer,
};
} // namespace grpc_core
/// A utility function to get the status code and message to be returned
/// to the application. If not set in the top-level message, looks
/// through child errors until it finds the first one with these attributes.

Loading…
Cancel
Save