aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/surface/channel.c
diff options
context:
space:
mode:
authorGravatar Hongyu Chen <hongyu@google.com>2015-12-02 22:24:33 -0800
committerGravatar Hongyu Chen <hongyu@google.com>2015-12-02 22:24:33 -0800
commit1f9604818799b7f6e15710f016ee4e62800d7158 (patch)
treedf49b8979e6c388f13e72870a3a846b7ec50b2dc /src/core/surface/channel.c
parent6f9b17184246ccd29e1a5b0271058c3ccfd63887 (diff)
Census tags propagation.
Diffstat (limited to 'src/core/surface/channel.c')
-rw-r--r--src/core/surface/channel.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/core/surface/channel.c b/src/core/surface/channel.c
index 859197412b..fae66e2694 100644
--- a/src/core/surface/channel.c
+++ b/src/core/surface/channel.c
@@ -40,6 +40,7 @@
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
+#include "src/core/census/context.h"
#include "src/core/client_config/resolver_registry.h"
#include "src/core/iomgr/iomgr.h"
#include "src/core/support/string.h"
@@ -167,7 +168,7 @@ static grpc_call *grpc_channel_create_call_internal(
grpc_channel *channel, grpc_call *parent_call, gpr_uint32 propagation_mask,
grpc_completion_queue *cq, grpc_mdelem *path_mdelem,
grpc_mdelem *authority_mdelem, gpr_timespec deadline) {
- grpc_mdelem *send_metadata[2];
+ grpc_mdelem *send_metadata[3];
size_t num_metadata = 0;
GPR_ASSERT(channel->is_client);
@@ -179,6 +180,16 @@ static grpc_call *grpc_channel_create_call_internal(
send_metadata[num_metadata++] = GRPC_MDELEM_REF(channel->default_authority);
}
+ if (propagation_mask & GRPC_PROPAGATE_CENSUS_TRACING_CONTEXT) {
+ char buf[GRPC_CENSUS_MAX_ON_THE_WIRE_TAG_BYTES];
+ size_t len = census_context_serialize(
+ census_context_current(), buf, GRPC_CENSUS_MAX_ON_THE_WIRE_TAG_BYTES);
+ if (len > 0) {
+ grpc_mdelem *census_mdelem = grpc_mdelem_from_metadata_strings(
+ GRPC_MDSTR_CENSUS, grpc_mdstr_from_buffer((gpr_uint8 *)buf, len));
+ send_metadata[num_metadata++] = census_mdelem;
+ }
+ }
return grpc_call_create(channel, parent_call, propagation_mask, cq, NULL,
send_metadata, num_metadata, deadline);
}