diff options
Diffstat (limited to 'src/core/lib/channel/channelz.cc')
-rw-r--r-- | src/core/lib/channel/channelz.cc | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/src/core/lib/channel/channelz.cc b/src/core/lib/channel/channelz.cc index a49271c3a1..62bc4d4330 100644 --- a/src/core/lib/channel/channelz.cc +++ b/src/core/lib/channel/channelz.cc @@ -109,15 +109,8 @@ void ChannelNode::RecordCallStarted() { (gpr_atm)ExecCtx::Get()->Now()); } -grpc_connectivity_state ChannelNode::GetConnectivityState() { - if (channel_ == nullptr) { - return GRPC_CHANNEL_SHUTDOWN; - } else { - // TODO(ncteisen): re-enable this once we have cleaned up all of the - // internal dependency issues. - // return grpc_channel_check_connectivity_state(channel_, false); - return GRPC_CHANNEL_IDLE; - } +bool ChannelNode::GetConnectivityState(grpc_connectivity_state* state) { + return false; } char* ChannelNode::RenderJSON() { @@ -140,15 +133,17 @@ char* ChannelNode::RenderJSON() { json = data; json_iterator = nullptr; // create and fill the connectivity state child. - grpc_connectivity_state connectivity_state = GetConnectivityState(); - json_iterator = grpc_json_create_child(json_iterator, json, "state", nullptr, - GRPC_JSON_OBJECT, false); - json = json_iterator; - grpc_json_create_child(nullptr, json, "state", - grpc_connectivity_state_name(connectivity_state), - GRPC_JSON_STRING, false); - // reset the parent to be the data object. - json = data; + grpc_connectivity_state connectivity_state; + if (GetConnectivityState(&connectivity_state)) { + json_iterator = grpc_json_create_child(json_iterator, json, "state", + nullptr, GRPC_JSON_OBJECT, false); + json = json_iterator; + grpc_json_create_child(nullptr, json, "state", + grpc_connectivity_state_name(connectivity_state), + GRPC_JSON_STRING, false); + // reset the parent to be the data object. + json = data; + } json_iterator = grpc_json_create_child( json_iterator, json, "target", target_.get(), GRPC_JSON_STRING, false); // fill in the channel trace if applicable @@ -184,5 +179,11 @@ char* ChannelNode::RenderJSON() { return json_str; } +RefCountedPtr<ChannelNode> MakeChannelNode(grpc_channel* channel, + size_t channel_tracer_max_nodes) { + return MakeRefCounted<grpc_core::channelz::ChannelNode>( + channel, channel_tracer_max_nodes); +} + } // namespace channelz } // namespace grpc_core |