From 1f9604818799b7f6e15710f016ee4e62800d7158 Mon Sep 17 00:00:00 2001 From: Hongyu Chen <hongyu@google.com> Date: Wed, 2 Dec 2015 22:24:33 -0800 Subject: [PATCH] Census tags propagation. --- include/grpc++/client_context.h | 10 -- include/grpc++/server_context.h | 3 - include/grpc/census.h | 8 + src/core/census/context.c | 4 + src/core/census/context.h | 10 +- src/core/surface/call.c | 2 +- src/core/surface/channel.c | 13 +- src/core/transport/static_metadata.c | 195 +++++++++++----------- src/core/transport/static_metadata.h | 145 ++++++++-------- src/cpp/client/channel.cc | 1 - src/cpp/server/server_context.cc | 4 - tools/codegen/core/gen_static_metadata.py | 1 + 12 files changed, 202 insertions(+), 194 deletions(-) diff --git a/include/grpc++/client_context.h b/include/grpc++/client_context.h index 5c6f432c9a..9d64715803 100644 --- a/include/grpc++/client_context.h +++ b/include/grpc++/client_context.h @@ -37,7 +37,6 @@ /// side. /// - Control call settings such as compression and authentication. /// - Initial and trailing metadata coming from the server. -/// - Get performance metrics (ie, census). /// /// Context settings are only relevant to the call they are invoked with, that /// is to say, they aren't sticky. Some of these settings, such as the @@ -64,8 +63,6 @@ #include <grpc/support/log.h> #include <grpc/support/time.h> -struct census_context; - namespace grpc { class Channel; @@ -268,12 +265,6 @@ class ClientContext { /// \return The call's peer URI. grpc::string peer() const; - /// Get and set census context - void set_census_context(struct census_context* ccp) { census_context_ = ccp; } - struct census_context* census_context() const { - return census_context_; - } - /// Send a best-effort out-of-band cancel. The call could be in any stage. /// e.g. if it is already finished, it may still return success. /// @@ -323,7 +314,6 @@ class ClientContext { grpc::string authority_; std::shared_ptr<CallCredentials> creds_; mutable std::shared_ptr<const AuthContext> auth_context_; - struct census_context* census_context_; std::multimap<grpc::string, grpc::string> send_initial_metadata_; std::multimap<grpc::string_ref, grpc::string_ref> recv_initial_metadata_; std::multimap<grpc::string_ref, grpc::string_ref> trailing_metadata_; diff --git a/include/grpc++/server_context.h b/include/grpc++/server_context.h index 85f384d477..de4af7d1c2 100644 --- a/include/grpc++/server_context.h +++ b/include/grpc++/server_context.h @@ -47,7 +47,6 @@ struct gpr_timespec; struct grpc_metadata; struct grpc_call; -struct census_context; namespace grpc { @@ -126,8 +125,6 @@ class ServerContext { // functionality. Instead, use auth_context. grpc::string peer() const; - const struct census_context* census_context() const; - // Async only. Has to be called before the rpc starts. // Returns the tag in completion queue when the rpc finishes. // IsCancelled() can then be called to check whether the rpc was cancelled. diff --git a/include/grpc/census.h b/include/grpc/census.h index d0bc90420c..2e6e19a016 100644 --- a/include/grpc/census.h +++ b/include/grpc/census.h @@ -79,6 +79,14 @@ int census_enabled(void); */ typedef struct census_context census_context; +/** + Returns the census_context of the current thread, creating one if necessary. + The object pointed to by the returned pointer is thread local, and thus may + be read without concurrency concerns, but should not be shared with other + threads. +*/ +census_context* census_context_current(); + /* This function is called by the RPC subsystem whenever it needs to get a * serialized form of the current census context (presumably to pass across * the wire). Arguments: diff --git a/src/core/census/context.c b/src/core/census/context.c index cab58b653c..441e328c63 100644 --- a/src/core/census/context.c +++ b/src/core/census/context.c @@ -39,6 +39,10 @@ /* Placeholder implementation only. */ +census_context* census_context_current(void) { + return NULL; +} + size_t census_context_serialize(const census_context *context, char *buffer, size_t buf_size) { /* TODO(aveitch): implement serialization */ diff --git a/src/core/census/context.h b/src/core/census/context.h index d9907d4da7..896b4ba6c0 100644 --- a/src/core/census/context.h +++ b/src/core/census/context.h @@ -36,14 +36,14 @@ #include <grpc/census.h> +#define GRPC_CENSUS_MAX_ON_THE_WIRE_TAG_BYTES 8 * 1024 + /* census_context is the in-memory representation of information needed to * maintain tracing, RPC statistics and resource usage information. */ struct census_context { - gpr_uint64 op_id; /* Operation identifier - unique per-context */ - gpr_uint64 trace_id; /* Globally unique trace identifier */ - /* TODO(aveitch) Add census tags: - const census_tag_set *tags; - */ + gpr_uint64 op_id; /* Operation identifier - unique per-context */ + gpr_uint64 trace_id; /* Globally unique trace identifier */ + void* tags; /* Opaque data structure for Census tags. */ }; #endif /* GRPC_INTERNAL_CORE_CENSUS_CONTEXT_H */ diff --git a/src/core/surface/call.c b/src/core/surface/call.c index 4affafa585..171538dc34 100644 --- a/src/core/surface/call.c +++ b/src/core/surface/call.c @@ -70,7 +70,7 @@ typedef struct { int success; } completed_request; -#define MAX_SEND_EXTRA_METADATA_COUNT 3 +#define MAX_SEND_EXTRA_METADATA_COUNT 4 /* Status data for a request can come from several sources; this enumerates them all, and acts as a priority sorting for which 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); } diff --git a/src/core/transport/static_metadata.c b/src/core/transport/static_metadata.c index e7aff325c2..e6a12d4f24 100644 --- a/src/core/transport/static_metadata.c +++ b/src/core/transport/static_metadata.c @@ -54,104 +54,107 @@ gpr_uintptr grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT] = { const gpr_uint8 grpc_static_metadata_elem_indices[GRPC_STATIC_MDELEM_COUNT * 2] = { - 11, 33, 10, 33, 12, 33, 12, 47, 13, 33, 14, 33, 15, 33, 16, 33, 17, 33, - 19, 33, 20, 33, 21, 33, 22, 33, 23, 33, 24, 33, 25, 33, 26, 33, 27, 33, - 28, 18, 28, 33, 29, 33, 30, 33, 34, 33, 35, 33, 36, 33, 37, 33, 40, 31, - 40, 32, 40, 46, 40, 51, 40, 52, 40, 53, 40, 54, 41, 31, 41, 46, 41, 51, - 44, 0, 44, 1, 44, 2, 48, 33, 55, 33, 56, 33, 57, 33, 58, 33, 59, 33, - 60, 33, 61, 33, 62, 33, 63, 33, 64, 38, 64, 66, 65, 76, 65, 77, 67, 33, - 68, 33, 69, 33, 70, 33, 71, 33, 72, 33, 73, 39, 73, 49, 73, 50, 74, 33, - 75, 33, 78, 3, 78, 4, 78, 5, 78, 6, 78, 7, 78, 8, 78, 9, 79, 33, - 80, 81, 82, 33, 83, 33, 84, 33, 85, 33, 86, 33}; + 11, 34, 10, 34, 12, 34, 12, 48, 13, 34, 14, 34, 15, 34, 16, 34, 17, 34, + 19, 34, 20, 34, 21, 34, 23, 34, 24, 34, 25, 34, 26, 34, 27, 34, 28, 34, + 29, 18, 29, 34, 30, 34, 31, 34, 35, 34, 36, 34, 37, 34, 38, 34, 41, 32, + 41, 33, 41, 47, 41, 52, 41, 53, 41, 54, 41, 55, 42, 32, 42, 47, 42, 52, + 45, 0, 45, 1, 45, 2, 49, 34, 56, 34, 57, 34, 58, 34, 59, 34, 60, 34, + 61, 34, 62, 34, 63, 34, 64, 34, 65, 39, 65, 67, 66, 77, 66, 78, 68, 34, + 69, 34, 70, 34, 71, 34, 72, 34, 73, 34, 74, 40, 74, 50, 74, 51, 75, 34, + 76, 34, 79, 3, 79, 4, 79, 5, 79, 6, 79, 7, 79, 8, 79, 9, 80, 34, + 81, 82, 83, 34, 84, 34, 85, 34, 86, 34, 87, 34}; const char *const grpc_static_metadata_strings[GRPC_STATIC_MDSTR_COUNT] = { - "0", - "1", - "2", - "200", - "204", - "206", - "304", - "400", - "404", - "500", - "accept", - "accept-charset", - "accept-encoding", - "accept-language", - "accept-ranges", - "access-control-allow-origin", - "age", - "allow", - "application/grpc", - ":authority", - "authorization", - "cache-control", - "content-disposition", - "content-encoding", - "content-language", - "content-length", - "content-location", - "content-range", - "content-type", - "cookie", - "date", - "deflate", - "deflate,gzip", - "", - "etag", - "expect", - "expires", - "from", - "GET", - "grpc", - "grpc-accept-encoding", - "grpc-encoding", - "grpc-internal-encoding-request", - "grpc-message", - "grpc-status", - "grpc-timeout", - "gzip", - "gzip, deflate", - "host", - "http", - "https", - "identity", - "identity,deflate", - "identity,deflate,gzip", - "identity,gzip", - "if-match", - "if-modified-since", - "if-none-match", - "if-range", - "if-unmodified-since", - "last-modified", - "link", - "location", - "max-forwards", - ":method", - ":path", - "POST", - "proxy-authenticate", - "proxy-authorization", - "range", - "referer", - "refresh", - "retry-after", - ":scheme", - "server", - "set-cookie", - "/", - "/index.html", - ":status", - "strict-transport-security", - "te", - "trailers", - "transfer-encoding", - "user-agent", - "vary", - "via", - "www-authenticate"}; + "0", + "1", + "2", + "200", + "204", + "206", + "304", + "400", + "404", + "500", + "accept", + "accept-charset", + "accept-encoding", + "accept-language", + "accept-ranges", + "access-control-allow-origin", + "age", + "allow", + "application/grpc", + ":authority", + "authorization", + "cache-control", + ":census", + "content-disposition", + "content-encoding", + "content-language", + "content-length", + "content-location", + "content-range", + "content-type", + "cookie", + "date", + "deflate", + "deflate,gzip", + "", + "etag", + "expect", + "expires", + "from", + "GET", + "grpc", + "grpc-accept-encoding", + "grpc-encoding", + "grpc-internal-encoding-request", + "grpc-message", + "grpc-status", + "grpc-timeout", + "gzip", + "gzip, deflate", + "host", + "http", + "https", + "identity", + "identity,deflate", + "identity,deflate,gzip", + "identity,gzip", + "if-match", + "if-modified-since", + "if-none-match", + "if-range", + "if-unmodified-since", + "last-modified", + "link", + "location", + "max-forwards", + ":method", + ":path", + "POST", + "proxy-authenticate", + "proxy-authorization", + "range", + "referer", + "refresh", + "retry-after", + ":scheme", + "server", + "set-cookie", + "/", + "/index.html", + ":status", + "strict-transport-security", + "te", + "trailers", + "transfer-encoding", + "user-agent", + "vary", + "via", + "www-authenticate" +}; const gpr_uint8 grpc_static_accept_encoding_metadata[8] = {0, 29, 26, 30, 28, 32, 27, 31}; + diff --git a/src/core/transport/static_metadata.h b/src/core/transport/static_metadata.h index e9055fb45c..02b6c8ca7f 100644 --- a/src/core/transport/static_metadata.h +++ b/src/core/transport/static_metadata.h @@ -31,13 +31,11 @@ /* * WARNING: Auto-generated code. - * - * To make changes to this file, change - * tools/codegen/core/gen_static_metadata.py, + * + * To make changes to this file, change tools/codegen/core/gen_static_metadata.py, * and then re-run it. - * - * See metadata.h for an explanation of the interface here, and metadata.c for - * an + * + * See metadata.h for an explanation of the interface here, and metadata.c for an * explanation of what's going on. */ @@ -46,7 +44,7 @@ #include "src/core/transport/metadata.h" -#define GRPC_STATIC_MDSTR_COUNT 87 +#define GRPC_STATIC_MDSTR_COUNT 88 extern grpc_mdstr grpc_static_mdstr_table[GRPC_STATIC_MDSTR_COUNT]; /* "0" */ #define GRPC_MDSTR_0 (&grpc_static_mdstr_table[0]) @@ -92,137 +90,138 @@ extern grpc_mdstr grpc_static_mdstr_table[GRPC_STATIC_MDSTR_COUNT]; #define GRPC_MDSTR_AUTHORIZATION (&grpc_static_mdstr_table[20]) /* "cache-control" */ #define GRPC_MDSTR_CACHE_CONTROL (&grpc_static_mdstr_table[21]) +/* ":census" */ +#define GRPC_MDSTR_CENSUS (&grpc_static_mdstr_table[22]) /* "content-disposition" */ -#define GRPC_MDSTR_CONTENT_DISPOSITION (&grpc_static_mdstr_table[22]) +#define GRPC_MDSTR_CONTENT_DISPOSITION (&grpc_static_mdstr_table[23]) /* "content-encoding" */ -#define GRPC_MDSTR_CONTENT_ENCODING (&grpc_static_mdstr_table[23]) +#define GRPC_MDSTR_CONTENT_ENCODING (&grpc_static_mdstr_table[24]) /* "content-language" */ -#define GRPC_MDSTR_CONTENT_LANGUAGE (&grpc_static_mdstr_table[24]) +#define GRPC_MDSTR_CONTENT_LANGUAGE (&grpc_static_mdstr_table[25]) /* "content-length" */ -#define GRPC_MDSTR_CONTENT_LENGTH (&grpc_static_mdstr_table[25]) +#define GRPC_MDSTR_CONTENT_LENGTH (&grpc_static_mdstr_table[26]) /* "content-location" */ -#define GRPC_MDSTR_CONTENT_LOCATION (&grpc_static_mdstr_table[26]) +#define GRPC_MDSTR_CONTENT_LOCATION (&grpc_static_mdstr_table[27]) /* "content-range" */ -#define GRPC_MDSTR_CONTENT_RANGE (&grpc_static_mdstr_table[27]) +#define GRPC_MDSTR_CONTENT_RANGE (&grpc_static_mdstr_table[28]) /* "content-type" */ -#define GRPC_MDSTR_CONTENT_TYPE (&grpc_static_mdstr_table[28]) +#define GRPC_MDSTR_CONTENT_TYPE (&grpc_static_mdstr_table[29]) /* "cookie" */ -#define GRPC_MDSTR_COOKIE (&grpc_static_mdstr_table[29]) +#define GRPC_MDSTR_COOKIE (&grpc_static_mdstr_table[30]) /* "date" */ -#define GRPC_MDSTR_DATE (&grpc_static_mdstr_table[30]) +#define GRPC_MDSTR_DATE (&grpc_static_mdstr_table[31]) /* "deflate" */ -#define GRPC_MDSTR_DEFLATE (&grpc_static_mdstr_table[31]) +#define GRPC_MDSTR_DEFLATE (&grpc_static_mdstr_table[32]) /* "deflate,gzip" */ -#define GRPC_MDSTR_DEFLATE_COMMA_GZIP (&grpc_static_mdstr_table[32]) +#define GRPC_MDSTR_DEFLATE_COMMA_GZIP (&grpc_static_mdstr_table[33]) /* "" */ -#define GRPC_MDSTR_EMPTY (&grpc_static_mdstr_table[33]) +#define GRPC_MDSTR_EMPTY (&grpc_static_mdstr_table[34]) /* "etag" */ -#define GRPC_MDSTR_ETAG (&grpc_static_mdstr_table[34]) +#define GRPC_MDSTR_ETAG (&grpc_static_mdstr_table[35]) /* "expect" */ -#define GRPC_MDSTR_EXPECT (&grpc_static_mdstr_table[35]) +#define GRPC_MDSTR_EXPECT (&grpc_static_mdstr_table[36]) /* "expires" */ -#define GRPC_MDSTR_EXPIRES (&grpc_static_mdstr_table[36]) +#define GRPC_MDSTR_EXPIRES (&grpc_static_mdstr_table[37]) /* "from" */ -#define GRPC_MDSTR_FROM (&grpc_static_mdstr_table[37]) +#define GRPC_MDSTR_FROM (&grpc_static_mdstr_table[38]) /* "GET" */ -#define GRPC_MDSTR_GET (&grpc_static_mdstr_table[38]) +#define GRPC_MDSTR_GET (&grpc_static_mdstr_table[39]) /* "grpc" */ -#define GRPC_MDSTR_GRPC (&grpc_static_mdstr_table[39]) +#define GRPC_MDSTR_GRPC (&grpc_static_mdstr_table[40]) /* "grpc-accept-encoding" */ -#define GRPC_MDSTR_GRPC_ACCEPT_ENCODING (&grpc_static_mdstr_table[40]) +#define GRPC_MDSTR_GRPC_ACCEPT_ENCODING (&grpc_static_mdstr_table[41]) /* "grpc-encoding" */ -#define GRPC_MDSTR_GRPC_ENCODING (&grpc_static_mdstr_table[41]) +#define GRPC_MDSTR_GRPC_ENCODING (&grpc_static_mdstr_table[42]) /* "grpc-internal-encoding-request" */ -#define GRPC_MDSTR_GRPC_INTERNAL_ENCODING_REQUEST (&grpc_static_mdstr_table[42]) +#define GRPC_MDSTR_GRPC_INTERNAL_ENCODING_REQUEST (&grpc_static_mdstr_table[43]) /* "grpc-message" */ -#define GRPC_MDSTR_GRPC_MESSAGE (&grpc_static_mdstr_table[43]) +#define GRPC_MDSTR_GRPC_MESSAGE (&grpc_static_mdstr_table[44]) /* "grpc-status" */ -#define GRPC_MDSTR_GRPC_STATUS (&grpc_static_mdstr_table[44]) +#define GRPC_MDSTR_GRPC_STATUS (&grpc_static_mdstr_table[45]) /* "grpc-timeout" */ -#define GRPC_MDSTR_GRPC_TIMEOUT (&grpc_static_mdstr_table[45]) +#define GRPC_MDSTR_GRPC_TIMEOUT (&grpc_static_mdstr_table[46]) /* "gzip" */ -#define GRPC_MDSTR_GZIP (&grpc_static_mdstr_table[46]) +#define GRPC_MDSTR_GZIP (&grpc_static_mdstr_table[47]) /* "gzip, deflate" */ -#define GRPC_MDSTR_GZIP_COMMA_DEFLATE (&grpc_static_mdstr_table[47]) +#define GRPC_MDSTR_GZIP_COMMA_DEFLATE (&grpc_static_mdstr_table[48]) /* "host" */ -#define GRPC_MDSTR_HOST (&grpc_static_mdstr_table[48]) +#define GRPC_MDSTR_HOST (&grpc_static_mdstr_table[49]) /* "http" */ -#define GRPC_MDSTR_HTTP (&grpc_static_mdstr_table[49]) +#define GRPC_MDSTR_HTTP (&grpc_static_mdstr_table[50]) /* "https" */ -#define GRPC_MDSTR_HTTPS (&grpc_static_mdstr_table[50]) +#define GRPC_MDSTR_HTTPS (&grpc_static_mdstr_table[51]) /* "identity" */ -#define GRPC_MDSTR_IDENTITY (&grpc_static_mdstr_table[51]) +#define GRPC_MDSTR_IDENTITY (&grpc_static_mdstr_table[52]) /* "identity,deflate" */ -#define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE (&grpc_static_mdstr_table[52]) +#define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE (&grpc_static_mdstr_table[53]) /* "identity,deflate,gzip" */ -#define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE_COMMA_GZIP \ - (&grpc_static_mdstr_table[53]) +#define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE_COMMA_GZIP (&grpc_static_mdstr_table[54]) /* "identity,gzip" */ -#define GRPC_MDSTR_IDENTITY_COMMA_GZIP (&grpc_static_mdstr_table[54]) +#define GRPC_MDSTR_IDENTITY_COMMA_GZIP (&grpc_static_mdstr_table[55]) /* "if-match" */ -#define GRPC_MDSTR_IF_MATCH (&grpc_static_mdstr_table[55]) +#define GRPC_MDSTR_IF_MATCH (&grpc_static_mdstr_table[56]) /* "if-modified-since" */ -#define GRPC_MDSTR_IF_MODIFIED_SINCE (&grpc_static_mdstr_table[56]) +#define GRPC_MDSTR_IF_MODIFIED_SINCE (&grpc_static_mdstr_table[57]) /* "if-none-match" */ -#define GRPC_MDSTR_IF_NONE_MATCH (&grpc_static_mdstr_table[57]) +#define GRPC_MDSTR_IF_NONE_MATCH (&grpc_static_mdstr_table[58]) /* "if-range" */ -#define GRPC_MDSTR_IF_RANGE (&grpc_static_mdstr_table[58]) +#define GRPC_MDSTR_IF_RANGE (&grpc_static_mdstr_table[59]) /* "if-unmodified-since" */ -#define GRPC_MDSTR_IF_UNMODIFIED_SINCE (&grpc_static_mdstr_table[59]) +#define GRPC_MDSTR_IF_UNMODIFIED_SINCE (&grpc_static_mdstr_table[60]) /* "last-modified" */ -#define GRPC_MDSTR_LAST_MODIFIED (&grpc_static_mdstr_table[60]) +#define GRPC_MDSTR_LAST_MODIFIED (&grpc_static_mdstr_table[61]) /* "link" */ -#define GRPC_MDSTR_LINK (&grpc_static_mdstr_table[61]) +#define GRPC_MDSTR_LINK (&grpc_static_mdstr_table[62]) /* "location" */ -#define GRPC_MDSTR_LOCATION (&grpc_static_mdstr_table[62]) +#define GRPC_MDSTR_LOCATION (&grpc_static_mdstr_table[63]) /* "max-forwards" */ -#define GRPC_MDSTR_MAX_FORWARDS (&grpc_static_mdstr_table[63]) +#define GRPC_MDSTR_MAX_FORWARDS (&grpc_static_mdstr_table[64]) /* ":method" */ -#define GRPC_MDSTR_METHOD (&grpc_static_mdstr_table[64]) +#define GRPC_MDSTR_METHOD (&grpc_static_mdstr_table[65]) /* ":path" */ -#define GRPC_MDSTR_PATH (&grpc_static_mdstr_table[65]) +#define GRPC_MDSTR_PATH (&grpc_static_mdstr_table[66]) /* "POST" */ -#define GRPC_MDSTR_POST (&grpc_static_mdstr_table[66]) +#define GRPC_MDSTR_POST (&grpc_static_mdstr_table[67]) /* "proxy-authenticate" */ -#define GRPC_MDSTR_PROXY_AUTHENTICATE (&grpc_static_mdstr_table[67]) +#define GRPC_MDSTR_PROXY_AUTHENTICATE (&grpc_static_mdstr_table[68]) /* "proxy-authorization" */ -#define GRPC_MDSTR_PROXY_AUTHORIZATION (&grpc_static_mdstr_table[68]) +#define GRPC_MDSTR_PROXY_AUTHORIZATION (&grpc_static_mdstr_table[69]) /* "range" */ -#define GRPC_MDSTR_RANGE (&grpc_static_mdstr_table[69]) +#define GRPC_MDSTR_RANGE (&grpc_static_mdstr_table[70]) /* "referer" */ -#define GRPC_MDSTR_REFERER (&grpc_static_mdstr_table[70]) +#define GRPC_MDSTR_REFERER (&grpc_static_mdstr_table[71]) /* "refresh" */ -#define GRPC_MDSTR_REFRESH (&grpc_static_mdstr_table[71]) +#define GRPC_MDSTR_REFRESH (&grpc_static_mdstr_table[72]) /* "retry-after" */ -#define GRPC_MDSTR_RETRY_AFTER (&grpc_static_mdstr_table[72]) +#define GRPC_MDSTR_RETRY_AFTER (&grpc_static_mdstr_table[73]) /* ":scheme" */ -#define GRPC_MDSTR_SCHEME (&grpc_static_mdstr_table[73]) +#define GRPC_MDSTR_SCHEME (&grpc_static_mdstr_table[74]) /* "server" */ -#define GRPC_MDSTR_SERVER (&grpc_static_mdstr_table[74]) +#define GRPC_MDSTR_SERVER (&grpc_static_mdstr_table[75]) /* "set-cookie" */ -#define GRPC_MDSTR_SET_COOKIE (&grpc_static_mdstr_table[75]) +#define GRPC_MDSTR_SET_COOKIE (&grpc_static_mdstr_table[76]) /* "/" */ -#define GRPC_MDSTR_SLASH (&grpc_static_mdstr_table[76]) +#define GRPC_MDSTR_SLASH (&grpc_static_mdstr_table[77]) /* "/index.html" */ -#define GRPC_MDSTR_SLASH_INDEX_DOT_HTML (&grpc_static_mdstr_table[77]) +#define GRPC_MDSTR_SLASH_INDEX_DOT_HTML (&grpc_static_mdstr_table[78]) /* ":status" */ -#define GRPC_MDSTR_STATUS (&grpc_static_mdstr_table[78]) +#define GRPC_MDSTR_STATUS (&grpc_static_mdstr_table[79]) /* "strict-transport-security" */ -#define GRPC_MDSTR_STRICT_TRANSPORT_SECURITY (&grpc_static_mdstr_table[79]) +#define GRPC_MDSTR_STRICT_TRANSPORT_SECURITY (&grpc_static_mdstr_table[80]) /* "te" */ -#define GRPC_MDSTR_TE (&grpc_static_mdstr_table[80]) +#define GRPC_MDSTR_TE (&grpc_static_mdstr_table[81]) /* "trailers" */ -#define GRPC_MDSTR_TRAILERS (&grpc_static_mdstr_table[81]) +#define GRPC_MDSTR_TRAILERS (&grpc_static_mdstr_table[82]) /* "transfer-encoding" */ -#define GRPC_MDSTR_TRANSFER_ENCODING (&grpc_static_mdstr_table[82]) +#define GRPC_MDSTR_TRANSFER_ENCODING (&grpc_static_mdstr_table[83]) /* "user-agent" */ -#define GRPC_MDSTR_USER_AGENT (&grpc_static_mdstr_table[83]) +#define GRPC_MDSTR_USER_AGENT (&grpc_static_mdstr_table[84]) /* "vary" */ -#define GRPC_MDSTR_VARY (&grpc_static_mdstr_table[84]) +#define GRPC_MDSTR_VARY (&grpc_static_mdstr_table[85]) /* "via" */ -#define GRPC_MDSTR_VIA (&grpc_static_mdstr_table[85]) +#define GRPC_MDSTR_VIA (&grpc_static_mdstr_table[86]) /* "www-authenticate" */ -#define GRPC_MDSTR_WWW_AUTHENTICATE (&grpc_static_mdstr_table[86]) +#define GRPC_MDSTR_WWW_AUTHENTICATE (&grpc_static_mdstr_table[87]) #define GRPC_STATIC_MDELEM_COUNT 78 extern grpc_mdelem grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT]; diff --git a/src/cpp/client/channel.cc b/src/cpp/client/channel.cc index c7974d655b..6b20abaf53 100644 --- a/src/cpp/client/channel.cc +++ b/src/cpp/client/channel.cc @@ -77,7 +77,6 @@ Call Channel::CreateCall(const RpcMethod& method, ClientContext* context, cq->cq(), method.name(), host_str, context->raw_deadline(), nullptr); } - grpc_census_call_set_context(c_call, context->census_context()); context->set_call(c_call, shared_from_this()); return Call(c_call, this, cq); } diff --git a/src/cpp/server/server_context.cc b/src/cpp/server/server_context.cc index 8193e70660..0306b5f321 100644 --- a/src/cpp/server/server_context.cc +++ b/src/cpp/server/server_context.cc @@ -214,8 +214,4 @@ grpc::string ServerContext::peer() const { return peer; } -const struct census_context* ServerContext::census_context() const { - return grpc_census_call_get_context(call_); -} - } // namespace grpc diff --git a/tools/codegen/core/gen_static_metadata.py b/tools/codegen/core/gen_static_metadata.py index 86cb4143f8..fb7e6d05d5 100755 --- a/tools/codegen/core/gen_static_metadata.py +++ b/tools/codegen/core/gen_static_metadata.py @@ -50,6 +50,7 @@ CONFIG = [ 'host', 'grpc-message', 'grpc-status', + ':census', '', ('grpc-status', '0'), ('grpc-status', '1'), -- GitLab