aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/core/lib/channel/channelz.h4
-rw-r--r--test/core/channel/channelz_test.cc9
-rw-r--r--test/core/end2end/tests/channelz.cc16
3 files changed, 23 insertions, 6 deletions
diff --git a/src/core/lib/channel/channelz.h b/src/core/lib/channel/channelz.h
index fddef793fb..88551befc8 100644
--- a/src/core/lib/channel/channelz.h
+++ b/src/core/lib/channel/channelz.h
@@ -42,13 +42,13 @@
/** This is the default value for whether or not to enable channelz. If
* GRPC_ARG_ENABLE_CHANNELZ is set, it will override this default value. */
-#define GRPC_ENABLE_CHANNELZ_DEFAULT false
+#define GRPC_ENABLE_CHANNELZ_DEFAULT true
/** 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
+#define GRPC_MAX_CHANNEL_TRACE_EVENT_MEMORY_PER_NODE_DEFAULT 1024 * 4
namespace grpc_core {
diff --git a/test/core/channel/channelz_test.cc b/test/core/channel/channelz_test.cc
index aed1fba47c..b7cdde581a 100644
--- a/test/core/channel/channelz_test.cc
+++ b/test/core/channel/channelz_test.cc
@@ -238,8 +238,15 @@ TEST_P(ChannelzChannelTest, BasicChannel) {
TEST(ChannelzChannelTest, ChannelzDisabled) {
grpc_core::ExecCtx exec_ctx;
+ // explicitly disable channelz
+ grpc_arg arg[2];
+ arg[0] = grpc_channel_arg_integer_create(
+ const_cast<char*>(GRPC_ARG_MAX_CHANNEL_TRACE_EVENT_MEMORY_PER_NODE), 0);
+ arg[1] = grpc_channel_arg_integer_create(
+ const_cast<char*>(GRPC_ARG_ENABLE_CHANNELZ), false);
+ grpc_channel_args args = {GPR_ARRAY_SIZE(arg), arg};
grpc_channel* channel =
- grpc_insecure_channel_create("fake_target", nullptr, nullptr);
+ grpc_insecure_channel_create("fake_target", &args, nullptr);
ChannelNode* channelz_channel = grpc_channel_get_channelz_node(channel);
ASSERT_EQ(channelz_channel, nullptr);
grpc_channel_destroy(channel);
diff --git a/test/core/end2end/tests/channelz.cc b/test/core/end2end/tests/channelz.cc
index 41549190e3..da8a8eca42 100644
--- a/test/core/end2end/tests/channelz.cc
+++ b/test/core/end2end/tests/channelz.cc
@@ -199,9 +199,12 @@ 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 = grpc_channel_arg_integer_create(
+ grpc_arg arg[2];
+ arg[0] = grpc_channel_arg_integer_create(
+ const_cast<char*>(GRPC_ARG_MAX_CHANNEL_TRACE_EVENT_MEMORY_PER_NODE), 0);
+ arg[1] = grpc_channel_arg_integer_create(
const_cast<char*>(GRPC_ARG_ENABLE_CHANNELZ), true);
- grpc_channel_args args = {1, &arg};
+ grpc_channel_args args = {GPR_ARRAY_SIZE(arg), arg};
f = begin_test(config, "test_channelz", &args, &args);
grpc_core::channelz::ChannelNode* channelz_channel =
@@ -307,7 +310,14 @@ static void test_channelz_with_channel_trace(grpc_end2end_test_config config) {
static void test_channelz_disabled(grpc_end2end_test_config config) {
grpc_end2end_test_fixture f;
- f = begin_test(config, "test_channelz_disabled", nullptr, nullptr);
+ grpc_arg arg[2];
+ arg[0] = grpc_channel_arg_integer_create(
+ const_cast<char*>(GRPC_ARG_MAX_CHANNEL_TRACE_EVENT_MEMORY_PER_NODE), 0);
+ arg[1] = grpc_channel_arg_integer_create(
+ const_cast<char*>(GRPC_ARG_ENABLE_CHANNELZ), false);
+ grpc_channel_args args = {GPR_ARRAY_SIZE(arg), arg};
+
+ f = begin_test(config, "test_channelz_disabled", &args, &args);
grpc_core::channelz::ChannelNode* channelz_channel =
grpc_channel_get_channelz_node(f.client);
GPR_ASSERT(channelz_channel == nullptr);