Merge remote-tracking branch 'upstream/master' into bug
diff --git a/src/core/surface/channel_create.c b/src/core/surface/channel_create.c
index 49083f08..b21f89d 100644
--- a/src/core/surface/channel_create.c
+++ b/src/core/surface/channel_create.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -36,6 +36,7 @@
#include <stdlib.h>
#include <string.h>
+#include <grpc/census.h>
#include <grpc/support/alloc.h>
#include <grpc/support/slice.h>
#include <grpc/support/slice_buffer.h>
@@ -200,7 +201,7 @@
"grpc_insecure_channel_create(target=%p, args=%p, reserved=%p)", 3,
(target, args, reserved));
GPR_ASSERT(!reserved);
- if (grpc_channel_args_is_census_enabled(args)) {
+ if (grpc_channel_args_is_census_enabled(args) || census_enabled()) {
filters[n++] = &grpc_client_census_filter;
}
filters[n++] = &grpc_compress_filter;
diff --git a/src/core/surface/secure_channel_create.c b/src/core/surface/secure_channel_create.c
index 552a570..506f5bb 100644
--- a/src/core/surface/secure_channel_create.c
+++ b/src/core/surface/secure_channel_create.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -36,6 +36,7 @@
#include <stdlib.h>
#include <string.h>
+#include <grpc/census.h>
#include <grpc/support/alloc.h>
#include <grpc/support/slice.h>
#include <grpc/support/slice_buffer.h>
@@ -295,7 +296,7 @@
args_copy = grpc_channel_args_copy_and_add(
new_args_from_connector != NULL ? new_args_from_connector : args,
&connector_arg, 1);
- if (grpc_channel_args_is_census_enabled(args)) {
+ if (grpc_channel_args_is_census_enabled(args) || census_enabled()) {
filters[n++] = &grpc_client_census_filter;
}
filters[n++] = &grpc_compress_filter;
diff --git a/src/core/surface/server.c b/src/core/surface/server.c
index 79db138..0802965 100644
--- a/src/core/surface/server.c
+++ b/src/core/surface/server.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -37,6 +37,7 @@
#include <stdlib.h>
#include <string.h>
+#include <grpc/census.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
@@ -779,9 +780,8 @@
const grpc_channel_filter **filters, size_t filter_count,
const grpc_channel_args *args) {
size_t i;
- /* TODO(census): restore this once we finalize census filter etc.
- int census_enabled = grpc_channel_args_is_census_enabled(args); */
- int census_enabled = 0;
+ int enable_census =
+ grpc_channel_args_is_census_enabled(args) || census_enabled();
grpc_server *server = gpr_malloc(sizeof(grpc_server));
@@ -815,15 +815,15 @@
grpc_server_census_filter (optional) - for stats collection and tracing
{passed in filter stack}
grpc_connected_channel_filter - for interfacing with transports */
- server->channel_filter_count = filter_count + 1u + (census_enabled ? 1u : 0u);
+ server->channel_filter_count = filter_count + 1u + (enable_census ? 1u : 0u);
server->channel_filters =
gpr_malloc(server->channel_filter_count * sizeof(grpc_channel_filter *));
server->channel_filters[0] = &server_surface_filter;
- if (census_enabled) {
+ if (enable_census) {
server->channel_filters[1] = &grpc_server_census_filter;
}
for (i = 0; i < filter_count; i++) {
- server->channel_filters[i + 1u + (census_enabled ? 1u : 0u)] = filters[i];
+ server->channel_filters[i + 1u + (enable_census ? 1u : 0u)] = filters[i];
}
server->channel_args = grpc_channel_args_copy(args);
diff --git a/src/core/surface/server_create.c b/src/core/surface/server_create.c
index f30093e..5e37e80 100644
--- a/src/core/surface/server_create.c
+++ b/src/core/surface/server_create.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -43,9 +43,6 @@
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, num_filters, args);
}