aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar ncteisen <ncteisen@gmail.com>2018-10-05 12:20:09 -0700
committerGravatar ncteisen <ncteisen@gmail.com>2018-10-05 12:20:09 -0700
commit5de6e2533d7b717e3ee23dde94c3edef70649900 (patch)
tree6c790d6ef94cc31f7b149660874a1d02f8d42b12
parentc3a0a5bcb550ebfe209d2def5ec669bb0ae32639 (diff)
parentf526602bff029b8db50a8d57134d72da33d8a752 (diff)
Merge branch 'master' of https://github.com/grpc/grpc into channelz-server-sockets
-rw-r--r--.github/ISSUE_TEMPLATE.md2
-rw-r--r--include/grpc/impl/codegen/grpc_types.h10
-rw-r--r--src/core/ext/filters/client_channel/http_connect_handshaker.cc1
-rw-r--r--src/core/ext/filters/client_channel/subchannel.cc10
-rw-r--r--src/core/ext/transport/chttp2/client/chttp2_connector.cc2
-rw-r--r--src/core/ext/transport/chttp2/server/chttp2_server.cc8
-rw-r--r--src/core/lib/channel/channel_trace.cc38
-rw-r--r--src/core/lib/channel/channel_trace.h27
-rw-r--r--src/core/lib/channel/channelz.cc71
-rw-r--r--src/core/lib/channel/channelz.h40
-rw-r--r--src/core/lib/channel/handshaker_factory.cc5
-rw-r--r--src/core/lib/channel/handshaker_factory.h2
-rw-r--r--src/core/lib/channel/handshaker_registry.cc8
-rw-r--r--src/core/lib/channel/handshaker_registry.h1
-rw-r--r--src/core/lib/http/httpcli_security_connector.cc3
-rw-r--r--src/core/lib/iomgr/exec_ctx.h7
-rw-r--r--src/core/lib/security/security_connector/alts_security_connector.cc12
-rw-r--r--src/core/lib/security/security_connector/security_connector.cc7
-rw-r--r--src/core/lib/security/security_connector/security_connector.h5
-rw-r--r--src/core/lib/security/transport/security_handshaker.cc10
-rw-r--r--src/core/lib/slice/slice.cc8
-rw-r--r--src/core/lib/slice/slice_internal.h5
-rw-r--r--src/core/lib/surface/channel.cc13
-rw-r--r--src/core/lib/surface/init_secure.cc2
-rw-r--r--src/core/lib/surface/server.cc11
-rw-r--r--src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc3
-rw-r--r--src/core/tsi/alts/handshaker/alts_tsi_handshaker.h5
-rw-r--r--src/csharp/Grpc.Core/ChannelOptions.cs56
-rw-r--r--src/csharp/doc/README.md19
-rwxr-xr-xsrc/csharp/doc/generate_reference_docs.sh38
-rw-r--r--test/core/channel/channel_trace_test.cc179
-rw-r--r--test/core/channel/channelz_test.cc21
-rw-r--r--test/core/end2end/tests/channelz.cc17
-rw-r--r--test/core/handshake/readahead_handshaker_server_ssl.cc1
-rw-r--r--test/core/tsi/alts/handshaker/alts_tsi_handshaker_test.cc2
-rw-r--r--test/cpp/end2end/channelz_service_test.cc6
36 files changed, 441 insertions, 214 deletions
diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md
index 5b2ac80df6..d31aea6c73 100644
--- a/.github/ISSUE_TEMPLATE.md
+++ b/.github/ISSUE_TEMPLATE.md
@@ -26,6 +26,8 @@ If possible, provide a recipe for reproducing the error. Try being specific and
### What did you see instead?
Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs).
+
+See https://github.com/grpc/grpc/blob/master/TROUBLESHOOTING.md for how to diagnose problems better.
### Anything else we should know about your project / environment?
diff --git a/include/grpc/impl/codegen/grpc_types.h b/include/grpc/impl/codegen/grpc_types.h
index d1f8834d11..3ce88a8264 100644
--- a/include/grpc/impl/codegen/grpc_types.h
+++ b/include/grpc/impl/codegen/grpc_types.h
@@ -285,10 +285,12 @@ typedef struct {
#define GRPC_ARG_SOCKET_MUTATOR "grpc.socket_mutator"
/** The grpc_socket_factory instance to create and bind sockets. A pointer. */
#define GRPC_ARG_SOCKET_FACTORY "grpc.socket_factory"
-/** The maximum number of trace events to keep in the tracer for each channel or
- * subchannel. The default is 0. If set to 0, channel tracing is disabled. */
-#define GRPC_ARG_MAX_CHANNEL_TRACE_EVENTS_PER_NODE \
- "grpc.max_channel_trace_events_per_node"
+/** The maximum amount of memory used by trace events per channel trace node.
+ * Once the maximum is reached, subsequent events will evict the oldest events
+ * from the buffer. The unit for this knob is bytes. Setting it to zero causes
+ * channel tracing to be disabled. */
+#define GRPC_ARG_MAX_CHANNEL_TRACE_EVENT_MEMORY_PER_NODE \
+ "grpc.max_channel_trace_event_memory_per_node"
/** If non-zero, gRPC library will track stats and information at at per channel
* level. Disabling channelz naturally disables channel tracing. The default
* is for channelz to be disabled. */
diff --git a/src/core/ext/filters/client_channel/http_connect_handshaker.cc b/src/core/ext/filters/client_channel/http_connect_handshaker.cc
index bfabc68c66..7ce8da8c00 100644
--- a/src/core/ext/filters/client_channel/http_connect_handshaker.cc
+++ b/src/core/ext/filters/client_channel/http_connect_handshaker.cc
@@ -351,7 +351,6 @@ static grpc_handshaker* grpc_http_connect_handshaker_create() {
static void handshaker_factory_add_handshakers(
grpc_handshaker_factory* factory, const grpc_channel_args* args,
- grpc_pollset_set* interested_parties,
grpc_handshake_manager* handshake_mgr) {
grpc_handshake_manager_add(handshake_mgr,
grpc_http_connect_handshaker_create());
diff --git a/src/core/ext/filters/client_channel/subchannel.cc b/src/core/ext/filters/client_channel/subchannel.cc
index 088c9d6c00..4a668b0fa7 100644
--- a/src/core/ext/filters/client_channel/subchannel.cc
+++ b/src/core/ext/filters/client_channel/subchannel.cc
@@ -390,16 +390,16 @@ grpc_subchannel* grpc_subchannel_create(grpc_connector* connector,
grpc_channel_args_find(c->args, GRPC_ARG_ENABLE_CHANNELZ);
bool channelz_enabled =
grpc_channel_arg_get_bool(arg, GRPC_ENABLE_CHANNELZ_DEFAULT);
- arg = grpc_channel_args_find(c->args,
- GRPC_ARG_MAX_CHANNEL_TRACE_EVENTS_PER_NODE);
+ arg = grpc_channel_args_find(
+ c->args, GRPC_ARG_MAX_CHANNEL_TRACE_EVENT_MEMORY_PER_NODE);
const grpc_integer_options options = {
- GRPC_MAX_CHANNEL_TRACE_EVENTS_PER_NODE_DEFAULT, 0, INT_MAX};
- size_t channel_tracer_max_nodes =
+ GRPC_MAX_CHANNEL_TRACE_EVENT_MEMORY_PER_NODE_DEFAULT, 0, INT_MAX};
+ size_t channel_tracer_max_memory =
(size_t)grpc_channel_arg_get_integer(arg, options);
if (channelz_enabled) {
c->channelz_subchannel =
grpc_core::MakeRefCounted<grpc_core::channelz::SubchannelNode>(
- c, channel_tracer_max_nodes);
+ c, channel_tracer_max_memory);
c->channelz_subchannel->AddTraceEvent(
grpc_core::channelz::ChannelTrace::Severity::Info,
grpc_slice_from_static_string("Subchannel created"));
diff --git a/src/core/ext/transport/chttp2/client/chttp2_connector.cc b/src/core/ext/transport/chttp2/client/chttp2_connector.cc
index 5229304fa4..0ac84032fd 100644
--- a/src/core/ext/transport/chttp2/client/chttp2_connector.cc
+++ b/src/core/ext/transport/chttp2/client/chttp2_connector.cc
@@ -160,7 +160,7 @@ static void on_handshake_done(void* arg, grpc_error* error) {
static void start_handshake_locked(chttp2_connector* c) {
c->handshake_mgr = grpc_handshake_manager_create();
grpc_handshakers_add(HANDSHAKER_CLIENT, c->args.channel_args,
- c->args.interested_parties, c->handshake_mgr);
+ c->handshake_mgr);
grpc_endpoint_add_to_pollset_set(c->endpoint, c->args.interested_parties);
grpc_handshake_manager_do_handshake(
c->handshake_mgr, c->args.interested_parties, c->endpoint,
diff --git a/src/core/ext/transport/chttp2/server/chttp2_server.cc b/src/core/ext/transport/chttp2/server/chttp2_server.cc
index c5a9cf61ac..bd014656ed 100644
--- a/src/core/ext/transport/chttp2/server/chttp2_server.cc
+++ b/src/core/ext/transport/chttp2/server/chttp2_server.cc
@@ -67,7 +67,6 @@ typedef struct {
grpc_timer timer;
grpc_closure on_timeout;
grpc_closure on_receive_settings;
- grpc_pollset_set* interested_parties;
} server_connection_state;
static void server_connection_state_unref(
@@ -77,9 +76,6 @@ static void server_connection_state_unref(
GRPC_CHTTP2_UNREF_TRANSPORT(connection_state->transport,
"receive settings timeout");
}
- grpc_pollset_set_del_pollset(connection_state->interested_parties,
- connection_state->accepting_pollset);
- grpc_pollset_set_destroy(connection_state->interested_parties);
gpr_free(connection_state);
}
}
@@ -194,11 +190,7 @@ static void on_accept(void* arg, grpc_endpoint* tcp,
connection_state->accepting_pollset = accepting_pollset;
connection_state->acceptor = acceptor;
connection_state->handshake_mgr = handshake_mgr;
- connection_state->interested_parties = grpc_pollset_set_create();
- grpc_pollset_set_add_pollset(connection_state->interested_parties,
- connection_state->accepting_pollset);
grpc_handshakers_add(HANDSHAKER_SERVER, state->args,
- connection_state->interested_parties,
connection_state->handshake_mgr);
const grpc_arg* timeout_arg =
grpc_channel_args_find(state->args, GRPC_ARG_SERVER_HANDSHAKE_TIMEOUT_MS);
diff --git a/src/core/lib/channel/channel_trace.cc b/src/core/lib/channel/channel_trace.cc
index cfb2faba51..fe81acb617 100644
--- a/src/core/lib/channel/channel_trace.cc
+++ b/src/core/lib/channel/channel_trace.cc
@@ -48,31 +48,35 @@ ChannelTrace::TraceEvent::TraceEvent(Severity severity, grpc_slice data,
timestamp_(grpc_millis_to_timespec(grpc_core::ExecCtx::Get()->Now(),
GPR_CLOCK_REALTIME)),
next_(nullptr),
- referenced_entity_(std::move(referenced_entity)) {}
+ referenced_entity_(std::move(referenced_entity)),
+ memory_usage_(sizeof(TraceEvent) + grpc_slice_memory_usage(data)) {}
ChannelTrace::TraceEvent::TraceEvent(Severity severity, grpc_slice data)
: severity_(severity),
data_(data),
timestamp_(grpc_millis_to_timespec(grpc_core::ExecCtx::Get()->Now(),
GPR_CLOCK_REALTIME)),
- next_(nullptr) {}
+ next_(nullptr),
+ memory_usage_(sizeof(TraceEvent) + grpc_slice_memory_usage(data)) {}
ChannelTrace::TraceEvent::~TraceEvent() { grpc_slice_unref_internal(data_); }
-ChannelTrace::ChannelTrace(size_t max_events)
+ChannelTrace::ChannelTrace(size_t max_event_memory)
: num_events_logged_(0),
- list_size_(0),
- max_list_size_(max_events),
+ event_list_memory_usage_(0),
+ max_event_memory_(max_event_memory),
head_trace_(nullptr),
tail_trace_(nullptr) {
- if (max_list_size_ == 0) return; // tracing is disabled if max_events == 0
+ if (max_event_memory_ == 0)
+ return; // tracing is disabled if max_event_memory_ == 0
gpr_mu_init(&tracer_mu_);
time_created_ = grpc_millis_to_timespec(grpc_core::ExecCtx::Get()->Now(),
GPR_CLOCK_REALTIME);
}
ChannelTrace::~ChannelTrace() {
- if (max_list_size_ == 0) return; // tracing is disabled if max_events == 0
+ if (max_event_memory_ == 0)
+ return; // tracing is disabled if max_event_memory_ == 0
TraceEvent* it = head_trace_;
while (it != nullptr) {
TraceEvent* to_free = it;
@@ -93,25 +97,27 @@ void ChannelTrace::AddTraceEventHelper(TraceEvent* new_trace_event) {
tail_trace_->set_next(new_trace_event);
tail_trace_ = tail_trace_->next();
}
- ++list_size_;
- // maybe garbage collect the end
- if (list_size_ > max_list_size_) {
+ event_list_memory_usage_ += new_trace_event->memory_usage();
+ // maybe garbage collect the tail until we are under the memory limit.
+ while (event_list_memory_usage_ > max_event_memory_) {
TraceEvent* to_free = head_trace_;
+ event_list_memory_usage_ -= to_free->memory_usage();
head_trace_ = head_trace_->next();
Delete<TraceEvent>(to_free);
- --list_size_;
}
}
void ChannelTrace::AddTraceEvent(Severity severity, grpc_slice data) {
- if (max_list_size_ == 0) return; // tracing is disabled if max_events == 0
+ if (max_event_memory_ == 0)
+ return; // tracing is disabled if max_event_memory_ == 0
AddTraceEventHelper(New<TraceEvent>(severity, data));
}
void ChannelTrace::AddTraceEventWithReference(
Severity severity, grpc_slice data,
RefCountedPtr<BaseNode> referenced_entity) {
- if (max_list_size_ == 0) return; // tracing is disabled if max_events == 0
+ if (max_event_memory_ == 0)
+ return; // tracing is disabled if max_event_memory_ == 0
// create and fill up the new event
AddTraceEventHelper(
New<TraceEvent>(severity, data, std::move(referenced_entity)));
@@ -162,8 +168,8 @@ void ChannelTrace::TraceEvent::RenderTraceEvent(grpc_json* json) const {
}
grpc_json* ChannelTrace::RenderJson() const {
- if (!max_list_size_)
- return nullptr; // tracing is disabled if max_events == 0
+ if (max_event_memory_ == 0)
+ return nullptr; // tracing is disabled if max_event_memory_ == 0
grpc_json* json = grpc_json_create(GRPC_JSON_OBJECT);
grpc_json* json_iterator = nullptr;
if (num_events_logged_ > 0) {
@@ -174,7 +180,7 @@ grpc_json* ChannelTrace::RenderJson() const {
json_iterator, json, "creationTimestamp",
gpr_format_timespec(time_created_), GRPC_JSON_STRING, true);
// only add in the event list if it is non-empty.
- if (num_events_logged_ > 0) {
+ if (head_trace_ != nullptr) {
grpc_json* events = grpc_json_create_child(json_iterator, json, "events",
nullptr, GRPC_JSON_ARRAY, false);
json_iterator = nullptr;
diff --git a/src/core/lib/channel/channel_trace.h b/src/core/lib/channel/channel_trace.h
index 94fea20b45..8ff91ee8c8 100644
--- a/src/core/lib/channel/channel_trace.h
+++ b/src/core/lib/channel/channel_trace.h
@@ -30,6 +30,10 @@
namespace grpc_core {
namespace channelz {
+namespace testing {
+size_t GetSizeofTraceEvent(void);
+}
+
class BaseNode;
// Object used to hold live data for a channel. This data is exposed via the
@@ -37,7 +41,7 @@ class BaseNode;
// https://github.com/grpc/proposal/blob/master/A14-channelz.md
class ChannelTrace {
public:
- ChannelTrace(size_t max_events);
+ ChannelTrace(size_t max_event_memory);
~ChannelTrace();
enum Severity {
@@ -49,6 +53,12 @@ class ChannelTrace {
// Adds a new trace event to the tracing object
//
+ // NOTE: each ChannelTrace tracks the memory used by its list of trace
+ // events, so adding an event with a large amount of data could cause other
+ // trace event to be evicted. If a single trace is larger than the limit, it
+ // will cause all events to be evicted. The limit is set with the arg:
+ // GRPC_ARG_MAX_CHANNEL_TRACE_EVENT_MEMORY_PER_NODE.
+ //
// TODO(ncteisen): as this call is used more and more throughout the gRPC
// stack, determine if it makes more sense to accept a char* instead of a
// slice.
@@ -59,9 +69,9 @@ class ChannelTrace {
// channel has created a new subchannel, then it would record that with
// a TraceEvent referencing the new subchannel.
//
- // TODO(ncteisen): as this call is used more and more throughout the gRPC
- // stack, determine if it makes more sense to accept a char* instead of a
- // slice.
+ // NOTE: see the note in the method above.
+ //
+ // TODO(ncteisen): see the todo in the method above.
void AddTraceEventWithReference(Severity severity, grpc_slice data,
RefCountedPtr<BaseNode> referenced_entity);
@@ -70,6 +80,8 @@ class ChannelTrace {
grpc_json* RenderJson() const;
private:
+ friend size_t testing::GetSizeofTraceEvent(void);
+
// Private class to encapsulate all the data and bookkeeping needed for a
// a trace event.
class TraceEvent {
@@ -92,6 +104,8 @@ class ChannelTrace {
TraceEvent* next() const { return next_; }
void set_next(TraceEvent* next) { next_ = next; }
+ size_t memory_usage() const { return memory_usage_; }
+
private:
Severity severity_;
grpc_slice data_;
@@ -99,6 +113,7 @@ class ChannelTrace {
TraceEvent* next_;
// the tracer object for the (sub)channel that this trace event refers to.
RefCountedPtr<BaseNode> referenced_entity_;
+ size_t memory_usage_;
}; // TraceEvent
// Internal helper to add and link in a trace event
@@ -106,8 +121,8 @@ class ChannelTrace {
gpr_mu tracer_mu_;
uint64_t num_events_logged_;
- size_t list_size_;
- size_t max_list_size_;
+ size_t event_list_memory_usage_;
+ size_t max_event_memory_;
TraceEvent* head_trace_;
TraceEvent* tail_trace_;
gpr_timespec time_created_;
diff --git a/src/core/lib/channel/channelz.cc b/src/core/lib/channel/channelz.cc
index c384f99833..03ad8596e1 100644
--- a/src/core/lib/channel/channelz.cc
+++ b/src/core/lib/channel/channelz.cc
@@ -34,6 +34,7 @@
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/gprpp/memory.h"
#include "src/core/lib/iomgr/error.h"
+#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/surface/channel.h"
#include "src/core/lib/surface/server.h"
@@ -56,35 +57,75 @@ char* BaseNode::RenderJsonString() {
}
CallCountingHelper::CallCountingHelper() {
- gpr_atm_no_barrier_store(&last_call_started_millis_,
- (gpr_atm)ExecCtx::Get()->Now());
+ num_cores_ = GPR_MAX(1, gpr_cpu_num_cores());
+ per_cpu_counter_data_storage_ = static_cast<AtomicCounterData*>(
+ gpr_zalloc(sizeof(AtomicCounterData) * num_cores_));
}
-CallCountingHelper::~CallCountingHelper() {}
+CallCountingHelper::~CallCountingHelper() {
+ gpr_free(per_cpu_counter_data_storage_);
+}
void CallCountingHelper::RecordCallStarted() {
- gpr_atm_no_barrier_fetch_add(&calls_started_, static_cast<gpr_atm>(1));
- gpr_atm_no_barrier_store(&last_call_started_millis_,
- (gpr_atm)ExecCtx::Get()->Now());
+ gpr_atm_no_barrier_fetch_add(
+ &per_cpu_counter_data_storage_[grpc_core::ExecCtx::Get()->starting_cpu()]
+ .calls_started,
+ static_cast<gpr_atm>(1));
+ gpr_atm_no_barrier_store(
+ &per_cpu_counter_data_storage_[grpc_core::ExecCtx::Get()->starting_cpu()]
+ .last_call_started_millis,
+ (gpr_atm)ExecCtx::Get()->Now());
+}
+
+void CallCountingHelper::RecordCallFailed() {
+ gpr_atm_no_barrier_fetch_add(
+ &per_cpu_counter_data_storage_[grpc_core::ExecCtx::Get()->starting_cpu()]
+ .calls_failed,
+ static_cast<gpr_atm>(1));
+}
+
+void CallCountingHelper::RecordCallSucceeded() {
+ gpr_atm_no_barrier_fetch_add(
+ &per_cpu_counter_data_storage_[grpc_core::ExecCtx::Get()->starting_cpu()]
+ .calls_succeeded,
+ static_cast<gpr_atm>(1));
+}
+
+void CallCountingHelper::CollectData(CounterData* out) {
+ for (size_t core = 0; core < num_cores_; ++core) {
+ out->calls_started += gpr_atm_no_barrier_load(
+ &per_cpu_counter_data_storage_[core].calls_started);
+ out->calls_succeeded += gpr_atm_no_barrier_load(
+ &per_cpu_counter_data_storage_[core].calls_succeeded);
+ out->calls_failed += gpr_atm_no_barrier_load(
+ &per_cpu_counter_data_storage_[core].calls_failed);
+ gpr_atm last_call = gpr_atm_no_barrier_load(
+ &per_cpu_counter_data_storage_[core].last_call_started_millis);
+ if (last_call > out->last_call_started_millis) {
+ out->last_call_started_millis = last_call;
+ }
+ }
}
void CallCountingHelper::PopulateCallCounts(grpc_json* json) {
grpc_json* json_iterator = nullptr;
- if (calls_started_ != 0) {
+ CounterData data;
+ CollectData(&data);
+ if (data.calls_started != 0) {
json_iterator = grpc_json_add_number_string_child(
- json, json_iterator, "callsStarted", calls_started_);
+ json, json_iterator, "callsStarted", data.calls_started);
}
- if (calls_succeeded_ != 0) {
+ if (data.calls_succeeded != 0) {
json_iterator = grpc_json_add_number_string_child(
- json, json_iterator, "callsSucceeded", calls_succeeded_);
+ json, json_iterator, "callsSucceeded", data.calls_succeeded);
}
- if (calls_failed_) {
+ if (data.calls_failed) {
json_iterator = grpc_json_add_number_string_child(
- json, json_iterator, "callsFailed", calls_failed_);
+ json, json_iterator, "callsFailed", data.calls_failed);
}
- if (calls_started_ != 0) {
- gpr_timespec ts =
- grpc_millis_to_timespec(last_call_started_millis_, GPR_CLOCK_REALTIME);
+ if (data.calls_started != 0) {
+ gpr_timespec ts = grpc_millis_to_timespec(data.last_call_started_millis,
+ GPR_CLOCK_REALTIME);
json_iterator =
grpc_json_create_child(json_iterator, json, "lastCallStartedTimestamp",
gpr_format_timespec(ts), GRPC_JSON_STRING, true);
diff --git a/src/core/lib/channel/channelz.h b/src/core/lib/channel/channelz.h
index 72b5fe6b6b..a2081b666c 100644
--- a/src/core/lib/channel/channelz.h
+++ b/src/core/lib/channel/channelz.h
@@ -44,10 +44,11 @@
* GRPC_ARG_ENABLE_CHANNELZ is set, it will override this default value. */
#define GRPC_ENABLE_CHANNELZ_DEFAULT false
-/** This is the default value for number of trace events per node. If
- * GRPC_ARG_MAX_CHANNEL_TRACE_EVENTS_PER_NODE is set, it will override this
- * default value. */
-#define GRPC_MAX_CHANNEL_TRACE_EVENTS_PER_NODE_DEFAULT 0
+/** This is the default value for the maximum amount of memory used by trace
+ * events per channel trace node. If
+ * GRPC_ARG_MAX_CHANNEL_TRACE_EVENT_MEMORY_PER_NODE is set, it will override
+ * this default value. */
+#define GRPC_MAX_CHANNEL_TRACE_EVENT_MEMORY_PER_NODE_DEFAULT 0
namespace grpc_core {
@@ -107,12 +108,8 @@ class CallCountingHelper {
~CallCountingHelper();
void RecordCallStarted();
- void RecordCallFailed() {
- gpr_atm_no_barrier_fetch_add(&calls_failed_, static_cast<gpr_atm>(1));
- }
- void RecordCallSucceeded() {
- gpr_atm_no_barrier_fetch_add(&calls_succeeded_, static_cast<gpr_atm>(1));
- }
+ void RecordCallFailed();
+ void RecordCallSucceeded();
// Common rendering of the call count data and last_call_started_timestamp.
void PopulateCallCounts(grpc_json* json);
@@ -121,10 +118,25 @@ class CallCountingHelper {
// testing peer friend.
friend class testing::CallCountingHelperPeer;
- gpr_atm calls_started_ = 0;
- gpr_atm calls_succeeded_ = 0;
- gpr_atm calls_failed_ = 0;
- gpr_atm last_call_started_millis_ = 0;
+ struct AtomicCounterData {
+ gpr_atm calls_started = 0;
+ gpr_atm calls_succeeded = 0;
+ gpr_atm calls_failed = 0;
+ gpr_atm last_call_started_millis = 0;
+ };
+
+ struct CounterData {
+ intptr_t calls_started = 0;
+ intptr_t calls_succeeded = 0;
+ intptr_t calls_failed = 0;
+ intptr_t last_call_started_millis = 0;
+ };
+
+ // collects the sharded data into one CounterData struct.
+ void CollectData(CounterData* out);
+
+ AtomicCounterData* per_cpu_counter_data_storage_ = nullptr;
+ size_t num_cores_ = 0;
};
// Handles channelz bookkeeping for channels
diff --git a/src/core/lib/channel/handshaker_factory.cc b/src/core/lib/channel/handshaker_factory.cc
index 8ade8fe4e2..4fd43635b6 100644
--- a/src/core/lib/channel/handshaker_factory.cc
+++ b/src/core/lib/channel/handshaker_factory.cc
@@ -24,12 +24,11 @@
void grpc_handshaker_factory_add_handshakers(
grpc_handshaker_factory* handshaker_factory, const grpc_channel_args* args,
- grpc_pollset_set* interested_parties,
grpc_handshake_manager* handshake_mgr) {
if (handshaker_factory != nullptr) {
GPR_ASSERT(handshaker_factory->vtable != nullptr);
- handshaker_factory->vtable->add_handshakers(
- handshaker_factory, args, interested_parties, handshake_mgr);
+ handshaker_factory->vtable->add_handshakers(handshaker_factory, args,
+ handshake_mgr);
}
}
diff --git a/src/core/lib/channel/handshaker_factory.h b/src/core/lib/channel/handshaker_factory.h
index e17a678179..3e45fcf20e 100644
--- a/src/core/lib/channel/handshaker_factory.h
+++ b/src/core/lib/channel/handshaker_factory.h
@@ -32,7 +32,6 @@ typedef struct grpc_handshaker_factory grpc_handshaker_factory;
typedef struct {
void (*add_handshakers)(grpc_handshaker_factory* handshaker_factory,
const grpc_channel_args* args,
- grpc_pollset_set* interested_parties,
grpc_handshake_manager* handshake_mgr);
void (*destroy)(grpc_handshaker_factory* handshaker_factory);
} grpc_handshaker_factory_vtable;
@@ -43,7 +42,6 @@ struct grpc_handshaker_factory {
void grpc_handshaker_factory_add_handshakers(
grpc_handshaker_factory* handshaker_factory, const grpc_channel_args* args,
- grpc_pollset_set* interested_parties,
grpc_handshake_manager* handshake_mgr);
void grpc_handshaker_factory_destroy(
diff --git a/src/core/lib/channel/handshaker_registry.cc b/src/core/lib/channel/handshaker_registry.cc
index fbafc43e79..eec3e1b352 100644
--- a/src/core/lib/channel/handshaker_registry.cc
+++ b/src/core/lib/channel/handshaker_registry.cc
@@ -51,11 +51,9 @@ static void grpc_handshaker_factory_list_register(
static void grpc_handshaker_factory_list_add_handshakers(
grpc_handshaker_factory_list* list, const grpc_channel_args* args,
- grpc_pollset_set* interested_parties,
grpc_handshake_manager* handshake_mgr) {
for (size_t i = 0; i < list->num_factories; ++i) {
- grpc_handshaker_factory_add_handshakers(list->list[i], args,
- interested_parties, handshake_mgr);
+ grpc_handshaker_factory_add_handshakers(list->list[i], args, handshake_mgr);
}
}
@@ -93,9 +91,7 @@ void grpc_handshaker_factory_register(bool at_start,
void grpc_handshakers_add(grpc_handshaker_type handshaker_type,
const grpc_channel_args* args,
- grpc_pollset_set* interested_parties,
grpc_handshake_manager* handshake_mgr) {
grpc_handshaker_factory_list_add_handshakers(
- &g_handshaker_factory_lists[handshaker_type], args, interested_parties,
- handshake_mgr);
+ &g_handshaker_factory_lists[handshaker_type], args, handshake_mgr);
}
diff --git a/src/core/lib/channel/handshaker_registry.h b/src/core/lib/channel/handshaker_registry.h
index 3dd4316de6..82ad9c5b9a 100644
--- a/src/core/lib/channel/handshaker_registry.h
+++ b/src/core/lib/channel/handshaker_registry.h
@@ -43,7 +43,6 @@ void grpc_handshaker_factory_register(bool at_start,
void grpc_handshakers_add(grpc_handshaker_type handshaker_type,
const grpc_channel_args* args,
- grpc_pollset_set* interested_parties,
grpc_handshake_manager* handshake_mgr);
#endif /* GRPC_CORE_LIB_CHANNEL_HANDSHAKER_REGISTRY_H */
diff --git a/src/core/lib/http/httpcli_security_connector.cc b/src/core/lib/http/httpcli_security_connector.cc
index 98fb7d3937..50078c37a1 100644
--- a/src/core/lib/http/httpcli_security_connector.cc
+++ b/src/core/lib/http/httpcli_security_connector.cc
@@ -189,8 +189,7 @@ static void ssl_handshake(void* arg, grpc_endpoint* tcp, const char* host,
grpc_arg channel_arg = grpc_security_connector_to_arg(&sc->base);
grpc_channel_args args = {1, &channel_arg};
c->handshake_mgr = grpc_handshake_manager_create();
- grpc_handshakers_add(HANDSHAKER_CLIENT, &args,
- nullptr /* interested_parties */, c->handshake_mgr);
+ grpc_handshakers_add(HANDSHAKER_CLIENT, &args, c->handshake_mgr);
grpc_handshake_manager_do_handshake(
c->handshake_mgr, nullptr /* interested_parties */, tcp,
nullptr /* channel_args */, deadline, nullptr /* acceptor */,
diff --git a/src/core/lib/iomgr/exec_ctx.h b/src/core/lib/iomgr/exec_ctx.h
index f3528d527a..e90eb54cd3 100644
--- a/src/core/lib/iomgr/exec_ctx.h
+++ b/src/core/lib/iomgr/exec_ctx.h
@@ -116,12 +116,7 @@ class ExecCtx {
ExecCtx(const ExecCtx&) = delete;
ExecCtx& operator=(const ExecCtx&) = delete;
- /** Return starting_cpu. This is only required for stats collection and is
- * hence only defined if GRPC_COLLECT_STATS is enabled.
- */
-#if defined(GRPC_COLLECT_STATS) || !defined(NDEBUG)
unsigned starting_cpu() const { return starting_cpu_; }
-#endif /* defined(GRPC_COLLECT_STATS) || !defined(NDEBUG) */
struct CombinerData {
/* currently active combiner: updated only via combiner.c */
@@ -223,9 +218,7 @@ class ExecCtx {
CombinerData combiner_data_ = {nullptr, nullptr};
uintptr_t flags_;
-#if defined(GRPC_COLLECT_STATS) || !defined(NDEBUG)
unsigned starting_cpu_ = gpr_cpu_current_cpu();
-#endif /* defined(GRPC_COLLECT_STATS) || !defined(NDEBUG) */
bool now_is_valid_ = false;
grpc_millis now_ = 0;
diff --git a/src/core/lib/security/security_connector/alts_security_connector.cc b/src/core/lib/security/security_connector/alts_security_connector.cc
index f157c93171..35a787871a 100644
--- a/src/core/lib/security/security_connector/alts_security_connector.cc
+++ b/src/core/lib/security/security_connector/alts_security_connector.cc
@@ -70,9 +70,9 @@ static void alts_channel_add_handshakers(
auto c = reinterpret_cast<grpc_alts_channel_security_connector*>(sc);
grpc_alts_credentials* creds =
reinterpret_cast<grpc_alts_credentials*>(c->base.channel_creds);
- GPR_ASSERT(alts_tsi_handshaker_create(
- creds->options, c->target_name, creds->handshaker_service_url,
- true, sc->base.interested_parties, &handshaker) == TSI_OK);
+ GPR_ASSERT(alts_tsi_handshaker_create(creds->options, c->target_name,
+ creds->handshaker_service_url, true,
+ &handshaker) == TSI_OK);
grpc_handshake_manager_add(handshake_manager, grpc_security_handshaker_create(
handshaker, &sc->base));
}
@@ -84,9 +84,9 @@ static void alts_server_add_handshakers(
auto c = reinterpret_cast<grpc_alts_server_security_connector*>(sc);
grpc_alts_server_credentials* creds =
reinterpret_cast<grpc_alts_server_credentials*>(c->base.server_creds);
- GPR_ASSERT(alts_tsi_handshaker_create(
- creds->options, nullptr, creds->handshaker_service_url, false,
- sc->base.interested_parties, &handshaker) == TSI_OK);
+ GPR_ASSERT(alts_tsi_handshaker_create(creds->options, nullptr,
+ creds->handshaker_service_url, false,
+ &handshaker) == TSI_OK);
grpc_handshake_manager_add(handshake_manager, grpc_security_handshaker_create(
handshaker, &sc->base));
}
diff --git a/src/core/lib/security/security_connector/security_connector.cc b/src/core/lib/security/security_connector/security_connector.cc
index f4490582a3..6246613e7b 100644
--- a/src/core/lib/security/security_connector/security_connector.cc
+++ b/src/core/lib/security/security_connector/security_connector.cc
@@ -156,13 +156,6 @@ int grpc_security_connector_cmp(grpc_security_connector* sc,
return sc->vtable->cmp(sc, other);
}
-void grpc_security_connector_set_interested_parties(
- grpc_security_connector* sc, grpc_pollset_set* interested_parties) {
- if (sc != nullptr) {
- sc->interested_parties = interested_parties;
- }
-}
-
int grpc_channel_security_connector_cmp(grpc_channel_security_connector* sc1,
grpc_channel_security_connector* sc2) {
GPR_ASSERT(sc1->channel_creds != nullptr);
diff --git a/src/core/lib/security/security_connector/security_connector.h b/src/core/lib/security/security_connector/security_connector.h
index f0172594ad..67a506b576 100644
--- a/src/core/lib/security/security_connector/security_connector.h
+++ b/src/core/lib/security/security_connector/security_connector.h
@@ -63,7 +63,6 @@ struct grpc_security_connector {
const grpc_security_connector_vtable* vtable;
gpr_refcount refcount;
const char* url_scheme;
- grpc_pollset_set* interested_parties;
};
/* Refcounting. */
@@ -107,10 +106,6 @@ grpc_security_connector* grpc_security_connector_from_arg(const grpc_arg* arg);
grpc_security_connector* grpc_security_connector_find_in_args(
const grpc_channel_args* args);
-/* Util to set the interested_parties whose ownership is not transferred. */
-void grpc_security_connector_set_interested_parties(
- grpc_security_connector* sc, grpc_pollset_set* interested_parties);
-
/* --- channel_security_connector object. ---
A channel security connector object represents a way to configure the
diff --git a/src/core/lib/security/transport/security_handshaker.cc b/src/core/lib/security/transport/security_handshaker.cc
index f3bdf573b3..d76d582638 100644
--- a/src/core/lib/security/transport/security_handshaker.cc
+++ b/src/core/lib/security/transport/security_handshaker.cc
@@ -475,30 +475,20 @@ static grpc_handshaker* fail_handshaker_create() {
static void client_handshaker_factory_add_handshakers(
grpc_handshaker_factory* handshaker_factory, const grpc_channel_args* args,
- grpc_pollset_set* interested_parties,
grpc_handshake_manager* handshake_mgr) {
grpc_channel_security_connector* security_connector =
reinterpret_cast<grpc_channel_security_connector*>(
grpc_security_connector_find_in_args(args));
- if (security_connector != nullptr) {
- grpc_security_connector_set_interested_parties(&security_connector->base,
- interested_parties);
- }
grpc_channel_security_connector_add_handshakers(security_connector,
handshake_mgr);
}
static void server_handshaker_factory_add_handshakers(
grpc_handshaker_factory* hf, const grpc_channel_args* args,
- grpc_pollset_set* interested_parties,
grpc_handshake_manager* handshake_mgr) {
grpc_server_security_connector* security_connector =
reinterpret_cast<grpc_server_security_connector*>(
grpc_security_connector_find_in_args(args));
- if (security_connector != nullptr) {
- grpc_security_connector_set_interested_parties(&security_connector->base,
- interested_parties);
- }
grpc_server_security_connector_add_handshakers(security_connector,
handshake_mgr);
}
diff --git a/src/core/lib/slice/slice.cc b/src/core/lib/slice/slice.cc
index 419474129b..e842d84f11 100644
--- a/src/core/lib/slice/slice.cc
+++ b/src/core/lib/slice/slice.cc
@@ -88,6 +88,14 @@ static const grpc_slice_refcount_vtable noop_refcount_vtable = {
static grpc_slice_refcount noop_refcount = {&noop_refcount_vtable,
&noop_refcount};
+size_t grpc_slice_memory_usage(grpc_slice s) {
+ if (s.refcount == nullptr || s.refcount == &noop_refcount) {
+ return 0;
+ } else {
+ return s.data.refcounted.length;
+ }
+}
+
grpc_slice grpc_slice_from_static_buffer(const void* s, size_t len) {
grpc_slice slice;
slice.refcount = &noop_refcount;
diff --git a/src/core/lib/slice/slice_internal.h b/src/core/lib/slice/slice_internal.h
index 5d3d26b67b..5b05951522 100644
--- a/src/core/lib/slice/slice_internal.h
+++ b/src/core/lib/slice/slice_internal.h
@@ -46,4 +46,9 @@ grpc_slice grpc_slice_maybe_static_intern(grpc_slice slice,
uint32_t grpc_static_slice_hash(grpc_slice s);
int grpc_static_slice_eq(grpc_slice a, grpc_slice b);
+// Returns the memory used by this slice, not counting the slice structure
+// itself. This means that inlined and slices from static strings will return
+// 0. All other slices will return the size of the allocated chars.
+size_t grpc_slice_memory_usage(grpc_slice s);
+
#endif /* GRPC_CORE_LIB_SLICE_SLICE_INTERNAL_H */
diff --git a/src/core/lib/surface/channel.cc b/src/core/lib/surface/channel.cc
index 4996c3f177..4294434504 100644
--- a/src/core/lib/surface/channel.cc
+++ b/src/core/lib/surface/channel.cc
@@ -102,8 +102,8 @@ grpc_channel* grpc_channel_create_with_builder(
channel->target = target;
channel->is_client = grpc_channel_stack_type_is_client(channel_stack_type);
- size_t channel_tracer_max_nodes = 0; // default to off
bool channelz_enabled = GRPC_ENABLE_CHANNELZ_DEFAULT;
+ size_t channel_tracer_max_memory = 0; // default to off
bool internal_channel = false;
// this creates the default ChannelNode. Different types of channels may
// override this to ensure a correct ChannelNode is created.
@@ -141,12 +141,11 @@ grpc_channel* grpc_channel_create_with_builder(
static_cast<uint32_t>(args->args[i].value.integer) |
0x1; /* always support no compression */
} else if (0 == strcmp(args->args[i].key,
- GRPC_ARG_MAX_CHANNEL_TRACE_EVENTS_PER_NODE)) {
- GPR_ASSERT(channel_tracer_max_nodes == 0);
- // max_nodes defaults to 0 (which is off), clamped between 0 and INT_MAX
+ GRPC_ARG_MAX_CHANNEL_TRACE_EVENT_MEMORY_PER_NODE)) {
+ GPR_ASSERT(channel_tracer_max_memory == 0);
const grpc_integer_options options = {
- GRPC_MAX_CHANNEL_TRACE_EVENTS_PER_NODE_DEFAULT, 0, INT_MAX};
- channel_tracer_max_nodes =
+ GRPC_MAX_CHANNEL_TRACE_EVENT_MEMORY_PER_NODE_DEFAULT, 0, INT_MAX};
+ channel_tracer_max_memory =
(size_t)grpc_channel_arg_get_integer(&args->args[i], options);
} else if (0 == strcmp(args->args[i].key, GRPC_ARG_ENABLE_CHANNELZ)) {
// channelz will not be enabled by default until all concerns in
@@ -171,7 +170,7 @@ grpc_channel* grpc_channel_create_with_builder(
// bookkeeping for server channels occurs in src/core/lib/surface/server.cc
if (channelz_enabled && channel->is_client) {
channel->channelz_channel = channel_node_create_func(
- channel, channel_tracer_max_nodes, !internal_channel);
+ channel, channel_tracer_max_memory, !internal_channel);
channel->channelz_channel->AddTraceEvent(
grpc_core::channelz::ChannelTrace::Severity::Info,
grpc_slice_from_static_string("Channel created"));
diff --git a/src/core/lib/surface/init_secure.cc b/src/core/lib/surface/init_secure.cc
index 28c6f7b121..765350cced 100644
--- a/src/core/lib/surface/init_secure.cc
+++ b/src/core/lib/surface/init_secure.cc
@@ -74,7 +74,7 @@ void grpc_register_security_filters(void) {
maybe_prepend_client_auth_filter, nullptr);
grpc_channel_init_register_stage(GRPC_CLIENT_DIRECT_CHANNEL, INT_MAX - 1,
maybe_prepend_client_auth_filter, nullptr);
- grpc_channel_init_register_stage(GRPC_SERVER_CHANNEL, INT_MAX,
+ grpc_channel_init_register_stage(GRPC_SERVER_CHANNEL, INT_MAX - 1,
maybe_prepend_server_auth_filter, nullptr);
}
diff --git a/src/core/lib/surface/server.cc b/src/core/lib/surface/server.cc
index 0acfb32e64..3a536b07d7 100644
--- a/src/core/lib/surface/server.cc
+++ b/src/core/lib/surface/server.cc
@@ -1010,13 +1010,14 @@ grpc_server* grpc_server_create(const grpc_channel_args* args, void* reserved) {
const grpc_arg* arg = grpc_channel_args_find(args, GRPC_ARG_ENABLE_CHANNELZ);
if (grpc_channel_arg_get_bool(arg, GRPC_ENABLE_CHANNELZ_DEFAULT)) {
- arg = grpc_channel_args_find(args,
- GRPC_ARG_MAX_CHANNEL_TRACE_EVENTS_PER_NODE);
- size_t trace_events_per_node = grpc_channel_arg_get_integer(
- arg, {GRPC_MAX_CHANNEL_TRACE_EVENTS_PER_NODE_DEFAULT, 0, INT_MAX});
+ arg = grpc_channel_args_find(
+ args, GRPC_ARG_MAX_CHANNEL_TRACE_EVENT_MEMORY_PER_NODE);
+ size_t channel_tracer_max_memory = grpc_channel_arg_get_integer(
+ arg,
+ {GRPC_MAX_CHANNEL_TRACE_EVENT_MEMORY_PER_NODE_DEFAULT, 0, INT_MAX});
server->channelz_server =
grpc_core::MakeRefCounted<grpc_core::channelz::ServerNode>(
- server, trace_events_per_node);
+ server, channel_tracer_max_memory);
server->channelz_server->AddTraceEvent(
grpc_core::channelz::ChannelTrace::Severity::Info,
grpc_slice_from_static_string("Server created"));
diff --git a/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc b/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc
index dfdd659b87..34608a3de1 100644
--- a/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc
+++ b/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc
@@ -347,8 +347,7 @@ static void init_shared_resources(const char* handshaker_service_url) {
tsi_result alts_tsi_handshaker_create(
const grpc_alts_credentials_options* options, const char* target_name,
- const char* handshaker_service_url, bool is_client,
- grpc_pollset_set* interested_parties, tsi_handshaker** self) {
+ const char* handshaker_service_url, bool is_client, tsi_handshaker** self) {
if (handshaker_service_url == nullptr || self == nullptr ||
options == nullptr || (is_client && target_name == nullptr)) {
gpr_log(GPR_ERROR, "Invalid arguments to alts_tsi_handshaker_create()");
diff --git a/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h b/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h
index 48ce69b1da..227b30ce53 100644
--- a/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h
+++ b/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h
@@ -23,7 +23,6 @@
#include <grpc/grpc.h>
-#include "src/core/lib/iomgr/pollset_set.h"
#include "src/core/lib/security/credentials/alts/grpc_alts_credentials_options.h"
#include "src/core/tsi/alts_transport_security.h"
#include "src/core/tsi/transport_security.h"
@@ -52,7 +51,6 @@ typedef struct alts_tsi_handshaker alts_tsi_handshaker;
* "host:port".
* - is_client: boolean value indicating if the handshaker is used at the client
* (is_client = true) or server (is_client = false) side.
- * - interested_parties: set of pollsets interested in this connection.
* - self: address of ALTS TSI handshaker instance to be returned from the
* method.
*
@@ -60,8 +58,7 @@ typedef struct alts_tsi_handshaker alts_tsi_handshaker;
*/
tsi_result alts_tsi_handshaker_create(
const grpc_alts_credentials_options* options, const char* target_name,
- const char* handshaker_service_url, bool is_client,
- grpc_pollset_set* interested_parties, tsi_handshaker** self);
+ const char* handshaker_service_url, bool is_client, tsi_handshaker** self);
/**
* This method handles handshaker response returned from ALTS handshaker
diff --git a/src/csharp/Grpc.Core/ChannelOptions.cs b/src/csharp/Grpc.Core/ChannelOptions.cs
index 6ad5d56cad..880f2bef5f 100644
--- a/src/csharp/Grpc.Core/ChannelOptions.cs
+++ b/src/csharp/Grpc.Core/ChannelOptions.cs
@@ -26,8 +26,10 @@ namespace Grpc.Core
/// <summary>
/// Channel option specified when creating a channel.
/// Corresponds to grpc_channel_args from grpc/grpc.h.
+ /// Commonly used channel option names are defined in <c>ChannelOptions</c>,
+ /// but any of the GRPC_ARG_* channel options names defined in grpc_types.h can be used.
/// </summary>
- public sealed class ChannelOption
+ public sealed class ChannelOption : IEquatable<ChannelOption>
{
/// <summary>
/// Type of <c>ChannelOption</c>.
@@ -119,10 +121,60 @@ namespace Grpc.Core
return stringValue;
}
}
+
+ /// <summary>
+ /// Determines whether the specified object is equal to the current object.
+ /// </summary>
+ public override bool Equals(object obj)
+ {
+ return Equals(obj as ChannelOption);
+ }
+
+ /// <summary>
+ /// Determines whether the specified object is equal to the current object.
+ /// </summary>
+ public bool Equals(ChannelOption other)
+ {
+ return other != null &&
+ type == other.type &&
+ name == other.name &&
+ intValue == other.intValue &&
+ stringValue == other.stringValue;
+ }
+
+ /// <summary>
+ /// A hash code for the current object.
+ /// </summary>
+ public override int GetHashCode()
+ {
+ var hashCode = 1412678443;
+ hashCode = hashCode * -1521134295 + type.GetHashCode();
+ hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(name);
+ hashCode = hashCode * -1521134295 + intValue.GetHashCode();
+ hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(stringValue);
+ return hashCode;
+ }
+
+ /// <summary>
+ /// Equality operator.
+ /// </summary>
+ public static bool operator ==(ChannelOption option1, ChannelOption option2)
+ {
+ return EqualityComparer<ChannelOption>.Default.Equals(option1, option2);
+ }
+
+ /// <summary>
+ /// Inequality operator.
+ /// </summary>
+ public static bool operator !=(ChannelOption option1, ChannelOption option2)
+ {
+ return !(option1 == option2);
+ }
}
/// <summary>
- /// Defines names of supported channel options.
+ /// Defines names of most commonly used channel options.
+ /// Other supported options names can be found in grpc_types.h (GRPC_ARG_* definitions)
/// </summary>
public static class ChannelOptions
{
diff --git a/src/csharp/doc/README.md b/src/csharp/doc/README.md
index 46cce013a1..427f457eb6 100644
--- a/src/csharp/doc/README.md
+++ b/src/csharp/doc/README.md
@@ -1,9 +1,28 @@
DocFX-generated C# API Reference
--------------------------------
+## Generating docs manually (on Windows)
+
Install docfx based on instructions here: https://github.com/dotnet/docfx
```
# generate docfx documentation into ./html directory
$ docfx
```
+
+## Release process: script for regenerating the docs automatically
+
+After each gRPC C# release, the docs need to be regenerated
+and updated on the grpc.io site. The automated script will
+re-generate the docs (using dockerized docfx installation)
+and make everything ready for creating a PR to update the docs.
+
+```
+# 1. Run the script on Linux with docker installed
+$ ./generate_reference_docs.sh
+
+# 2. Enter the git repo with updated "gh-pages" branch
+$ cd grpc-gh-pages
+
+# 3. Review the changes and create a pull request
+```
diff --git a/src/csharp/doc/generate_reference_docs.sh b/src/csharp/doc/generate_reference_docs.sh
new file mode 100755
index 0000000000..c20d6c30bd
--- /dev/null
+++ b/src/csharp/doc/generate_reference_docs.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+# Copyright 2018 The gRPC Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Generates C# API docs using docfx inside docker.
+set -ex
+cd $(dirname $0)
+
+# cleanup temporary files
+rm -rf html obj grpc-gh-pages
+
+# generate into src/csharp/doc/html directory
+cd ..
+docker run --rm -v "$(pwd)":/work -w /work/doc --user "$(id -u):$(id -g)" -it tsgkadot/docker-docfx:latest docfx
+cd doc
+
+# prepare a clone of "gh-pages" branch where the generated docs are stored
+GITHUB_USER="${USER}"
+git clone -b gh-pages -o upstream git@github.com:grpc/grpc.git grpc-gh-pages
+cd grpc-gh-pages
+git remote add origin "git@github.com:${GITHUB_USER}/grpc.git"
+
+# replace old generated docs by the ones we just generated
+rm -r csharp
+cp -r ../html csharp
+
+echo "Done. Go to src/csharp/doc/grpc-gh-pages git repository and create a pull request to update the generated docs."
diff --git a/test/core/channel/channel_trace_test.cc b/test/core/channel/channel_trace_test.cc
index d594445bfb..3d8de79e37 100644
--- a/test/core/channel/channel_trace_test.cc
+++ b/test/core/channel/channel_trace_test.cc
@@ -30,6 +30,7 @@
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/json/json.h"
+#include "src/core/lib/surface/channel.h"
#include "test/core/util/test_config.h"
#include "test/cpp/util/channel_trace_proto_helper.h"
@@ -51,6 +52,8 @@ class ChannelNodePeer {
ChannelNode* node_;
};
+size_t GetSizeofTraceEvent() { return sizeof(ChannelTrace::TraceEvent); }
+
namespace {
grpc_json* GetJsonChild(grpc_json* parent, const char* key) {
@@ -65,6 +68,11 @@ grpc_json* GetJsonChild(grpc_json* parent, const char* key) {
void ValidateJsonArraySize(grpc_json* json, const char* key,
size_t expected_size) {
grpc_json* arr = GetJsonChild(json, key);
+ // the events array should not be present if there are no events.
+ if (expected_size == 0) {
+ EXPECT_EQ(arr, nullptr);
+ return;
+ }
ASSERT_NE(arr, nullptr);
ASSERT_EQ(arr->type, GRPC_JSON_ARRAY);
size_t count = 0;
@@ -94,29 +102,29 @@ void AddSimpleTrace(ChannelTrace* tracer) {
}
// checks for the existence of all the required members of the tracer.
-void ValidateChannelTrace(ChannelTrace* tracer,
- size_t expected_num_event_logged, size_t max_nodes) {
- if (!max_nodes) return;
+void ValidateChannelTraceCustom(ChannelTrace* tracer, size_t num_events_logged,
+ size_t num_events_expected) {
grpc_json* json = tracer->RenderJson();
EXPECT_NE(json, nullptr);
char* json_str = grpc_json_dump_to_string(json, 0);
grpc_json_destroy(json);
grpc::testing::ValidateChannelTraceProtoJsonTranslation(json_str);
grpc_json* parsed_json = grpc_json_parse_string(json_str);
- ValidateChannelTraceData(parsed_json, expected_num_event_logged,
- GPR_MIN(expected_num_event_logged, max_nodes));
+ ValidateChannelTraceData(parsed_json, num_events_logged, num_events_expected);
grpc_json_destroy(parsed_json);
gpr_free(json_str);
}
+void ValidateChannelTrace(ChannelTrace* tracer, size_t num_events_logged) {
+ ValidateChannelTraceCustom(tracer, num_events_logged, num_events_logged);
+}
+
class ChannelFixture {
public:
- ChannelFixture(int max_trace_nodes) {
- grpc_arg client_a;
- client_a.type = GRPC_ARG_INTEGER;
- client_a.key =
- const_cast<char*>(GRPC_ARG_MAX_CHANNEL_TRACE_EVENTS_PER_NODE);
- client_a.value.integer = max_trace_nodes;
+ ChannelFixture(int max_tracer_event_memory) {
+ grpc_arg client_a = grpc_channel_arg_integer_create(
+ const_cast<char*>(GRPC_ARG_MAX_CHANNEL_TRACE_EVENT_MEMORY_PER_NODE),
+ max_tracer_event_memory);
grpc_channel_args client_args = {1, &client_a};
channel_ =
grpc_insecure_channel_create("fake_target", &client_args, nullptr);
@@ -132,67 +140,67 @@ class ChannelFixture {
} // anonymous namespace
-class ChannelTracerTest : public ::testing::TestWithParam<size_t> {};
+const int kEventListMemoryLimit = 1024 * 1024;
// Tests basic ChannelTrace functionality like construction, adding trace, and
// lookups by uuid.
-TEST_P(ChannelTracerTest, BasicTest) {
+TEST(ChannelTracerTest, BasicTest) {
grpc_core::ExecCtx exec_ctx;
- ChannelTrace tracer(GetParam());
+ ChannelTrace tracer(kEventListMemoryLimit);
AddSimpleTrace(&tracer);
AddSimpleTrace(&tracer);
tracer.AddTraceEvent(ChannelTrace::Severity::Info,
grpc_slice_from_static_string("trace three"));
tracer.AddTraceEvent(ChannelTrace::Severity::Error,
grpc_slice_from_static_string("trace four error"));
- ValidateChannelTrace(&tracer, 4, GetParam());
+ ValidateChannelTrace(&tracer, 4);
AddSimpleTrace(&tracer);
AddSimpleTrace(&tracer);
- ValidateChannelTrace(&tracer, 6, GetParam());
+ ValidateChannelTrace(&tracer, 6);
AddSimpleTrace(&tracer);
AddSimpleTrace(&tracer);
AddSimpleTrace(&tracer);
AddSimpleTrace(&tracer);
- ValidateChannelTrace(&tracer, 10, GetParam());
+ ValidateChannelTrace(&tracer, 10);
}
// Tests more complex functionality, like a parent channel tracking
// subchannles. This exercises the ref/unref patterns since the parent tracer
// and this function will both hold refs to the subchannel.
-TEST_P(ChannelTracerTest, ComplexTest) {
+TEST(ChannelTracerTest, ComplexTest) {
grpc_core::ExecCtx exec_ctx;
- ChannelTrace tracer(GetParam());
+ ChannelTrace tracer(kEventListMemoryLimit);
AddSimpleTrace(&tracer);
AddSimpleTrace(&tracer);
- ChannelFixture channel1(GetParam());
- RefCountedPtr<ChannelNode> sc1 =
- MakeRefCounted<ChannelNode>(channel1.channel(), GetParam(), true);
+ ChannelFixture channel1(kEventListMemoryLimit);
+ RefCountedPtr<ChannelNode> sc1 = MakeRefCounted<ChannelNode>(
+ channel1.channel(), kEventListMemoryLimit, true);
ChannelNodePeer sc1_peer(sc1.get());
tracer.AddTraceEventWithReference(
ChannelTrace::Severity::Info,
grpc_slice_from_static_string("subchannel one created"), sc1);
- ValidateChannelTrace(&tracer, 3, GetParam());
+ ValidateChannelTrace(&tracer, 3);
AddSimpleTrace(sc1_peer.trace());
AddSimpleTrace(sc1_peer.trace());
AddSimpleTrace(sc1_peer.trace());
- ValidateChannelTrace(sc1_peer.trace(), 3, GetParam());
+ ValidateChannelTrace(sc1_peer.trace(), 3);
AddSimpleTrace(sc1_peer.trace());
AddSimpleTrace(sc1_peer.trace());
AddSimpleTrace(sc1_peer.trace());
- ValidateChannelTrace(sc1_peer.trace(), 6, GetParam());
+ ValidateChannelTrace(sc1_peer.trace(), 6);
AddSimpleTrace(&tracer);
AddSimpleTrace(&tracer);
- ValidateChannelTrace(&tracer, 5, GetParam());
- ChannelFixture channel2(GetParam());
- RefCountedPtr<ChannelNode> sc2 =
- MakeRefCounted<ChannelNode>(channel2.channel(), GetParam(), true);
+ ValidateChannelTrace(&tracer, 5);
+ ChannelFixture channel2(kEventListMemoryLimit);
+ RefCountedPtr<ChannelNode> sc2 = MakeRefCounted<ChannelNode>(
+ channel2.channel(), kEventListMemoryLimit, true);
tracer.AddTraceEventWithReference(
ChannelTrace::Severity::Info,
grpc_slice_from_static_string("LB channel two created"), sc2);
tracer.AddTraceEventWithReference(
ChannelTrace::Severity::Warning,
grpc_slice_from_static_string("subchannel one inactive"), sc1);
- ValidateChannelTrace(&tracer, 7, GetParam());
+ ValidateChannelTrace(&tracer, 7);
AddSimpleTrace(&tracer);
AddSimpleTrace(&tracer);
AddSimpleTrace(&tracer);
@@ -206,38 +214,38 @@ TEST_P(ChannelTracerTest, ComplexTest) {
// Test a case in which the parent channel has subchannels and the subchannels
// have connections. Ensures that everything lives as long as it should then
// gets deleted.
-TEST_P(ChannelTracerTest, TestNesting) {
+TEST(ChannelTracerTest, TestNesting) {
grpc_core::ExecCtx exec_ctx;
- ChannelTrace tracer(GetParam());
+ ChannelTrace tracer(kEventListMemoryLimit);
AddSimpleTrace(&tracer);
AddSimpleTrace(&tracer);
- ValidateChannelTrace(&tracer, 2, GetParam());
- ChannelFixture channel1(GetParam());
- RefCountedPtr<ChannelNode> sc1 =
- MakeRefCounted<ChannelNode>(channel1.channel(), GetParam(), true);
+ ValidateChannelTrace(&tracer, 2);
+ ChannelFixture channel1(kEventListMemoryLimit);
+ RefCountedPtr<ChannelNode> sc1 = MakeRefCounted<ChannelNode>(
+ channel1.channel(), kEventListMemoryLimit, true);
ChannelNodePeer sc1_peer(sc1.get());
tracer.AddTraceEventWithReference(
ChannelTrace::Severity::Info,
grpc_slice_from_static_string("subchannel one created"), sc1);
- ValidateChannelTrace(&tracer, 3, GetParam());
+ ValidateChannelTrace(&tracer, 3);
AddSimpleTrace(sc1_peer.trace());
- ChannelFixture channel2(GetParam());
- RefCountedPtr<ChannelNode> conn1 =
- MakeRefCounted<ChannelNode>(channel2.channel(), GetParam(), true);
+ ChannelFixture channel2(kEventListMemoryLimit);
+ RefCountedPtr<ChannelNode> conn1 = MakeRefCounted<ChannelNode>(
+ channel2.channel(), kEventListMemoryLimit, true);
ChannelNodePeer conn1_peer(conn1.get());
// nesting one level deeper.
sc1_peer.trace()->AddTraceEventWithReference(
ChannelTrace::Severity::Info,
grpc_slice_from_static_string("connection one created"), conn1);
- ValidateChannelTrace(&tracer, 3, GetParam());
+ ValidateChannelTrace(&tracer, 3);
AddSimpleTrace(conn1_peer.trace());
AddSimpleTrace(&tracer);
AddSimpleTrace(&tracer);
- ValidateChannelTrace(&tracer, 5, GetParam());
- ValidateChannelTrace(conn1_peer.trace(), 1, GetParam());
- ChannelFixture channel3(GetParam());
- RefCountedPtr<ChannelNode> sc2 =
- MakeRefCounted<ChannelNode>(channel3.channel(), GetParam(), true);
+ ValidateChannelTrace(&tracer, 5);
+ ValidateChannelTrace(conn1_peer.trace(), 1);
+ ChannelFixture channel3(kEventListMemoryLimit);
+ RefCountedPtr<ChannelNode> sc2 = MakeRefCounted<ChannelNode>(
+ channel3.channel(), kEventListMemoryLimit, true);
tracer.AddTraceEventWithReference(
ChannelTrace::Severity::Info,
grpc_slice_from_static_string("subchannel two created"), sc2);
@@ -247,14 +255,87 @@ TEST_P(ChannelTracerTest, TestNesting) {
ChannelTrace::Severity::Warning,
grpc_slice_from_static_string("subchannel one inactive"), sc1);
AddSimpleTrace(&tracer);
- ValidateChannelTrace(&tracer, 8, GetParam());
+ ValidateChannelTrace(&tracer, 8);
sc1.reset();
sc2.reset();
conn1.reset();
}
-INSTANTIATE_TEST_CASE_P(ChannelTracerTestSweep, ChannelTracerTest,
- ::testing::Values(0, 1, 2, 6, 10, 15));
+TEST(ChannelTracerTest, TestSmallMemoryLimit) {
+ grpc_core::ExecCtx exec_ctx;
+ // doesn't make sense, but serves a testing purpose for the channel tracing
+ // bookkeeping. All tracing events added should will get immediately garbage
+ // collected.
+ const int kSmallMemoryLimit = 1;
+ ChannelTrace tracer(kSmallMemoryLimit);
+ AddSimpleTrace(&tracer);
+ AddSimpleTrace(&tracer);
+ tracer.AddTraceEvent(ChannelTrace::Severity::Info,
+ grpc_slice_from_static_string("trace three"));
+ tracer.AddTraceEvent(ChannelTrace::Severity::Error,
+ grpc_slice_from_static_string("trace four error"));
+ ValidateChannelTraceCustom(&tracer, 4, 0);
+ AddSimpleTrace(&tracer);
+ AddSimpleTrace(&tracer);
+ ValidateChannelTraceCustom(&tracer, 6, 0);
+ AddSimpleTrace(&tracer);
+ AddSimpleTrace(&tracer);
+ AddSimpleTrace(&tracer);
+ AddSimpleTrace(&tracer);
+ ValidateChannelTraceCustom(&tracer, 10, 0);
+}
+
+TEST(ChannelTracerTest, TestEviction) {
+ grpc_core::ExecCtx exec_ctx;
+ const int kTraceEventSize = GetSizeofTraceEvent();
+ const int kNumEvents = 5;
+ ChannelTrace tracer(kTraceEventSize * kNumEvents);
+ for (int i = 1; i <= kNumEvents; ++i) {
+ AddSimpleTrace(&tracer);
+ ValidateChannelTrace(&tracer, i);
+ }
+ // at this point the list is full, and each subsequent enntry will cause an
+ // eviction.
+ for (int i = 1; i <= kNumEvents; ++i) {
+ AddSimpleTrace(&tracer);
+ ValidateChannelTraceCustom(&tracer, kNumEvents + i, kNumEvents);
+ }
+}
+
+TEST(ChannelTracerTest, TestMultipleEviction) {
+ grpc_core::ExecCtx exec_ctx;
+ const int kTraceEventSize = GetSizeofTraceEvent();
+ const int kNumEvents = 5;
+ ChannelTrace tracer(kTraceEventSize * kNumEvents);
+ for (int i = 1; i <= kNumEvents; ++i) {
+ AddSimpleTrace(&tracer);
+ ValidateChannelTrace(&tracer, i);
+ }
+ // at this point the list is full, and each subsequent enntry will cause an
+ // eviction. We will now add in a trace event that has a copied string. This
+ // uses more memory, so it will cause a double eviciction
+ tracer.AddTraceEvent(
+ ChannelTrace::Severity::Info,
+ grpc_slice_from_copied_string(
+ "long enough string to trigger a multiple eviction"));
+ ValidateChannelTraceCustom(&tracer, kNumEvents + 1, kNumEvents - 1);
+}
+
+TEST(ChannelTracerTest, TestTotalEviction) {
+ grpc_core::ExecCtx exec_ctx;
+ const int kTraceEventSize = GetSizeofTraceEvent();
+ const int kNumEvents = 5;
+ ChannelTrace tracer(kTraceEventSize * kNumEvents);
+ for (int i = 1; i <= kNumEvents; ++i) {
+ AddSimpleTrace(&tracer);
+ ValidateChannelTrace(&tracer, i);
+ }
+ // at this point the list is full. Now we add such a big slice that
+ // everything gets evicted.
+ grpc_slice huge_slice = grpc_slice_malloc(kTraceEventSize * (kNumEvents + 1));
+ tracer.AddTraceEvent(ChannelTrace::Severity::Info, huge_slice);
+ ValidateChannelTraceCustom(&tracer, kNumEvents + 1, 0);
+}
} // namespace testing
} // namespace channelz
diff --git a/test/core/channel/channelz_test.cc b/test/core/channel/channelz_test.cc
index bcda30d9f2..aed1fba47c 100644
--- a/test/core/channel/channelz_test.cc
+++ b/test/core/channel/channelz_test.cc
@@ -49,8 +49,9 @@ class CallCountingHelperPeer {
public:
explicit CallCountingHelperPeer(CallCountingHelper* node) : node_(node) {}
grpc_millis last_call_started_millis() const {
- return (grpc_millis)gpr_atm_no_barrier_load(
- &node_->last_call_started_millis_);
+ CallCountingHelper::CounterData data;
+ node_->CollectData(&data);
+ return (grpc_millis)gpr_atm_no_barrier_load(&data.last_call_started_millis);
}
private:
@@ -124,11 +125,11 @@ void ValidateGetServers(size_t expected_servers) {
class ChannelFixture {
public:
- ChannelFixture(int max_trace_nodes = 0) {
+ ChannelFixture(int max_tracer_event_memory = 0) {
grpc_arg client_a[2];
client_a[0] = grpc_channel_arg_integer_create(
- const_cast<char*>(GRPC_ARG_MAX_CHANNEL_TRACE_EVENTS_PER_NODE),
- max_trace_nodes);
+ const_cast<char*>(GRPC_ARG_MAX_CHANNEL_TRACE_EVENT_MEMORY_PER_NODE),
+ max_tracer_event_memory);
client_a[1] = grpc_channel_arg_integer_create(
const_cast<char*>(GRPC_ARG_ENABLE_CHANNELZ), true);
grpc_channel_args client_args = {GPR_ARRAY_SIZE(client_a), client_a};
@@ -146,11 +147,11 @@ class ChannelFixture {
class ServerFixture {
public:
- explicit ServerFixture(int max_trace_nodes = 0) {
+ explicit ServerFixture(int max_tracer_event_memory = 0) {
grpc_arg server_a[] = {
grpc_channel_arg_integer_create(
- const_cast<char*>(GRPC_ARG_MAX_CHANNEL_TRACE_EVENTS_PER_NODE),
- max_trace_nodes),
+ const_cast<char*>(GRPC_ARG_MAX_CHANNEL_TRACE_EVENT_MEMORY_PER_NODE),
+ max_tracer_event_memory),
grpc_channel_arg_integer_create(
const_cast<char*>(GRPC_ARG_ENABLE_CHANNELZ), true),
};
@@ -360,10 +361,10 @@ TEST(ChannelzGetServersTest, ManyServersTest) {
}
INSTANTIATE_TEST_CASE_P(ChannelzChannelTestSweep, ChannelzChannelTest,
- ::testing::Values(0, 1, 2, 6, 10, 15));
+ ::testing::Values(0, 8, 64, 1024, 1024 * 1024));
INSTANTIATE_TEST_CASE_P(ChannelzServerTestSweep, ChannelzServerTest,
- ::testing::Values(0, 1, 2, 6, 10, 15));
+ ::testing::Values(0, 8, 64, 1024, 1024 * 1024));
} // namespace testing
} // namespace channelz
diff --git a/test/core/end2end/tests/channelz.cc b/test/core/end2end/tests/channelz.cc
index 2711d87f17..41549190e3 100644
--- a/test/core/end2end/tests/channelz.cc
+++ b/test/core/end2end/tests/channelz.cc
@@ -199,10 +199,8 @@ static void run_one_request(grpc_end2end_test_config config,
static void test_channelz(grpc_end2end_test_config config) {
grpc_end2end_test_fixture f;
- grpc_arg arg;
- arg.type = GRPC_ARG_INTEGER;
- arg.key = const_cast<char*>(GRPC_ARG_ENABLE_CHANNELZ);
- arg.value.integer = true;
+ grpc_arg arg = grpc_channel_arg_integer_create(
+ const_cast<char*>(GRPC_ARG_ENABLE_CHANNELZ), true);
grpc_channel_args args = {1, &arg};
f = begin_test(config, "test_channelz", &args, &args);
@@ -270,12 +268,11 @@ static void test_channelz_with_channel_trace(grpc_end2end_test_config config) {
grpc_end2end_test_fixture f;
grpc_arg arg[2];
- arg[0].type = GRPC_ARG_INTEGER;
- arg[0].key = const_cast<char*>(GRPC_ARG_MAX_CHANNEL_TRACE_EVENTS_PER_NODE);
- arg[0].value.integer = 5;
- arg[1].type = GRPC_ARG_INTEGER;
- arg[1].key = const_cast<char*>(GRPC_ARG_ENABLE_CHANNELZ);
- arg[1].value.integer = true;
+ arg[0] = grpc_channel_arg_integer_create(
+ const_cast<char*>(GRPC_ARG_MAX_CHANNEL_TRACE_EVENT_MEMORY_PER_NODE),
+ 1024 * 1024);
+ arg[1] = grpc_channel_arg_integer_create(
+ const_cast<char*>(GRPC_ARG_ENABLE_CHANNELZ), true);
grpc_channel_args args = {GPR_ARRAY_SIZE(arg), arg};
f = begin_test(config, "test_channelz_with_channel_trace", &args, &args);
diff --git a/test/core/handshake/readahead_handshaker_server_ssl.cc b/test/core/handshake/readahead_handshaker_server_ssl.cc
index 14d96b5d89..97e9c20ee4 100644
--- a/test/core/handshake/readahead_handshaker_server_ssl.cc
+++ b/test/core/handshake/readahead_handshaker_server_ssl.cc
@@ -75,7 +75,6 @@ static grpc_handshaker* readahead_handshaker_create() {
static void readahead_handshaker_factory_add_handshakers(
grpc_handshaker_factory* hf, const grpc_channel_args* args,
- grpc_pollset_set* interested_parties,
grpc_handshake_manager* handshake_mgr) {
grpc_handshake_manager_add(handshake_mgr, readahead_handshaker_create());
}
diff --git a/test/core/tsi/alts/handshaker/alts_tsi_handshaker_test.cc b/test/core/tsi/alts/handshaker/alts_tsi_handshaker_test.cc
index e9eb7e175f..85a58114ba 100644
--- a/test/core/tsi/alts/handshaker/alts_tsi_handshaker_test.cc
+++ b/test/core/tsi/alts/handshaker/alts_tsi_handshaker_test.cc
@@ -421,7 +421,7 @@ static tsi_handshaker* create_test_handshaker(bool used_for_success_test,
alts_mock_handshaker_client_create(used_for_success_test);
grpc_alts_credentials_options* options =
grpc_alts_credentials_client_options_create();
- alts_tsi_handshaker_create(options, "target_name", "lame", is_client, nullptr,
+ alts_tsi_handshaker_create(options, "target_name", "lame", is_client,
&handshaker);
alts_tsi_handshaker* alts_handshaker =
reinterpret_cast<alts_tsi_handshaker*>(handshaker);
diff --git a/test/cpp/end2end/channelz_service_test.cc b/test/cpp/end2end/channelz_service_test.cc
index a597fd9c4b..df9e23d50c 100644
--- a/test/cpp/end2end/channelz_service_test.cc
+++ b/test/cpp/end2end/channelz_service_test.cc
@@ -115,8 +115,8 @@ class ChannelzServerTest : public ::testing::Test {
InsecureServerCredentials());
// forces channelz and channel tracing to be enabled.
proxy_builder.AddChannelArgument(GRPC_ARG_ENABLE_CHANNELZ, 1);
- proxy_builder.AddChannelArgument(GRPC_ARG_MAX_CHANNEL_TRACE_EVENTS_PER_NODE,
- 10);
+ proxy_builder.AddChannelArgument(
+ GRPC_ARG_MAX_CHANNEL_TRACE_EVENT_MEMORY_PER_NODE, 1024);
proxy_builder.RegisterService(&proxy_service_);
proxy_server_ = proxy_builder.BuildAndStart();
}
@@ -142,7 +142,7 @@ class ChannelzServerTest : public ::testing::Test {
// are the ones that our test will actually be validating.
ChannelArguments args;
args.SetInt(GRPC_ARG_ENABLE_CHANNELZ, 1);
- args.SetInt(GRPC_ARG_MAX_CHANNEL_TRACE_EVENTS_PER_NODE, 10);
+ args.SetInt(GRPC_ARG_MAX_CHANNEL_TRACE_EVENT_MEMORY_PER_NODE, 1024);
std::shared_ptr<Channel> channel_to_backend = CreateCustomChannel(
backend_server_address, InsecureChannelCredentials(), args);
proxy_service_.AddChannelToBackend(channel_to_backend);