aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2015-12-10 10:59:38 -0800
committerGravatar Craig Tiller <ctiller@google.com>2015-12-10 10:59:38 -0800
commit5a95c34416e549e83c3d068d4ac4bb018aed1183 (patch)
tree10067eb473af657908cf68971ba05919114b4ab1 /src
parentc586f4e9be9209324dc4c3828e1309566456caa5 (diff)
Actually run census code on the server
Diffstat (limited to 'src')
-rw-r--r--src/core/census/grpc_filter.c4
-rw-r--r--src/core/surface/server_create.c13
2 files changed, 12 insertions, 5 deletions
diff --git a/src/core/census/grpc_filter.c b/src/core/census/grpc_filter.c
index 8f18cd503e..76b7257378 100644
--- a/src/core/census/grpc_filter.c
+++ b/src/core/census/grpc_filter.c
@@ -115,8 +115,8 @@ static void server_mutate_op(grpc_call_element *elem,
static void server_start_transport_op(grpc_exec_ctx *exec_ctx,
grpc_call_element *elem,
grpc_transport_stream_op *op) {
- call_data *calld = elem->call_data;
- GPR_ASSERT((calld->op_id.upper != 0) || (calld->op_id.lower != 0));
+ /* call_data *calld = elem->call_data;
+ GPR_ASSERT((calld->op_id.upper != 0) || (calld->op_id.lower != 0)); */
server_mutate_op(elem, op);
grpc_call_next_op(exec_ctx, elem, op);
}
diff --git a/src/core/surface/server_create.c b/src/core/surface/server_create.c
index c7811a6d88..e362bb4376 100644
--- a/src/core/surface/server_create.c
+++ b/src/core/surface/server_create.c
@@ -32,14 +32,21 @@
*/
#include <grpc/grpc.h>
+#include "src/core/census/grpc_filter.h"
+#include "src/core/channel/channel_args.h"
+#include "src/core/channel/compress_filter.h"
#include "src/core/surface/api_trace.h"
#include "src/core/surface/completion_queue.h"
#include "src/core/surface/server.h"
-#include "src/core/channel/compress_filter.h"
grpc_server *grpc_server_create(const grpc_channel_args *args, void *reserved) {
- const grpc_channel_filter *filters[] = {&grpc_compress_filter};
+ const grpc_channel_filter *filters[3];
+ size_t num_filters = 0;
+ filters[num_filters++] = &grpc_compress_filter;
+ if (grpc_channel_args_is_census_enabled(args)) {
+ filters[num_filters++] = &grpc_server_census_filter;
+ }
GRPC_API_TRACE("grpc_server_create(%p, %p)", 2, (args, reserved));
- return grpc_server_create_from_filters(filters, GPR_ARRAY_SIZE(filters),
+ return grpc_server_create_from_filters(filters, num_filters,
args);
}