aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/ext/filters
diff options
context:
space:
mode:
authorGravatar Noah Eisen <ncteisen@gmail.com>2018-10-09 11:19:49 -0700
committerGravatar GitHub <noreply@github.com>2018-10-09 11:19:49 -0700
commita74885d47806af16054648ee6ac886f014b19b1e (patch)
tree702c6693d28937243b1f9e251edaeb046dae886d /src/core/ext/filters
parent91d23ac8ea1994f37a3f7dc19f0d4cc26fc7513e (diff)
parent5de6e2533d7b717e3ee23dde94c3edef70649900 (diff)
Merge pull request #16760 from ncteisen/channelz-server-sockets
Channelz Part 8: Get Server Sockets
Diffstat (limited to 'src/core/ext/filters')
-rw-r--r--src/core/ext/filters/client_channel/client_channel.cc5
-rw-r--r--src/core/ext/filters/client_channel/client_channel.h5
-rw-r--r--src/core/ext/filters/client_channel/client_channel_channelz.h7
-rw-r--r--src/core/ext/filters/client_channel/lb_policy.h10
-rw-r--r--src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc10
-rw-r--r--src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc13
-rw-r--r--src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc13
-rw-r--r--src/core/ext/filters/client_channel/lb_policy/subchannel_list.h2
8 files changed, 32 insertions, 33 deletions
diff --git a/src/core/ext/filters/client_channel/client_channel.cc b/src/core/ext/filters/client_channel/client_channel.cc
index 388736b60a..35c8bb27ee 100644
--- a/src/core/ext/filters/client_channel/client_channel.cc
+++ b/src/core/ext/filters/client_channel/client_channel.cc
@@ -3289,8 +3289,9 @@ static void try_to_connect_locked(void* arg, grpc_error* error_ignored) {
}
void grpc_client_channel_populate_child_refs(
- grpc_channel_element* elem, grpc_core::ChildRefsList* child_subchannels,
- grpc_core::ChildRefsList* child_channels) {
+ grpc_channel_element* elem,
+ grpc_core::channelz::ChildRefsList* child_subchannels,
+ grpc_core::channelz::ChildRefsList* child_channels) {
channel_data* chand = static_cast<channel_data*>(elem->channel_data);
if (chand->lb_policy != nullptr) {
chand->lb_policy->FillChildRefsForChannelz(child_subchannels,
diff --git a/src/core/ext/filters/client_channel/client_channel.h b/src/core/ext/filters/client_channel/client_channel.h
index 0b44a17562..d64faaabd2 100644
--- a/src/core/ext/filters/client_channel/client_channel.h
+++ b/src/core/ext/filters/client_channel/client_channel.h
@@ -41,8 +41,9 @@ extern grpc_core::TraceFlag grpc_client_channel_trace;
extern const grpc_channel_filter grpc_client_channel_filter;
void grpc_client_channel_populate_child_refs(
- grpc_channel_element* elem, grpc_core::ChildRefsList* child_subchannels,
- grpc_core::ChildRefsList* child_channels);
+ grpc_channel_element* elem,
+ grpc_core::channelz::ChildRefsList* child_subchannels,
+ grpc_core::channelz::ChildRefsList* child_channels);
grpc_connectivity_state grpc_client_channel_check_connectivity_state(
grpc_channel_element* elem, int try_to_connect);
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..8a5c3e7e5e 100644
--- a/src/core/ext/filters/client_channel/client_channel_channelz.h
+++ b/src/core/ext/filters/client_channel/client_channel_channelz.h
@@ -25,17 +25,10 @@
#include "src/core/lib/channel/channel_stack.h"
#include "src/core/lib/channel/channel_trace.h"
#include "src/core/lib/channel/channelz.h"
-#include "src/core/lib/gprpp/inlined_vector.h"
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
diff --git a/src/core/ext/filters/client_channel/lb_policy.h b/src/core/ext/filters/client_channel/lb_policy.h
index 3c0a9c1118..21f80b7b94 100644
--- a/src/core/ext/filters/client_channel/lb_policy.h
+++ b/src/core/ext/filters/client_channel/lb_policy.h
@@ -151,9 +151,9 @@ class LoadBalancingPolicy
/// LB policy's referenced children. This is not invoked from the
/// client_channel's combiner. The implementation is responsible for
/// providing its own synchronization.
- virtual void FillChildRefsForChannelz(ChildRefsList* child_subchannels,
- ChildRefsList* child_channels)
- GRPC_ABSTRACT;
+ virtual void FillChildRefsForChannelz(
+ channelz::ChildRefsList* child_subchannels,
+ channelz::ChildRefsList* child_channels) GRPC_ABSTRACT;
void Orphan() override {
// Invoke ShutdownAndUnrefLocked() inside of the combiner.
@@ -212,8 +212,8 @@ class LoadBalancingPolicy
// Dummy classes needed for alignment issues.
// See https://github.com/grpc/grpc/issues/16032 for context.
// TODO(ncteisen): remove this as soon as the issue is resolved.
- ChildRefsList dummy_list_foo;
- ChildRefsList dummy_list_bar;
+ channelz::ChildRefsList dummy_list_foo;
+ channelz::ChildRefsList dummy_list_bar;
};
} // namespace grpc_core
diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc
index 0061190016..384e7931b5 100644
--- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc
+++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc
@@ -136,8 +136,9 @@ class GrpcLb : public LoadBalancingPolicy {
void HandOffPendingPicksLocked(LoadBalancingPolicy* new_policy) override;
void ExitIdleLocked() override;
void ResetBackoffLocked() override;
- void FillChildRefsForChannelz(ChildRefsList* child_subchannels,
- ChildRefsList* child_channels) override;
+ void FillChildRefsForChannelz(
+ channelz::ChildRefsList* child_subchannels,
+ channelz::ChildRefsList* child_channels) override;
private:
/// Linked list of pending pick requests. It stores all information needed to
@@ -1258,8 +1259,9 @@ bool GrpcLb::PickLocked(PickState* pick, grpc_error** error) {
return pick_done;
}
-void GrpcLb::FillChildRefsForChannelz(ChildRefsList* child_subchannels,
- ChildRefsList* child_channels) {
+void GrpcLb::FillChildRefsForChannelz(
+ channelz::ChildRefsList* child_subchannels,
+ channelz::ChildRefsList* child_channels) {
// delegate to the RoundRobin to fill the children subchannels.
rr_policy_->FillChildRefsForChannelz(child_subchannels, child_channels);
MutexLock lock(&lb_channel_mu_);
diff --git a/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc b/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc
index ed8cc60ea1..f4dca146f7 100644
--- a/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc
+++ b/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc
@@ -59,8 +59,8 @@ class PickFirst : public LoadBalancingPolicy {
void HandOffPendingPicksLocked(LoadBalancingPolicy* new_policy) override;
void ExitIdleLocked() override;
void ResetBackoffLocked() override;
- void FillChildRefsForChannelz(ChildRefsList* child_subchannels,
- ChildRefsList* ignored) override;
+ void FillChildRefsForChannelz(channelz::ChildRefsList* child_subchannels,
+ channelz::ChildRefsList* ignored) override;
private:
~PickFirst();
@@ -147,8 +147,8 @@ class PickFirst : public LoadBalancingPolicy {
/// Lock and data used to capture snapshots of this channels child
/// channels and subchannels. This data is consumed by channelz.
gpr_mu child_refs_mu_;
- ChildRefsList child_subchannels_;
- ChildRefsList child_channels_;
+ channelz::ChildRefsList child_subchannels_;
+ channelz::ChildRefsList child_channels_;
};
PickFirst::PickFirst(const Args& args) : LoadBalancingPolicy(args) {
@@ -300,7 +300,8 @@ void PickFirst::NotifyOnStateChangeLocked(grpc_connectivity_state* current,
}
void PickFirst::FillChildRefsForChannelz(
- ChildRefsList* child_subchannels_to_fill, ChildRefsList* ignored) {
+ channelz::ChildRefsList* child_subchannels_to_fill,
+ channelz::ChildRefsList* ignored) {
MutexLock lock(&child_refs_mu_);
for (size_t i = 0; i < child_subchannels_.size(); ++i) {
// TODO(ncteisen): implement a de dup loop that is not O(n^2). Might
@@ -320,7 +321,7 @@ void PickFirst::FillChildRefsForChannelz(
}
void PickFirst::UpdateChildRefsLocked() {
- ChildRefsList cs;
+ channelz::ChildRefsList cs;
if (subchannel_list_ != nullptr) {
subchannel_list_->PopulateChildRefsList(&cs);
}
diff --git a/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc b/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc
index 8dd5820bae..e9ed85cf66 100644
--- a/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc
+++ b/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc
@@ -70,8 +70,8 @@ class RoundRobin : public LoadBalancingPolicy {
void HandOffPendingPicksLocked(LoadBalancingPolicy* new_policy) override;
void ExitIdleLocked() override;
void ResetBackoffLocked() override;
- void FillChildRefsForChannelz(ChildRefsList* child_subchannels,
- ChildRefsList* ignored) override;
+ void FillChildRefsForChannelz(channelz::ChildRefsList* child_subchannels,
+ channelz::ChildRefsList* ignored) override;
private:
~RoundRobin();
@@ -223,8 +223,8 @@ class RoundRobin : public LoadBalancingPolicy {
/// Lock and data used to capture snapshots of this channel's child
/// channels and subchannels. This data is consumed by channelz.
gpr_mu child_refs_mu_;
- ChildRefsList child_subchannels_;
- ChildRefsList child_channels_;
+ channelz::ChildRefsList child_subchannels_;
+ channelz::ChildRefsList child_channels_;
};
RoundRobin::RoundRobin(const Args& args) : LoadBalancingPolicy(args) {
@@ -402,7 +402,8 @@ bool RoundRobin::PickLocked(PickState* pick, grpc_error** error) {
}
void RoundRobin::FillChildRefsForChannelz(
- ChildRefsList* child_subchannels_to_fill, ChildRefsList* ignored) {
+ channelz::ChildRefsList* child_subchannels_to_fill,
+ channelz::ChildRefsList* ignored) {
MutexLock lock(&child_refs_mu_);
for (size_t i = 0; i < child_subchannels_.size(); ++i) {
// TODO(ncteisen): implement a de dup loop that is not O(n^2). Might
@@ -422,7 +423,7 @@ void RoundRobin::FillChildRefsForChannelz(
}
void RoundRobin::UpdateChildRefsLocked() {
- ChildRefsList cs;
+ channelz::ChildRefsList cs;
if (subchannel_list_ != nullptr) {
subchannel_list_->PopulateChildRefsList(&cs);
}
diff --git a/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h b/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h
index 5e8682e056..e0e0e1e638 100644
--- a/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h
+++ b/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h
@@ -201,7 +201,7 @@ class SubchannelList
bool shutting_down() const { return shutting_down_; }
// Populates refs_list with the uuids of this SubchannelLists's subchannels.
- void PopulateChildRefsList(ChildRefsList* refs_list) {
+ void PopulateChildRefsList(channelz::ChildRefsList* refs_list) {
for (size_t i = 0; i < subchannels_.size(); ++i) {
if (subchannels_[i].subchannel() != nullptr) {
grpc_core::channelz::SubchannelNode* subchannel_node =