diff options
author | 2018-09-26 17:19:39 -0700 | |
---|---|---|
committer | 2018-09-26 17:19:39 -0700 | |
commit | f13a74312672aaf7c72e984f59dbd351dcda4e8a (patch) | |
tree | 840716a1eb06ae803131e116db3e7f4dcd8109df /src/core/ext/filters/client_channel/client_channel_channelz.cc | |
parent | c3db7d21ce1dfbd6f25bde500af62fd1c197928f (diff) |
Implement child socket support
Diffstat (limited to 'src/core/ext/filters/client_channel/client_channel_channelz.cc')
-rw-r--r-- | src/core/ext/filters/client_channel/client_channel_channelz.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/core/ext/filters/client_channel/client_channel_channelz.cc b/src/core/ext/filters/client_channel/client_channel_channelz.cc index 7e8f59bcd3..4fedcbcbb6 100644 --- a/src/core/ext/filters/client_channel/client_channel_channelz.cc +++ b/src/core/ext/filters/client_channel/client_channel_channelz.cc @@ -136,6 +136,23 @@ void SubchannelNode::PopulateConnectivityState(grpc_json* json) { false); } +void SubchannelNode::PopulateChildSockets(grpc_json* json) { + ChildRefsList child_sockets; + grpc_json* json_iterator = nullptr; + grpc_subchannel_populate_child_sockets(subchannel_, &child_sockets); + if (!child_sockets.empty()) { + grpc_json* array_parent = grpc_json_create_child( + nullptr, json, "socketRef", nullptr, GRPC_JSON_ARRAY, false); + for (size_t i = 0; i < child_sockets.size(); ++i) { + json_iterator = + grpc_json_create_child(json_iterator, array_parent, nullptr, nullptr, + GRPC_JSON_OBJECT, false); + grpc_json_add_number_string_child(json_iterator, nullptr, "socketId", + child_sockets[i]); + } + } +} + grpc_json* SubchannelNode::RenderJson() { grpc_json* top_level_json = grpc_json_create(GRPC_JSON_OBJECT); grpc_json* json = top_level_json; @@ -166,6 +183,8 @@ grpc_json* SubchannelNode::RenderJson() { } // ask CallCountingHelper to populate trace and call count data. call_counter_.PopulateCallCounts(json); + json = top_level_json; + PopulateChildSockets(json); return top_level_json; } |