diff options
-rw-r--r-- | include/grpc/impl/codegen/grpc_types.h | 3 | ||||
-rw-r--r-- | src/core/ext/census/grpc_plugin.c | 2 | ||||
-rw-r--r-- | src/core/lib/channel/channel_args.c | 7 | ||||
-rw-r--r-- | src/core/lib/channel/channel_args.h | 2 |
4 files changed, 13 insertions, 1 deletions
diff --git a/include/grpc/impl/codegen/grpc_types.h b/include/grpc/impl/codegen/grpc_types.h index aa4210b1a7..5beac83a3b 100644 --- a/include/grpc/impl/codegen/grpc_types.h +++ b/include/grpc/impl/codegen/grpc_types.h @@ -152,6 +152,9 @@ typedef struct { #define GRPC_ARG_ENABLE_CENSUS "grpc.census" /** If non-zero, enable load reporting. */ #define GRPC_ARG_ENABLE_LOAD_REPORTING "grpc.loadreporting" +/** Request that optional features default to off (regardless of what they + usually default to) - to enable tight control over what gets enabled */ +#define GRPC_ARG_MINIMAL_STACK "grpc.minimal_stack" /** Maximum number of concurrent incoming streams to allow on a http2 connection. Int valued. */ #define GRPC_ARG_MAX_CONCURRENT_STREAMS "grpc.max_concurrent_streams" diff --git a/src/core/ext/census/grpc_plugin.c b/src/core/ext/census/grpc_plugin.c index c9fe453af8..28d266e22a 100644 --- a/src/core/ext/census/grpc_plugin.c +++ b/src/core/ext/census/grpc_plugin.c @@ -48,7 +48,7 @@ static bool is_census_enabled(const grpc_channel_args *a) { return a->args[i].value.integer != 0 && census_enabled(); } } - return census_enabled(); + return census_enabled() && !grpc_channel_args_want_minimal_stack(a); } static bool maybe_add_census_filter(grpc_exec_ctx *exec_ctx, diff --git a/src/core/lib/channel/channel_args.c b/src/core/lib/channel/channel_args.c index 1a099ac437..a6d124c719 100644 --- a/src/core/lib/channel/channel_args.c +++ b/src/core/lib/channel/channel_args.c @@ -346,3 +346,10 @@ int grpc_channel_arg_get_integer(grpc_arg *arg, grpc_integer_options options) { } return arg->value.integer; } + +bool grpc_channel_args_want_minimal_stack(const grpc_channel_args *args) { + const grpc_arg *arg = grpc_channel_args_find(args, GRPC_ARG_MINIMAL_STACK); + if (arg == NULL) return false; + if (arg->type == GRPC_ARG_INTEGER && arg->value.integer == 0) return false; + return true; +} diff --git a/src/core/lib/channel/channel_args.h b/src/core/lib/channel/channel_args.h index 5c7d31f8bb..158cda5b21 100644 --- a/src/core/lib/channel/channel_args.h +++ b/src/core/lib/channel/channel_args.h @@ -113,6 +113,8 @@ grpc_channel_args *grpc_channel_args_set_socket_mutator( const grpc_arg *grpc_channel_args_find(const grpc_channel_args *args, const char *name); +bool grpc_channel_args_want_minimal_stack(const grpc_channel_args *args); + typedef struct grpc_integer_options { int default_value; // Return this if value is outside of expected bounds. int min_value; |