Skip to content

Commit

Permalink
Respond to reviewer comments
Browse files Browse the repository at this point in the history
  • Loading branch information
hcaseyal committed Jul 23, 2019
1 parent 81013e5 commit 64ead82
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 18 deletions.
3 changes: 2 additions & 1 deletion src/core/ext/filters/client_channel/client_channel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,8 @@ class ChannelData::ConnectivityStateAndPickerSetter {
chand->channelz_node_->AddTraceEvent(
channelz::ChannelTrace::Severity::Info,
grpc_slice_from_static_string(
channelz::GetChannelConnectivityStateChangeString(state)));
channelz::ChannelNode::GetChannelConnectivityStateChangeString(
state)));
}
// Bounce into the data plane combiner to reset the picker.
GRPC_CHANNEL_STACK_REF(chand->owning_stack_,
Expand Down
17 changes: 17 additions & 0 deletions src/core/lib/channel/channelz.cc
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,23 @@ ChannelNode::ChannelNode(UniquePtr<char> target,
trace_(channel_tracer_max_nodes),
parent_uuid_(parent_uuid) {}

const char* ChannelNode::GetChannelConnectivityStateChangeString(
grpc_connectivity_state state) {
switch (state) {
case GRPC_CHANNEL_IDLE:
return "Channel state change to IDLE";
case GRPC_CHANNEL_CONNECTING:
return "Channel state change to CONNECTING";
case GRPC_CHANNEL_READY:
return "Channel state change to READY";
case GRPC_CHANNEL_TRANSIENT_FAILURE:
return "Channel state change to TRANSIENT_FAILURE";
case GRPC_CHANNEL_SHUTDOWN:
return "Channel state change to SHUTDOWN";
}
GPR_UNREACHABLE_CODE(return "UNKNOWN");
}

grpc_json* ChannelNode::RenderJson() {
// We need to track these three json objects to build our object
grpc_json* top_level_json = grpc_json_create(GRPC_JSON_OBJECT);
Expand Down
21 changes: 4 additions & 17 deletions src/core/lib/channel/channelz.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,23 +70,6 @@ class CallCountingHelperPeer;
class ChannelNodePeer;
} // namespace testing

inline static const char* GetChannelConnectivityStateChangeString(
grpc_connectivity_state state) {
switch (state) {
case GRPC_CHANNEL_IDLE:
return "Channel state change to IDLE";
case GRPC_CHANNEL_CONNECTING:
return "Channel state change to CONNECTING";
case GRPC_CHANNEL_READY:
return "Channel state change to READY";
case GRPC_CHANNEL_TRANSIENT_FAILURE:
return "Channel state change to TRANSIENT_FAILURE";
case GRPC_CHANNEL_SHUTDOWN:
return "Channel state change to SHUTDOWN";
}
GPR_UNREACHABLE_CODE(return "UNKNOWN");
}

// base class for all channelz entities
class BaseNode : public RefCounted<BaseNode> {
public:
Expand Down Expand Up @@ -170,6 +153,10 @@ class ChannelNode : public BaseNode {
ChannelNode(UniquePtr<char> target, size_t channel_tracer_max_nodes,
intptr_t parent_uuid);

// Returns the string description of the given connectivity state.
static const char* GetChannelConnectivityStateChangeString(
grpc_connectivity_state state);

intptr_t parent_uuid() const { return parent_uuid_; }

grpc_json* RenderJson() override;
Expand Down

0 comments on commit 64ead82

Please sign in to comment.