Added debug and non-debug tracers for subchannel.

pull/19187/head
Qiancheng Zhao 6 years ago
parent a91728737a
commit 8438cc804f
  1. 2
      doc/environment_variables.md
  2. 9
      src/core/ext/filters/client_channel/subchannel.cc

@ -74,6 +74,7 @@ some configuration as environment variables that can be set.
- queue_pluck
- server_channel - lightweight trace of significant server channel events
- secure_endpoint - traces bytes flowing through encrypted channels
- subchannel - traces the connectivity state of subchannel
- timer - timers (alarms) in the grpc internals
- timer_check - more detailed trace of timer logic in grpc internals
- transport_security - traces metadata about secure channel establishment
@ -89,6 +90,7 @@ some configuration as environment variables that can be set.
- pending_tags - traces still-in-progress tags on completion queues
- polling - traces the selected polling engine
- polling_api - traces the api calls to polling engine
- subchannel_refcount
- queue_refcount
- error_refcount
- stream_refcount

@ -75,6 +75,9 @@
namespace grpc_core {
TraceFlag grpc_trace_subchannel(false, "subchannel");
DebugOnlyTraceFlag grpc_trace_subchannel_refcount(false, "subchannel_refcount");
//
// ConnectedSubchannel
//
@ -83,7 +86,7 @@ ConnectedSubchannel::ConnectedSubchannel(
grpc_channel_stack* channel_stack, const grpc_channel_args* args,
RefCountedPtr<channelz::SubchannelNode> channelz_subchannel,
intptr_t socket_uuid)
: ConnectedSubchannelInterface(&grpc_trace_stream_refcount),
: ConnectedSubchannelInterface(&grpc_trace_subchannel_refcount),
channel_stack_(channel_stack),
args_(grpc_channel_args_copy(args)),
channelz_subchannel_(std::move(channelz_subchannel)),
@ -332,7 +335,7 @@ class Subchannel::ConnectedSubchannelStateWatcher {
case GRPC_CHANNEL_TRANSIENT_FAILURE:
case GRPC_CHANNEL_SHUTDOWN: {
if (!c->disconnected_ && c->connected_subchannel_ != nullptr) {
if (grpc_trace_stream_refcount.enabled()) {
if (grpc_trace_subchannel.enabled()) {
gpr_log(GPR_INFO,
"Connected subchannel %p of subchannel %p has gone into "
"%s. Attempting to reconnect.",
@ -1106,7 +1109,7 @@ gpr_atm Subchannel::RefMutate(
gpr_atm old_val = barrier ? gpr_atm_full_fetch_add(&ref_pair_, delta)
: gpr_atm_no_barrier_fetch_add(&ref_pair_, delta);
#ifndef NDEBUG
if (grpc_trace_stream_refcount.enabled()) {
if (grpc_trace_subchannel_refcount.enabled()) {
gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG,
"SUBCHANNEL: %p %12s 0x%" PRIxPTR " -> 0x%" PRIxPTR " [%s]", this,
purpose, old_val, old_val + delta, reason);

Loading…
Cancel
Save