reviewer feedback

reviewable/pr16055/r9
ncteisen 6 years ago
parent e888e93293
commit 885c33da8b
  1. 11
      src/core/ext/filters/client_channel/client_channel_channelz.cc
  2. 7
      src/core/ext/filters/client_channel/client_channel_channelz.h
  3. 9
      src/core/lib/channel/channelz.cc
  4. 8
      src/core/lib/channel/channelz.h

@ -155,12 +155,11 @@ SubchannelNode::SubchannelNode(grpc_subchannel* subchannel,
size_t channel_tracer_max_nodes) size_t channel_tracer_max_nodes)
: BaseNode(EntityType::kSubchannel), : BaseNode(EntityType::kSubchannel),
subchannel_(subchannel), subchannel_(subchannel),
target_(UniquePtr<char>( target_(
gpr_strdup(grpc_subchannel_get_target(subchannel_)))) { UniquePtr<char>(gpr_strdup(grpc_subchannel_get_target(subchannel_)))),
trace_.Init(channel_tracer_max_nodes); trace_(channel_tracer_max_nodes) {}
}
SubchannelNode::~SubchannelNode() { trace_.Destroy(); } SubchannelNode::~SubchannelNode() {}
void SubchannelNode::PopulateConnectivityState(grpc_json* json) { void SubchannelNode::PopulateConnectivityState(grpc_json* json) {
grpc_connectivity_state state; grpc_connectivity_state state;
@ -199,7 +198,7 @@ grpc_json* SubchannelNode::RenderJson() {
grpc_json_create_child(nullptr, json, "target", target_.get(), grpc_json_create_child(nullptr, json, "target", target_.get(),
GRPC_JSON_STRING, false); GRPC_JSON_STRING, false);
// fill in the channel trace if applicable // fill in the channel trace if applicable
grpc_json* trace_json = trace_->RenderJson(); grpc_json* trace_json = trace_.RenderJson();
if (trace_json != nullptr) { if (trace_json != nullptr) {
trace_json->key = "trace"; // this object is named trace in channelz.proto trace_json->key = "trace"; // this object is named trace in channelz.proto
grpc_json_link_child(json, trace_json, nullptr); grpc_json_link_child(json, trace_json, nullptr);

@ -23,6 +23,7 @@
#include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/channel/channel_stack.h" #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/channel/channelz.h"
#include "src/core/lib/gprpp/inlined_vector.h" #include "src/core/lib/gprpp/inlined_vector.h"
@ -78,12 +79,12 @@ class SubchannelNode : public BaseNode {
// proxy methods to composed classes. // proxy methods to composed classes.
void AddTraceEvent(ChannelTrace::Severity severity, grpc_slice data) { void AddTraceEvent(ChannelTrace::Severity severity, grpc_slice data) {
trace_->AddTraceEvent(severity, data); trace_.AddTraceEvent(severity, data);
} }
void AddTraceEventWithReference(ChannelTrace::Severity severity, void AddTraceEventWithReference(ChannelTrace::Severity severity,
grpc_slice data, grpc_slice data,
RefCountedPtr<BaseNode> referenced_channel) { RefCountedPtr<BaseNode> referenced_channel) {
trace_->AddTraceEventWithReference(severity, data, referenced_channel); trace_.AddTraceEventWithReference(severity, data, referenced_channel);
} }
void RecordCallStarted() { call_counter_.RecordCallStarted(); } void RecordCallStarted() { call_counter_.RecordCallStarted(); }
void RecordCallFailed() { call_counter_.RecordCallFailed(); } void RecordCallFailed() { call_counter_.RecordCallFailed(); }
@ -93,7 +94,7 @@ class SubchannelNode : public BaseNode {
grpc_subchannel* subchannel_; grpc_subchannel* subchannel_;
UniquePtr<char> target_; UniquePtr<char> target_;
CallCountingHelper call_counter_; CallCountingHelper call_counter_;
ManualConstructor<ChannelTrace> trace_; ChannelTrace trace_;
void PopulateConnectivityState(grpc_json* json); void PopulateConnectivityState(grpc_json* json);
}; };

@ -92,11 +92,10 @@ ChannelNode::ChannelNode(grpc_channel* channel, size_t channel_tracer_max_nodes,
: BaseNode(is_top_level_channel ? EntityType::kTopLevelChannel : BaseNode(is_top_level_channel ? EntityType::kTopLevelChannel
: EntityType::kInternalChannel), : EntityType::kInternalChannel),
channel_(channel), channel_(channel),
target_(UniquePtr<char>(grpc_channel_get_target(channel_))) { target_(UniquePtr<char>(grpc_channel_get_target(channel_))),
trace_.Init(channel_tracer_max_nodes); trace_(channel_tracer_max_nodes) {}
}
ChannelNode::~ChannelNode() { trace_.Destroy(); } ChannelNode::~ChannelNode() {}
grpc_json* ChannelNode::RenderJson() { grpc_json* ChannelNode::RenderJson() {
// We need to track these three json objects to build our object // We need to track these three json objects to build our object
@ -123,7 +122,7 @@ grpc_json* ChannelNode::RenderJson() {
grpc_json_create_child(nullptr, json, "target", target_.get(), grpc_json_create_child(nullptr, json, "target", target_.get(),
GRPC_JSON_STRING, false); GRPC_JSON_STRING, false);
// fill in the channel trace if applicable // fill in the channel trace if applicable
grpc_json* trace_json = trace_->RenderJson(); grpc_json* trace_json = trace_.RenderJson();
if (trace_json != nullptr) { if (trace_json != nullptr) {
trace_json->key = "trace"; // this object is named trace in channelz.proto trace_json->key = "trace"; // this object is named trace in channelz.proto
grpc_json_link_child(json, trace_json, nullptr); grpc_json_link_child(json, trace_json, nullptr);

@ -133,12 +133,12 @@ class ChannelNode : public BaseNode {
// proxy methods to composed classes. // proxy methods to composed classes.
void AddTraceEvent(ChannelTrace::Severity severity, grpc_slice data) { void AddTraceEvent(ChannelTrace::Severity severity, grpc_slice data) {
trace_->AddTraceEvent(severity, data); trace_.AddTraceEvent(severity, data);
} }
void AddTraceEventWithReference(ChannelTrace::Severity severity, void AddTraceEventWithReference(ChannelTrace::Severity severity,
grpc_slice data, grpc_slice data,
RefCountedPtr<BaseNode> referenced_channel) { RefCountedPtr<BaseNode> referenced_channel) {
trace_->AddTraceEventWithReference(severity, data, referenced_channel); trace_.AddTraceEventWithReference(severity, data, referenced_channel);
} }
void RecordCallStarted() { call_counter_.RecordCallStarted(); } void RecordCallStarted() { call_counter_.RecordCallStarted(); }
void RecordCallFailed() { call_counter_.RecordCallFailed(); } void RecordCallFailed() { call_counter_.RecordCallFailed(); }
@ -150,7 +150,7 @@ class ChannelNode : public BaseNode {
// provides access to call_counter_ for child. // provides access to call_counter_ for child.
CallCountingHelper* call_counter() { return &call_counter_; } CallCountingHelper* call_counter() { return &call_counter_; }
// provides access to channel trace for child. // provides access to channel trace for child.
ChannelTrace* trace() { return trace_.get(); } ChannelTrace* trace() { return &trace_; }
private: private:
// to allow the channel trace test to access trace(); // to allow the channel trace test to access trace();
@ -158,7 +158,7 @@ class ChannelNode : public BaseNode {
grpc_channel* channel_ = nullptr; grpc_channel* channel_ = nullptr;
UniquePtr<char> target_; UniquePtr<char> target_;
CallCountingHelper call_counter_; CallCountingHelper call_counter_;
ManualConstructor<ChannelTrace> trace_; ChannelTrace trace_;
}; };
// Handles channelz bookkeeping for servers // Handles channelz bookkeeping for servers

Loading…
Cancel
Save