Revert "filter stack: pass peer name up via recv_initial_metadata batch" (#32415)

Reverts grpc/grpc#31933
pull/32326/head^2
Mark D. Roth 2 years ago committed by GitHub
parent 1c5db3404b
commit 7fab06b923
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      BUILD
  2. 1
      src/core/BUILD
  3. 32
      src/core/ext/filters/client_channel/client_channel.cc
  4. 6
      src/core/ext/filters/client_channel/client_channel.h
  5. 12
      src/core/ext/filters/client_channel/retry_filter.cc
  6. 2
      src/core/ext/filters/client_channel/subchannel_stream_client.cc
  7. 7
      src/core/ext/filters/load_reporting/server_load_reporting_filter.cc
  8. 13
      src/core/ext/filters/stateful_session/stateful_session_filter.cc
  9. 81
      src/core/ext/transport/chttp2/transport/chttp2_transport.cc
  10. 2
      src/core/ext/transport/chttp2/transport/flow_control.cc
  11. 3
      src/core/ext/transport/chttp2/transport/flow_control.h
  12. 5
      src/core/ext/transport/chttp2/transport/frame_settings.cc
  13. 4
      src/core/ext/transport/chttp2/transport/internal.h
  14. 5
      src/core/ext/transport/chttp2/transport/parsing.cc
  15. 15
      src/core/ext/transport/chttp2/transport/writing.cc
  16. 6
      src/core/lib/channel/call_tracer.h
  17. 4
      src/core/lib/channel/connected_channel.cc
  18. 57
      src/core/lib/surface/call.cc
  19. 14
      src/core/lib/transport/bdp_estimator.cc
  20. 16
      src/core/lib/transport/bdp_estimator.h
  21. 5
      src/core/lib/transport/metadata_batch.cc
  22. 4
      src/core/lib/transport/metadata_batch.h
  23. 13
      src/core/lib/transport/transport.h
  24. 13
      src/cpp/common/channel_filter.h
  25. 2
      src/cpp/ext/filters/census/open_census_call_tracer.h
  26. 6
      src/cpp/ext/filters/logging/logging_filter.cc

@ -3679,6 +3679,7 @@ grpc_cc_library(
"//src/core:chttp2_flow_control",
"//src/core:closure",
"//src/core:error",
"//src/core:gpr_atm",
"//src/core:http2_errors",
"//src/core:http2_settings",
"//src/core:init_internally",

@ -2225,7 +2225,6 @@ grpc_cc_library(
"lib/transport/bdp_estimator.cc",
],
hdrs = ["lib/transport/bdp_estimator.h"],
external_deps = ["absl/strings"],
deps = [
"time",
"//:gpr",

@ -2720,6 +2720,11 @@ void ClientChannel::LoadBalancedCall::StartTransportStreamOpBatch(
if (batch->send_initial_metadata) {
call_attempt_tracer_->RecordSendInitialMetadata(
batch->payload->send_initial_metadata.send_initial_metadata);
peer_string_ = batch->payload->send_initial_metadata.peer_string;
original_send_initial_metadata_on_complete_ = batch->on_complete;
GRPC_CLOSURE_INIT(&send_initial_metadata_on_complete_,
SendInitialMetadataOnComplete, this, nullptr);
batch->on_complete = &send_initial_metadata_on_complete_;
}
if (batch->send_message) {
call_attempt_tracer_->RecordSendMessage(
@ -2830,6 +2835,21 @@ void ClientChannel::LoadBalancedCall::StartTransportStreamOpBatch(
}
}
void ClientChannel::LoadBalancedCall::SendInitialMetadataOnComplete(
void* arg, grpc_error_handle error) {
auto* self = static_cast<LoadBalancedCall*>(arg);
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
gpr_log(GPR_INFO,
"chand=%p lb_call=%p: got on_complete for send_initial_metadata: "
"error=%s",
self->chand_, self, StatusToString(error).c_str());
}
self->call_attempt_tracer_->RecordOnDoneSendInitialMetadata(
self->peer_string_);
Closure::Run(DEBUG_LOCATION,
self->original_send_initial_metadata_on_complete_, error);
}
void ClientChannel::LoadBalancedCall::RecvInitialMetadataReady(
void* arg, grpc_error_handle error) {
auto* self = static_cast<LoadBalancedCall*>(arg);
@ -2920,14 +2940,10 @@ void ClientChannel::LoadBalancedCall::RecordCallCompletion(
if (lb_subchannel_call_tracker_ != nullptr) {
Metadata trailing_metadata(recv_trailing_metadata_);
BackendMetricAccessor backend_metric_accessor(this);
absl::string_view peer_string;
if (recv_initial_metadata_ != nullptr) {
Slice* peer_string_slice =
recv_initial_metadata_->get_pointer(PeerString());
if (peer_string_slice != nullptr) {
peer_string = peer_string_slice->as_string_view();
}
}
const char* peer_string =
peer_string_ != nullptr
? reinterpret_cast<char*>(gpr_atm_acq_load(peer_string_))
: "";
LoadBalancingPolicy::SubchannelCallTrackerInterface::FinishArgs args = {
peer_string, status, &trailing_metadata, &backend_metric_accessor};
lb_subchannel_call_tracker_->Finish(args);

@ -35,6 +35,7 @@
#include <grpc/grpc.h>
#include <grpc/impl/connectivity_state.h>
#include <grpc/support/atm.h>
#include "src/core/ext/filters/client_channel/client_channel_factory.h"
#include "src/core/ext/filters/client_channel/config_selector.h"
@ -529,6 +530,11 @@ class ClientChannel::LoadBalancedCall
RefCountedPtr<SubchannelCall> subchannel_call_;
// For intercepting send_initial_metadata on_complete.
gpr_atm* peer_string_ = nullptr;
grpc_closure send_initial_metadata_on_complete_;
grpc_closure* original_send_initial_metadata_on_complete_ = nullptr;
// For intercepting recv_initial_metadata_ready.
grpc_metadata_batch* recv_initial_metadata_ = nullptr;
grpc_closure recv_initial_metadata_ready_;

@ -38,6 +38,7 @@
#include <grpc/grpc.h>
#include <grpc/slice.h>
#include <grpc/status.h>
#include <grpc/support/atm.h>
#include <grpc/support/log.h>
#include "src/core/ext/filters/client_channel/client_channel.h"
@ -611,6 +612,15 @@ class RetryFilter::CallData {
// send_initial_metadata
bool seen_send_initial_metadata_ = false;
grpc_metadata_batch send_initial_metadata_{arena_};
// TODO(roth): As part of implementing hedging, we'll probably need to
// have the LB call set a value in CallAttempt and then propagate it
// from CallAttempt to the parent call when we commit. Otherwise, we
// may leave this with a value for a peer other than the one we
// actually commit to. Alternatively, maybe see if there's a way to
// change the surface API such that the peer isn't available until
// after initial metadata is received? (Could even change the
// transport API to return this with the recv_initial_metadata op.)
gpr_atm* peer_string_;
// send_message
// When we get a send_message op, we replace the original byte stream
// with a CachingByteStream that caches the slices to a local buffer for
@ -1976,6 +1986,7 @@ void RetryFilter::CallData::CallAttempt::BatchData::
batch_.send_initial_metadata = true;
batch_.payload->send_initial_metadata.send_initial_metadata =
&call_attempt_->send_initial_metadata_;
batch_.payload->send_initial_metadata.peer_string = calld->peer_string_;
}
void RetryFilter::CallData::CallAttempt::BatchData::
@ -2323,6 +2334,7 @@ void RetryFilter::CallData::MaybeCacheSendOpsForBatch(PendingBatch* pending) {
grpc_metadata_batch* send_initial_metadata =
batch->payload->send_initial_metadata.send_initial_metadata;
send_initial_metadata_ = send_initial_metadata->Copy();
peer_string_ = batch->payload->send_initial_metadata.peer_string;
}
// Set up cache for send_message ops.
if (batch->send_message) {

@ -242,6 +242,7 @@ void SubchannelStreamClient::CallState::StartCallLocked() {
GPR_ASSERT(error.ok());
payload_.send_initial_metadata.send_initial_metadata =
&send_initial_metadata_;
payload_.send_initial_metadata.peer_string = nullptr;
batch_.send_initial_metadata = true;
// Add send_message op.
send_message_.Append(Slice(
@ -256,6 +257,7 @@ void SubchannelStreamClient::CallState::StartCallLocked() {
payload_.recv_initial_metadata.recv_initial_metadata =
&recv_initial_metadata_;
payload_.recv_initial_metadata.trailing_metadata_available = nullptr;
payload_.recv_initial_metadata.peer_string = nullptr;
// recv_initial_metadata_ready callback takes ref, handled manually.
call_->Ref(DEBUG_LOCATION, "recv_initial_metadata_ready").release();
payload_.recv_initial_metadata.recv_initial_metadata_ready =

@ -98,15 +98,14 @@ namespace {
std::string GetCensusSafeClientIpString(
const ClientMetadataHandle& initial_metadata) {
// Find the client URI string.
Slice* client_uri_slice = initial_metadata->get_pointer(PeerString());
if (client_uri_slice == nullptr) {
auto client_uri_str = initial_metadata->get(PeerString());
if (!client_uri_str.has_value()) {
gpr_log(GPR_ERROR,
"Unable to extract client URI string (peer string) from gRPC "
"metadata.");
return "";
}
absl::StatusOr<URI> client_uri =
URI::Parse(client_uri_slice->as_string_view());
absl::StatusOr<URI> client_uri = URI::Parse(*client_uri_str);
if (!client_uri.ok()) {
gpr_log(GPR_ERROR,
"Unable to parse the client URI string (peer string) to a client "

@ -89,14 +89,13 @@ void MaybeUpdateServerInitialMetadata(
absl::optional<absl::string_view> cookie_value,
ServerMetadata* server_initial_metadata) {
// Get peer string.
Slice* peer_string = server_initial_metadata->get_pointer(PeerString());
if (peer_string == nullptr) return; // Nothing we can do.
auto peer_string = server_initial_metadata->get(PeerString());
if (!peer_string.has_value()) return; // Nothing we can do.
// If there was no cookie or if the address changed, set the cookie.
if (!cookie_value.has_value() ||
peer_string->as_string_view() != *cookie_value) {
std::vector<std::string> parts = {absl::StrCat(
*cookie_config->name, "=",
absl::Base64Escape(peer_string->as_string_view()), "; HttpOnly")};
if (!cookie_value.has_value() || *peer_string != *cookie_value) {
std::vector<std::string> parts = {
absl::StrCat(*cookie_config->name, "=",
absl::Base64Escape(*peer_string), "; HttpOnly")};
if (!cookie_config->path.empty()) {
parts.emplace_back(absl::StrCat("Path=", cookie_config->path));
}

@ -45,6 +45,7 @@
#include <grpc/slice_buffer.h>
#include <grpc/status.h>
#include <grpc/support/alloc.h>
#include <grpc/support/atm.h>
#include <grpc/support/log.h>
#include <grpc/support/time.h>
@ -342,10 +343,8 @@ static void read_channel_args(grpc_chttp2_transport* t,
.value_or(GRPC_ENABLE_CHANNELZ_DEFAULT)) {
t->channelz_socket =
grpc_core::MakeRefCounted<grpc_core::channelz::SocketNode>(
std::string(grpc_endpoint_get_local_address(t->ep)),
std::string(t->peer_string.as_string_view()),
absl::StrFormat("%s %s", get_vtable()->name,
t->peer_string.as_string_view()),
std::string(grpc_endpoint_get_local_address(t->ep)), t->peer_string,
absl::StrFormat("%s %s", get_vtable()->name, t->peer_string),
channel_args
.GetObjectRef<grpc_core::channelz::SocketNode::Security>());
}
@ -482,8 +481,7 @@ grpc_chttp2_transport::grpc_chttp2_transport(
? "chttp2_refcount"
: nullptr),
ep(ep),
peer_string(
grpc_core::Slice::FromCopiedString(grpc_endpoint_get_peer(ep))),
peer_string(grpc_endpoint_get_peer(ep)),
memory_owner(channel_args.GetObject<grpc_core::ResourceQuota>()
->memory_quota()
->CreateMemoryOwner(absl::StrCat(
@ -496,7 +494,7 @@ grpc_chttp2_transport::grpc_chttp2_transport(
is_client(is_client),
next_stream_id(is_client ? 1 : 2),
flow_control(
peer_string.as_string_view(),
peer_string.c_str(),
channel_args.GetBool(GRPC_ARG_HTTP2_BDP_PROBE).value_or(true),
&memory_owner),
deframe_state(is_client ? GRPC_DTS_FH_0 : GRPC_DTS_CLIENT_PREFIX_0),
@ -816,8 +814,7 @@ static void set_write_state(grpc_chttp2_transport* t,
grpc_chttp2_write_state st, const char* reason) {
GRPC_CHTTP2_IF_TRACING(
gpr_log(GPR_INFO, "W:%p %s [%s] state %s -> %s [%s]", t,
t->is_client ? "CLIENT" : "SERVER",
std::string(t->peer_string.as_string_view()).c_str(),
t->is_client ? "CLIENT" : "SERVER", t->peer_string.c_str(),
write_state_name(t->write_state), write_state_name(st), reason));
t->write_state = st;
// If the state is being reset back to idle, it means a write was just
@ -1052,9 +1049,8 @@ void grpc_chttp2_add_incoming_goaway(grpc_chttp2_transport* t,
// We want to log this irrespective of whether http tracing is enabled if we
// received a GOAWAY with a non NO_ERROR code.
if (goaway_error != GRPC_HTTP2_NO_ERROR) {
gpr_log(GPR_INFO, "%s: Got goaway [%d] err=%s",
std::string(t->peer_string.as_string_view()).c_str(), goaway_error,
grpc_core::StatusToString(t->goaway_error).c_str());
gpr_log(GPR_INFO, "%s: Got goaway [%d] err=%s", t->peer_string.c_str(),
goaway_error, grpc_core::StatusToString(t->goaway_error).c_str());
}
if (t->is_client) {
cancel_unstarted_streams(t, t->goaway_error);
@ -1085,8 +1081,7 @@ void grpc_chttp2_add_incoming_goaway(grpc_chttp2_transport* t,
"%s: Received a GOAWAY with error code ENHANCE_YOUR_CALM and debug "
"data equal to \"too_many_pings\". Current keepalive time (before "
"throttling): %s",
std::string(t->peer_string.as_string_view()).c_str(),
t->keepalive_time.ToString().c_str());
t->peer_string.c_str(), t->keepalive_time.ToString().c_str());
constexpr int max_keepalive_time_millis =
INT_MAX / KEEPALIVE_TIME_BACKOFF_MULTIPLIER;
int64_t throttled_keepalive_time =
@ -1214,9 +1209,8 @@ void grpc_chttp2_complete_closure_step(grpc_chttp2_transport* t,
" write_state=", write_state_name(t->write_state), " refs=",
closure->next_data.scratch / CLOSURE_BARRIER_FIRST_REF_BIT, " flags=",
closure->next_data.scratch % CLOSURE_BARRIER_FIRST_REF_BIT));
cl_err = grpc_error_set_str(cl_err,
grpc_core::StatusStrProperty::kTargetAddress,
std::string(t->peer_string.as_string_view()));
cl_err = grpc_error_set_str(
cl_err, grpc_core::StatusStrProperty::kTargetAddress, t->peer_string);
}
cl_err = grpc_error_add_child(cl_err, error);
closure->error_data.error = grpc_core::internal::StatusAllocHeapPtr(cl_err);
@ -1345,6 +1339,10 @@ static void perform_stream_op_locked(void* stream_op,
&s->write_closed_error, 1),
"send_initial_metadata_finished");
}
if (op_payload->send_initial_metadata.peer_string != nullptr) {
gpr_atm_rel_store(op_payload->send_initial_metadata.peer_string,
(gpr_atm)t->peer_string.c_str());
}
}
if (op->send_message) {
@ -1464,6 +1462,10 @@ static void perform_stream_op_locked(void* stream_op,
if (s->parsed_trailers_only && s->trailing_metadata_available != nullptr) {
*s->trailing_metadata_available = true;
}
if (op_payload->recv_initial_metadata.peer_string != nullptr) {
gpr_atm_rel_store(op_payload->recv_initial_metadata.peer_string,
(gpr_atm)t->peer_string.c_str());
}
grpc_chttp2_maybe_complete_recv_initial_metadata(t, s);
}
@ -1612,7 +1614,7 @@ void grpc_chttp2_ack_ping(grpc_chttp2_transport* t, uint64_t id) {
grpc_chttp2_ping_queue* pq = &t->ping_queue;
if (pq->inflight_id != id) {
gpr_log(GPR_DEBUG, "Unknown ping response from %s: %" PRIx64,
std::string(t->peer_string.as_string_view()).c_str(), id);
t->peer_string.c_str(), id);
return;
}
grpc_core::ExecCtx::RunList(DEBUG_LOCATION,
@ -1659,12 +1661,11 @@ class GracefulGoaway : public grpc_core::RefCounted<GracefulGoaway> {
return;
}
if (t_->destroying || !t_->closed_with_error.ok()) {
GRPC_CHTTP2_IF_TRACING(
gpr_log(GPR_INFO,
"transport:%p %s peer:%s Transport already shutting down. "
"Graceful GOAWAY abandoned.",
t_, t_->is_client ? "CLIENT" : "SERVER",
std::string(t_->peer_string.as_string_view()).c_str()));
GRPC_CHTTP2_IF_TRACING(gpr_log(
GPR_INFO,
"transport:%p %s peer:%s Transport already shutting down. "
"Graceful GOAWAY abandoned.",
t_, t_->is_client ? "CLIENT" : "SERVER", t_->peer_string.c_str()));
return;
}
// Ping completed. Send final goaway.
@ -1673,8 +1674,7 @@ class GracefulGoaway : public grpc_core::RefCounted<GracefulGoaway> {
"transport:%p %s peer:%s Graceful shutdown: Ping received. "
"Sending final GOAWAY with stream_id:%d",
t_, t_->is_client ? "CLIENT" : "SERVER",
std::string(t_->peer_string.as_string_view()).c_str(),
t_->last_new_stream_id));
t_->peer_string.c_str(), t_->last_new_stream_id));
t_->sent_goaway_state = GRPC_CHTTP2_FINAL_GOAWAY_SEND_SCHEDULED;
grpc_chttp2_goaway_append(t_->last_new_stream_id, 0, grpc_empty_slice(),
&t_->qbuf);
@ -1737,8 +1737,7 @@ static void send_goaway(grpc_chttp2_transport* t, grpc_error_handle error,
} else if (t->sent_goaway_state == GRPC_CHTTP2_NO_GOAWAY_SEND ||
t->sent_goaway_state == GRPC_CHTTP2_GRACEFUL_GOAWAY) {
// We want to log this irrespective of whether http tracing is enabled
gpr_log(GPR_DEBUG, "%s: Sending goaway err=%s",
std::string(t->peer_string.as_string_view()).c_str(),
gpr_log(GPR_DEBUG, "%s: Sending goaway err=%s", t->peer_string.c_str(),
grpc_core::StatusToString(error).c_str());
t->sent_goaway_state = GRPC_CHTTP2_FINAL_GOAWAY_SEND_SCHEDULED;
grpc_chttp2_goaway_append(
@ -1847,8 +1846,7 @@ void grpc_chttp2_maybe_complete_recv_initial_metadata(grpc_chttp2_transport* t,
grpc_slice_buffer_reset_and_unref(&s->frame_storage);
}
*s->recv_initial_metadata = std::move(s->initial_metadata_buffer);
s->recv_initial_metadata->Set(grpc_core::PeerString(),
t->peer_string.Ref());
s->recv_initial_metadata->Set(grpc_core::PeerString(), t->peer_string);
// If we didn't receive initial metadata from the wire and instead faked a
// status (due to stream cancellations for example), let upper layers know
// that trailing metadata is immediately available.
@ -1963,6 +1961,7 @@ void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_chttp2_transport* t,
grpc_transport_move_stats(&s->stats, s->collecting_stats);
s->collecting_stats = nullptr;
*s->recv_trailing_metadata = std::move(s->trailing_metadata_buffer);
s->recv_trailing_metadata->Set(grpc_core::PeerString(), t->peer_string);
null_then_sched_closure(&s->recv_trailing_metadata_finished);
}
}
@ -2548,8 +2547,7 @@ static void start_bdp_ping(void* tp, grpc_error_handle error) {
static void start_bdp_ping_locked(void* tp, grpc_error_handle error) {
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {
gpr_log(GPR_INFO, "%s: Start BDP ping err=%s",
std::string(t->peer_string.as_string_view()).c_str(),
gpr_log(GPR_INFO, "%s: Start BDP ping err=%s", t->peer_string.c_str(),
grpc_core::StatusToString(error).c_str());
}
if (!error.ok() || !t->closed_with_error.ok()) {
@ -2573,8 +2571,7 @@ static void finish_bdp_ping(void* tp, grpc_error_handle error) {
static void finish_bdp_ping_locked(void* tp, grpc_error_handle error) {
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {
gpr_log(GPR_INFO, "%s: Complete BDP ping err=%s",
std::string(t->peer_string.as_string_view()).c_str(),
gpr_log(GPR_INFO, "%s: Complete BDP ping err=%s", t->peer_string.c_str(),
grpc_core::StatusToString(error).c_str());
}
if (!error.ok() || !t->closed_with_error.ok()) {
@ -2736,8 +2733,7 @@ static void start_keepalive_ping_locked(void* arg, grpc_error_handle error) {
}
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace) ||
GRPC_TRACE_FLAG_ENABLED(grpc_keepalive_trace)) {
gpr_log(GPR_INFO, "%s: Start keepalive ping",
std::string(t->peer_string.as_string_view()).c_str());
gpr_log(GPR_INFO, "%s: Start keepalive ping", t->peer_string.c_str());
}
GRPC_CHTTP2_REF_TRANSPORT(t, "keepalive watchdog");
t->keepalive_watchdog_timer_handle =
@ -2762,8 +2758,7 @@ static void finish_keepalive_ping_locked(void* arg, grpc_error_handle error) {
if (error.ok()) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace) ||
GRPC_TRACE_FLAG_ENABLED(grpc_keepalive_trace)) {
gpr_log(GPR_INFO, "%s: Finish keepalive ping",
std::string(t->peer_string.as_string_view()).c_str());
gpr_log(GPR_INFO, "%s: Finish keepalive ping", t->peer_string.c_str());
}
if (!t->keepalive_ping_started) {
// start_keepalive_ping_locked has not run yet. Reschedule
@ -2810,7 +2805,7 @@ static void keepalive_watchdog_fired_locked(
t->keepalive_watchdog_timer_handle.reset();
if (t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_PINGING) {
gpr_log(GPR_INFO, "%s: Keepalive watchdog fired. Closing transport.",
std::string(t->peer_string.as_string_view()).c_str());
t->peer_string.c_str());
t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_DYING;
close_transport_locked(
t, grpc_error_set_int(GRPC_ERROR_CREATE("keepalive watchdog timeout"),
@ -2834,7 +2829,7 @@ static void maybe_reset_keepalive_ping_timer_locked(grpc_chttp2_transport* t) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace) ||
GRPC_TRACE_FLAG_ENABLED(grpc_keepalive_trace)) {
gpr_log(GPR_INFO, "%s: Keepalive ping cancelled. Resetting timer.",
std::string(t->peer_string.as_string_view()).c_str());
t->peer_string.c_str());
}
t->keepalive_ping_timer_handle =
t->event_engine->RunAfter(t->keepalive_time, [t] {
@ -2927,7 +2922,7 @@ static void benign_reclaimer_locked(void* arg, grpc_error_handle error) {
// disconnect cleanly
if (GRPC_TRACE_FLAG_ENABLED(grpc_resource_quota_trace)) {
gpr_log(GPR_INFO, "HTTP2: %s - send goaway to free memory",
std::string(t->peer_string.as_string_view()).c_str());
t->peer_string.c_str());
}
send_goaway(t,
grpc_error_set_int(GRPC_ERROR_CREATE("Buffers full"),
@ -2938,7 +2933,7 @@ static void benign_reclaimer_locked(void* arg, grpc_error_handle error) {
gpr_log(GPR_INFO,
"HTTP2: %s - skip benign reclamation, there are still %" PRIdPTR
" streams",
std::string(t->peer_string.as_string_view()).c_str(),
t->peer_string.c_str(),
grpc_chttp2_stream_map_size(&t->stream_map));
}
t->benign_reclaimer_registered = false;
@ -2957,7 +2952,7 @@ static void destructive_reclaimer_locked(void* arg, grpc_error_handle error) {
grpc_chttp2_stream_map_rand(&t->stream_map));
if (GRPC_TRACE_FLAG_ENABLED(grpc_resource_quota_trace)) {
gpr_log(GPR_INFO, "HTTP2: %s - abandon stream id %d",
std::string(t->peer_string.as_string_view()).c_str(), s->id);
t->peer_string.c_str(), s->id);
}
grpc_chttp2_cancel_stream(
t, s,

@ -101,7 +101,7 @@ std::ostream& operator<<(std::ostream& out, const FlowControlAction& action) {
return out << action.DebugString();
}
TransportFlowControl::TransportFlowControl(absl::string_view name,
TransportFlowControl::TransportFlowControl(const char* name,
bool enable_bdp_probe,
MemoryOwner* memory_owner)
: memory_owner_(memory_owner),

@ -30,7 +30,6 @@
#include "absl/functional/function_ref.h"
#include "absl/status/status.h"
#include "absl/strings/string_view.h"
#include "absl/types/optional.h"
#include <grpc/support/log.h>
@ -169,7 +168,7 @@ std::ostream& operator<<(std::ostream& out, const FlowControlAction& action);
// to be as performant as possible.
class TransportFlowControl final {
public:
explicit TransportFlowControl(absl::string_view name, bool enable_bdp_probe,
explicit TransportFlowControl(const char* name, bool enable_bdp_probe,
MemoryOwner* memory_owner);
~TransportFlowControl() {}

@ -28,7 +28,6 @@
#include "absl/base/attributes.h"
#include "absl/status/status.h"
#include "absl/strings/str_format.h"
#include "absl/strings/string_view.h"
#include <grpc/slice_buffer.h>
#include <grpc/support/log.h>
@ -42,7 +41,6 @@
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/gprpp/debug_location.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/slice/slice.h"
static uint8_t* fill_header(uint8_t* out, uint32_t length, uint8_t flags) {
*out++ = static_cast<uint8_t>(length >> 16);
@ -231,8 +229,7 @@ grpc_error_handle grpc_chttp2_settings_parser_parse(void* p,
parser->incoming_settings[id] = parser->value;
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {
gpr_log(GPR_INFO, "CHTTP2:%s:%s: got setting %s = %d",
t->is_client ? "CLI" : "SVR",
std::string(t->peer_string.as_string_view()).c_str(),
t->is_client ? "CLI" : "SVR", t->peer_string.c_str(),
sp->name, parser->value);
}
} else if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {

@ -25,6 +25,7 @@
#include <stdint.h>
#include <memory>
#include <string>
#include "absl/strings/string_view.h"
#include "absl/types/optional.h"
@ -60,7 +61,6 @@
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/resource_quota/arena.h"
#include "src/core/lib/resource_quota/memory_quota.h"
#include "src/core/lib/slice/slice.h"
#include "src/core/lib/slice/slice_buffer.h"
#include "src/core/lib/surface/init_internally.h"
#include "src/core/lib/transport/connectivity_state.h"
@ -261,7 +261,7 @@ struct grpc_chttp2_transport
grpc_transport base; // must be first
grpc_core::RefCount refs;
grpc_endpoint* ep;
grpc_core::Slice peer_string;
std::string peer_string;
grpc_core::MemoryOwner memory_owner;
const grpc_core::MemoryAllocator::Reservation self_reservation;

@ -56,7 +56,6 @@
#include "src/core/lib/iomgr/closure.h"
#include "src/core/lib/iomgr/combiner.h"
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/slice/slice.h"
#include "src/core/lib/transport/bdp_estimator.h"
#include "src/core/lib/transport/error_utils.h"
#include "src/core/lib/transport/http2_errors.h"
@ -627,8 +626,8 @@ static grpc_error_handle init_header_frame_parser(grpc_chttp2_transport* t,
GPR_INFO,
"transport:%p SERVER peer:%s Final GOAWAY sent. Ignoring new "
"grpc_chttp2_stream request id=%d, last grpc_chttp2_stream id=%d",
t, std::string(t->peer_string.as_string_view()).c_str(),
t->incoming_stream_id, t->last_new_stream_id));
t, t->peer_string.c_str(), t->incoming_stream_id,
t->last_new_stream_id));
return init_header_skip_frame_parser(t, priority_type);
}
t->last_new_stream_id = t->incoming_stream_id;

@ -26,7 +26,6 @@
#include <string>
#include "absl/status/status.h"
#include "absl/strings/string_view.h"
#include "absl/types/optional.h"
#include <grpc/event_engine/event_engine.h>
@ -95,8 +94,7 @@ static void maybe_initiate_ping(grpc_chttp2_transport* t) {
GRPC_TRACE_FLAG_ENABLED(grpc_bdp_estimator_trace) ||
GRPC_TRACE_FLAG_ENABLED(grpc_keepalive_trace)) {
gpr_log(GPR_INFO, "%s: Ping delayed [%s]: already pinging",
t->is_client ? "CLIENT" : "SERVER",
std::string(t->peer_string.as_string_view()).c_str());
t->is_client ? "CLIENT" : "SERVER", t->peer_string.c_str());
}
return;
}
@ -108,8 +106,7 @@ static void maybe_initiate_ping(grpc_chttp2_transport* t) {
GRPC_TRACE_FLAG_ENABLED(grpc_keepalive_trace)) {
gpr_log(GPR_INFO,
"CLIENT: Ping delayed [%s]: too many recent pings: %d/%d",
std::string(t->peer_string.as_string_view()).c_str(),
t->ping_state.pings_before_data_required,
t->peer_string.c_str(), t->ping_state.pings_before_data_required,
t->ping_policy.max_pings_without_data);
}
return;
@ -151,8 +148,7 @@ static void maybe_initiate_ping(grpc_chttp2_transport* t) {
"%s: Ping delayed [%s]: not enough time elapsed since last "
"ping. "
" Last ping %" PRId64 ": Next ping %" PRId64 ": Now %" PRId64,
t->is_client ? "CLIENT" : "SERVER",
std::string(t->peer_string.as_string_view()).c_str(),
t->is_client ? "CLIENT" : "SERVER", t->peer_string.c_str(),
t->ping_state.last_ping_sent_time.milliseconds_after_process_epoch(),
next_allowed_ping.milliseconds_after_process_epoch(),
now.milliseconds_after_process_epoch());
@ -183,8 +179,7 @@ static void maybe_initiate_ping(grpc_chttp2_transport* t) {
GRPC_TRACE_FLAG_ENABLED(grpc_bdp_estimator_trace) ||
GRPC_TRACE_FLAG_ENABLED(grpc_keepalive_trace)) {
gpr_log(GPR_INFO, "%s: Ping sent [%s]: %d/%d",
t->is_client ? "CLIENT" : "SERVER",
std::string(t->peer_string.as_string_view()).c_str(),
t->is_client ? "CLIENT" : "SERVER", t->peer_string.c_str(),
t->ping_state.pings_before_data_required,
t->ping_policy.max_pings_without_data);
}
@ -222,7 +217,7 @@ static void report_stall(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
" However, if you know that there are unwanted stalls, here is some "
"helpful data: [fc:pending=%" PRIdPTR ":flowed=%" PRId64
":peer_initwin=%d:t_win=%" PRId64 ":s_win=%d:s_delta=%" PRId64 "]",
std::string(t->peer_string.as_string_view()).c_str(), t, s->id, staller,
t->peer_string.c_str(), t, s->id, staller,
s->flow_controlled_buffer.length, s->flow_controlled_bytes_flowed,
t->settings[GRPC_ACKED_SETTINGS]
[GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE],

@ -26,6 +26,7 @@
#include "absl/status/status.h"
#include "absl/strings/string_view.h"
#include <grpc/support/atm.h>
#include <grpc/support/time.h>
#include "src/core/lib/iomgr/error.h"
@ -51,6 +52,11 @@ class CallTracer {
// arguments.
virtual void RecordSendInitialMetadata(
grpc_metadata_batch* send_initial_metadata) = 0;
// TODO(yashkt): We are using gpr_atm here instead of absl::string_view
// since that's what the transport API uses, and performing an atomic load
// is unnecessary if the census tracer does not need it at present. Fix this
// when the transport API changes.
virtual void RecordOnDoneSendInitialMetadata(gpr_atm* peer_string) = 0;
virtual void RecordSendTrailingMetadata(
grpc_metadata_batch* send_trailing_metadata) = 0;
virtual void RecordSendMessage(const SliceBuffer& send_message) = 0;

@ -712,6 +712,8 @@ class ClientStream : public ConnectedChannelStream {
metadata_.on_complete = &metadata_batch_done_;
batch_payload()->send_initial_metadata.send_initial_metadata =
client_initial_metadata_.get();
batch_payload()->send_initial_metadata.peer_string =
GetContext<CallContext>()->peer_string_atm_ptr();
server_initial_metadata_ =
GetContext<Arena>()->MakePooled<ServerMetadata>(GetContext<Arena>());
batch_payload()->recv_initial_metadata.recv_initial_metadata =
@ -720,6 +722,7 @@ class ClientStream : public ConnectedChannelStream {
&recv_initial_metadata_ready_;
batch_payload()->recv_initial_metadata.trailing_metadata_available =
nullptr;
batch_payload()->recv_initial_metadata.peer_string = nullptr;
server_trailing_metadata_ =
GetContext<Arena>()->MakePooled<ServerMetadata>(GetContext<Arena>());
batch_payload()->recv_trailing_metadata.recv_trailing_metadata =
@ -991,6 +994,7 @@ class ServerStream final : public ConnectedChannelStream {
server_initial_metadata_
.emplace<ServerMetadataHandle>(std::move(**md))
.get();
batch_payload()->send_initial_metadata.peer_string = nullptr;
SchedulePush(&send_initial_metadata_);
return true;
} else {

@ -23,7 +23,6 @@
#include <inttypes.h>
#include <limits.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
#include <atomic>
@ -145,6 +144,8 @@ class Call : public CppImplOf<Call, grpc_call> {
// for that functionality be invented)
virtual grpc_call_stack* call_stack() = 0;
gpr_atm* peer_string_atm_ptr() { return &peer_string_; }
protected:
// The maximum number of concurrent batches possible.
// Based upon the maximum number of individually queueable ops in the batch
@ -202,17 +203,7 @@ class Call : public CppImplOf<Call, grpc_call> {
send_deadline_ = send_deadline;
}
Slice GetPeerString() const {
MutexLock lock(&peer_mu_);
return peer_string_.Ref();
}
void SetPeerString(Slice peer_string) {
MutexLock lock(&peer_mu_);
peer_string_ = std::move(peer_string);
}
void ClearPeerString() { SetPeerString(Slice(grpc_empty_slice())); }
void ClearPeerString() { gpr_atm_rel_store(&peer_string_, 0); }
private:
RefCountedPtr<Channel> channel_;
@ -223,11 +214,8 @@ class Call : public CppImplOf<Call, grpc_call> {
const bool is_client_;
// flag indicating that cancellation is inherited
bool cancellation_is_inherited_ = false;
// Peer name is protected by a mutex because it can be accessed by the
// application at the same moment as it is being set by the completion
// of the recv_initial_metadata op. The mutex should be mostly uncontended.
mutable Mutex peer_mu_;
Slice peer_string_ ABSL_GUARDED_BY(&peer_mu_);
// A char* indicating the peer name.
gpr_atm peer_string_ = 0;
};
Call::ParentCall* Call::GetOrCreateParentCall() {
@ -349,16 +337,9 @@ void Call::PropagateCancellationToChildren() {
}
char* Call::GetPeer() {
Slice peer_slice = GetPeerString();
if (!peer_slice.empty()) {
absl::string_view peer_string_view = peer_slice.as_string_view();
char* peer_string =
static_cast<char*>(gpr_malloc(peer_string_view.size() + 1));
memcpy(peer_string, peer_string_view.data(), peer_string_view.size());
peer_string[peer_string_view.size()] = '\0';
return peer_string;
}
char* peer_string = grpc_channel_get_target(channel_->c_ptr());
char* peer_string = reinterpret_cast<char*>(gpr_atm_acq_load(&peer_string_));
if (peer_string != nullptr) return gpr_strdup(peer_string);
peer_string = grpc_channel_get_target(channel_->c_ptr());
if (peer_string != nullptr) return peer_string;
return gpr_strdup("unknown");
}
@ -1071,11 +1052,11 @@ void FilterStackCall::RecvTrailingFilter(grpc_metadata_batch* b,
grpc_status_code status_code = *grpc_status;
grpc_error_handle error;
if (status_code != GRPC_STATUS_OK) {
Slice peer = GetPeerString();
char* peer = GetPeer();
error = grpc_error_set_int(
GRPC_ERROR_CREATE(absl::StrCat("Error received from peer ",
peer.as_string_view())),
GRPC_ERROR_CREATE(absl::StrCat("Error received from peer ", peer)),
StatusIntProperty::kRpcStatus, static_cast<intptr_t>(status_code));
gpr_free(peer);
}
auto grpc_message = b->Take(GrpcMessageMetadata());
if (grpc_message.has_value()) {
@ -1325,9 +1306,6 @@ void FilterStackCall::BatchControl::ReceivingInitialMetadataReady(
// TODO(ctiller): this could be moved into recv_initial_filter now
ValidateFilteredMetadata();
Slice* peer_string = md->get_pointer(PeerString());
if (peer_string != nullptr) call->SetPeerString(peer_string->Ref());
absl::optional<Timestamp> deadline = md->get(GrpcTimeoutMetadata());
if (deadline.has_value() && !call->is_client()) {
call_->set_send_deadline(*deadline);
@ -1534,6 +1512,10 @@ grpc_call_error FilterStackCall::StartBatch(const grpc_op* ops, size_t nops,
}
stream_op_payload->send_initial_metadata.send_initial_metadata =
&send_initial_metadata_;
if (is_client()) {
stream_op_payload->send_initial_metadata.peer_string =
peer_string_atm_ptr();
}
pending_ops |= PendingOpMask(PendingOp::kSends);
break;
}
@ -1682,6 +1664,9 @@ grpc_call_error FilterStackCall::StartBatch(const grpc_op* ops, size_t nops,
if (is_client()) {
stream_op_payload->recv_initial_metadata.trailing_metadata_available =
&is_trailers_only_;
} else {
stream_op_payload->recv_initial_metadata.peer_string =
peer_string_atm_ptr();
}
pending_ops |= PendingOpMask(PendingOp::kRecvInitialMetadata);
break;
@ -2705,6 +2690,10 @@ void CallContext::IncrementRefCount(const char* reason) {
void CallContext::Unref(const char* reason) { call_->InternalUnref(reason); }
gpr_atm* CallContext::peer_string_atm_ptr() {
return call_->peer_string_atm_ptr();
}
void CallContext::UpdateDeadline(Timestamp deadline) {
call_->UpdateDeadline(deadline);
}
@ -2960,8 +2949,6 @@ grpc_call_error ClientPromiseBasedCall::StartBatch(const grpc_op* ops,
void ClientPromiseBasedCall::PublishInitialMetadata(ServerMetadata* metadata) {
incoming_compression_algorithm_ =
metadata->Take(GrpcEncodingMetadata()).value_or(GRPC_COMPRESS_NONE);
Slice* peer_string = metadata->get_pointer(PeerString());
if (peer_string != nullptr) SetPeerString(peer_string->Ref());
server_initial_metadata_ready_.reset();
GPR_ASSERT(recv_initial_metadata_ != nullptr);
PublishMetadataArray(metadata,

@ -29,7 +29,7 @@ grpc_core::TraceFlag grpc_bdp_estimator_trace(false, "bdp_estimator");
namespace grpc_core {
BdpEstimator::BdpEstimator(absl::string_view name)
BdpEstimator::BdpEstimator(const char* name)
: ping_state_(PingState::UNSCHEDULED),
accumulator_(0),
estimate_(65536),
@ -50,16 +50,16 @@ Timestamp BdpEstimator::CompletePing() {
gpr_log(GPR_INFO,
"bdp[%s]:complete acc=%" PRId64 " est=%" PRId64
" dt=%lf bw=%lfMbs bw_est=%lfMbs",
std::string(name_).c_str(), accumulator_, estimate_, dt,
bw / 125000.0, bw_est_ / 125000.0);
name_, accumulator_, estimate_, dt, bw / 125000.0,
bw_est_ / 125000.0);
}
GPR_ASSERT(ping_state_ == PingState::STARTED);
if (accumulator_ > 2 * estimate_ / 3 && bw > bw_est_) {
estimate_ = std::max(accumulator_, estimate_ * 2);
bw_est_ = bw;
if (GRPC_TRACE_FLAG_ENABLED(grpc_bdp_estimator_trace)) {
gpr_log(GPR_INFO, "bdp[%s]: estimate increased to %" PRId64,
std::string(name_).c_str(), estimate_);
gpr_log(GPR_INFO, "bdp[%s]: estimate increased to %" PRId64, name_,
estimate_);
}
inter_ping_delay_ /= 2; // if the ping estimate changes,
// exponentially get faster at probing
@ -74,8 +74,8 @@ Timestamp BdpEstimator::CompletePing() {
if (start_inter_ping_delay != inter_ping_delay_) {
stable_estimate_count_ = 0;
if (GRPC_TRACE_FLAG_ENABLED(grpc_bdp_estimator_trace)) {
gpr_log(GPR_INFO, "bdp[%s]:update_inter_time to %" PRId64 "ms",
std::string(name_).c_str(), inter_ping_delay_.millis());
gpr_log(GPR_INFO, "bdp[%s]:update_inter_time to %" PRId64 "ms", name_,
inter_ping_delay_.millis());
}
}
ping_state_ = PingState::UNSCHEDULED;

@ -23,10 +23,6 @@
#include <inttypes.h>
#include <string>
#include "absl/strings/string_view.h"
#include <grpc/support/log.h>
#include <grpc/support/time.h>
@ -39,7 +35,7 @@ namespace grpc_core {
class BdpEstimator {
public:
explicit BdpEstimator(absl::string_view name);
explicit BdpEstimator(const char* name);
~BdpEstimator() {}
int64_t EstimateBdp() const { return estimate_; }
@ -52,8 +48,8 @@ class BdpEstimator {
// transport (but not necessarily started)
void SchedulePing() {
if (GRPC_TRACE_FLAG_ENABLED(grpc_bdp_estimator_trace)) {
gpr_log(GPR_INFO, "bdp[%s]:sched acc=%" PRId64 " est=%" PRId64,
std::string(name_).c_str(), accumulator_, estimate_);
gpr_log(GPR_INFO, "bdp[%s]:sched acc=%" PRId64 " est=%" PRId64, name_,
accumulator_, estimate_);
}
GPR_ASSERT(ping_state_ == PingState::UNSCHEDULED);
ping_state_ = PingState::SCHEDULED;
@ -65,8 +61,8 @@ class BdpEstimator {
// the ping is on the wire
void StartPing() {
if (GRPC_TRACE_FLAG_ENABLED(grpc_bdp_estimator_trace)) {
gpr_log(GPR_INFO, "bdp[%s]:start acc=%" PRId64 " est=%" PRId64,
std::string(name_).c_str(), accumulator_, estimate_);
gpr_log(GPR_INFO, "bdp[%s]:start acc=%" PRId64 " est=%" PRId64, name_,
accumulator_, estimate_);
}
GPR_ASSERT(ping_state_ == PingState::SCHEDULED);
ping_state_ = PingState::STARTED;
@ -89,7 +85,7 @@ class BdpEstimator {
Duration inter_ping_delay_;
int stable_estimate_count_;
double bw_est_;
absl::string_view name_;
const char* name_;
};
} // namespace grpc_core

@ -281,10 +281,7 @@ std::string GrpcStreamNetworkState::DisplayValue(ValueType x) {
GPR_UNREACHABLE_CODE(return "unknown value");
}
std::string PeerString::DisplayValue(const ValueType& x) {
return std::string(x.as_string_view());
}
std::string PeerString::DisplayValue(ValueType x) { return std::string(x); }
const std::string& GrpcStatusContext::DisplayValue(const std::string& x) {
return x;
}

@ -376,8 +376,8 @@ struct GrpcStreamNetworkState {
struct PeerString {
static absl::string_view DebugKey() { return "PeerString"; }
static constexpr bool kRepeatable = false;
using ValueType = Slice;
static std::string DisplayValue(const ValueType& x);
using ValueType = absl::string_view;
static std::string DisplayValue(ValueType x);
};
// Annotation added by various systems to describe the reason for a failure.

@ -36,6 +36,7 @@
#include <grpc/impl/connectivity_state.h>
#include <grpc/slice.h>
#include <grpc/status.h>
#include <grpc/support/atm.h>
#include <grpc/support/log.h>
#include <grpc/support/time.h>
@ -343,6 +344,12 @@ struct grpc_transport_stream_op_batch_payload {
: context(context) {}
struct {
grpc_metadata_batch* send_initial_metadata = nullptr;
// If non-NULL, will be set by the transport to the peer string (a char*).
// The transport retains ownership of the string.
// Note: This pointer may be used by the transport after the
// send_initial_metadata op is completed. It must remain valid
// until the call is destroyed.
gpr_atm* peer_string = nullptr;
} send_initial_metadata;
struct {
@ -387,6 +394,12 @@ struct grpc_transport_stream_op_batch_payload {
// uses this to set the success flag of OnReadInitialMetadataDone()
// callback.
bool* trailing_metadata_available = nullptr;
// If non-NULL, will be set by the transport to the peer string (a char*).
// The transport retains ownership of the string.
// Note: This pointer may be used by the transport after the
// recv_initial_metadata op is completed. It must remain valid
// until the call is destroyed.
gpr_atm* peer_string = nullptr;
} recv_initial_metadata;
struct {

@ -30,6 +30,7 @@
#include "absl/types/optional.h"
#include <grpc/grpc.h>
#include <grpc/support/atm.h>
#include <grpcpp/support/config.h>
#include "src/core/lib/channel/channel_args.h"
@ -170,6 +171,18 @@ class TransportStreamOpBatch {
op_->payload->context[GRPC_CONTEXT_TRACING].value);
}
const gpr_atm* get_peer_string() const {
if (op_->send_initial_metadata &&
op_->payload->send_initial_metadata.peer_string != nullptr) {
return op_->payload->send_initial_metadata.peer_string;
} else if (op_->recv_initial_metadata &&
op_->payload->recv_initial_metadata.peer_string != nullptr) {
return op_->payload->recv_initial_metadata.peer_string;
} else {
return nullptr;
}
}
private:
grpc_transport_stream_op_batch* op_; // Not owned.
MetadataBatch send_initial_metadata_;

@ -28,6 +28,7 @@
#include "absl/strings/string_view.h"
#include "absl/time/time.h"
#include <grpc/support/atm.h>
#include <grpc/support/time.h>
#include <grpcpp/opencensus.h>
@ -65,6 +66,7 @@ class OpenCensusCallTracer : public grpc_core::CallTracer {
bool arena_allocated);
void RecordSendInitialMetadata(
grpc_metadata_batch* send_initial_metadata) override;
void RecordOnDoneSendInitialMetadata(gpr_atm* /*peer_string*/) override {}
void RecordSendTrailingMetadata(
grpc_metadata_batch* /*send_trailing_metadata*/) override {}
void RecordSendMessage(

@ -146,11 +146,9 @@ void SetIpPort(absl::string_view s, LoggingSink::Entry::Address* peer) {
}
}
LoggingSink::Entry::Address PeerStringToAddress(
const grpc_core::Slice& peer_string) {
LoggingSink::Entry::Address PeerStringToAddress(absl::string_view peer_string) {
LoggingSink::Entry::Address address;
absl::StatusOr<grpc_core::URI> uri =
grpc_core::URI::Parse(peer_string.as_string_view());
absl::StatusOr<grpc_core::URI> uri = grpc_core::URI::Parse(peer_string);
if (!uri.ok()) {
gpr_log(GPR_DEBUG, "peer_string is in invalid format and cannot be logged");
return address;

Loading…
Cancel
Save