aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/ext/filters/client_channel
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/ext/filters/client_channel')
-rw-r--r--src/core/ext/filters/client_channel/client_channel_channelz.cc19
-rw-r--r--src/core/ext/filters/client_channel/client_channel_channelz.h8
-rw-r--r--src/core/ext/filters/client_channel/subchannel.cc10
-rw-r--r--src/core/ext/filters/client_channel/subchannel.h3
4 files changed, 35 insertions, 5 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;
}
diff --git a/src/core/ext/filters/client_channel/client_channel_channelz.h b/src/core/ext/filters/client_channel/client_channel_channelz.h
index 8ce331e529..a63df00f9f 100644
--- a/src/core/ext/filters/client_channel/client_channel_channelz.h
+++ b/src/core/ext/filters/client_channel/client_channel_channelz.h
@@ -31,11 +31,6 @@ typedef struct grpc_subchannel grpc_subchannel;
namespace grpc_core {
-// TODO(ncteisen), this only contains the uuids of the children for now,
-// since that is all that is strictly needed. In a future enhancement we will
-// add human readable names as in the channelz.proto
-typedef InlinedVector<intptr_t, 10> ChildRefsList;
-
namespace channelz {
// Subtype of ChannelNode that overrides and provides client_channel specific
@@ -76,6 +71,9 @@ class SubchannelNode : public BaseNode {
grpc_json* RenderJson() override;
+ // helper to populate the socket(s) that this subchannel owns.
+ void PopulateChildSockets(grpc_json* json);
+
// proxy methods to composed classes.
void AddTraceEvent(ChannelTrace::Severity severity, grpc_slice data) {
trace_.AddTraceEvent(severity, data);
diff --git a/src/core/ext/filters/client_channel/subchannel.cc b/src/core/ext/filters/client_channel/subchannel.cc
index 57d0b3759f..29aeb06e7b 100644
--- a/src/core/ext/filters/client_channel/subchannel.cc
+++ b/src/core/ext/filters/client_channel/subchannel.cc
@@ -97,6 +97,8 @@ struct grpc_subchannel {
/** set during connection */
grpc_connect_out_args connecting_result;
+ grpc_transport* transport;
+
/** callback for connection finishing */
grpc_closure on_connected;
@@ -411,6 +413,13 @@ grpc_core::channelz::SubchannelNode* grpc_subchannel_get_channelz_node(
return subchannel->channelz_subchannel.get();
}
+void grpc_subchannel_populate_child_sockets(
+ grpc_subchannel* subchannel, grpc_core::ChildRefsList* child_sockets) {
+ if (subchannel->transport != nullptr) {
+ grpc_transport_populate_sockets(subchannel->transport, child_sockets);
+ }
+}
+
static void continue_connect_locked(grpc_subchannel* c) {
grpc_connect_in_args args;
args.interested_parties = c->pollset_set;
@@ -621,6 +630,7 @@ static bool publish_transport_locked(grpc_subchannel* c) {
GRPC_ERROR_UNREF(error);
return false;
}
+ c->transport = c->connecting_result.transport;
memset(&c->connecting_result, 0, sizeof(c->connecting_result));
/* initialize state watcher */
diff --git a/src/core/ext/filters/client_channel/subchannel.h b/src/core/ext/filters/client_channel/subchannel.h
index 84febb5204..2cf5067fc2 100644
--- a/src/core/ext/filters/client_channel/subchannel.h
+++ b/src/core/ext/filters/client_channel/subchannel.h
@@ -126,6 +126,9 @@ void grpc_subchannel_call_unref(
grpc_core::channelz::SubchannelNode* grpc_subchannel_get_channelz_node(
grpc_subchannel* subchannel);
+void grpc_subchannel_populate_child_sockets(
+ grpc_subchannel* subchannel, grpc_core::ChildRefsList* child_sockets);
+
/** Returns a pointer to the parent data associated with \a subchannel_call.
The data will be of the size specified in \a parent_data_size
field of the args passed to \a grpc_connected_subchannel_create_call(). */