Merge pull request #4274 from maxwell-demon/master

Census tags propagation.
pull/4438/head
Alistair Veitch 9 years ago
commit 0aac65ddda
  1. 2
      include/grpc++/client_context.h
  2. 2
      src/core/census/context.h
  3. 32
      src/core/transport/static_metadata.c
  4. 136
      src/core/transport/static_metadata.h
  5. 2
      tools/codegen/core/gen_static_metadata.py

@ -268,7 +268,7 @@ class ClientContext {
/// \return The call's peer URI. /// \return The call's peer URI.
grpc::string peer() const; grpc::string peer() const;
/// Get and set census context /// Get and set census context.
void set_census_context(struct census_context* ccp) { census_context_ = ccp; } void set_census_context(struct census_context* ccp) { census_context_ = ccp; }
struct census_context* census_context() const { struct census_context* census_context() const {
return census_context_; return census_context_;

@ -36,6 +36,8 @@
#include <grpc/census.h> #include <grpc/census.h>
#define GRPC_CENSUS_MAX_ON_THE_WIRE_TAG_BYTES 2048
/* census_context is the in-memory representation of information needed to /* census_context is the in-memory representation of information needed to
* maintain tracing, RPC statistics and resource usage information. */ * maintain tracing, RPC statistics and resource usage information. */
struct census_context { struct census_context {

@ -33,11 +33,11 @@
* WARNING: Auto-generated code. * WARNING: Auto-generated code.
* *
* To make changes to this file, change * To make changes to this file, change
* tools/codegen/core/gen_static_metadata.py, *tools/codegen/core/gen_static_metadata.py,
* and then re-run it. * and then re-run it.
* *
* See metadata.h for an explanation of the interface here, and metadata.c for * See metadata.h for an explanation of the interface here, and metadata.c for
* an *an
* explanation of what's going on. * explanation of what's going on.
*/ */
@ -54,25 +54,25 @@ gpr_uintptr grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT] = {
const gpr_uint8 const gpr_uint8
grpc_static_metadata_elem_indices[GRPC_STATIC_MDELEM_COUNT * 2] = { 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, 11, 35, 10, 35, 12, 35, 12, 49, 13, 35, 14, 35, 15, 35, 16, 35, 17, 35,
19, 33, 20, 33, 21, 33, 22, 33, 23, 33, 24, 33, 25, 33, 26, 33, 27, 33, 19, 35, 20, 35, 21, 35, 24, 35, 25, 35, 26, 35, 27, 35, 28, 35, 29, 35,
28, 18, 28, 33, 29, 33, 30, 33, 34, 33, 35, 33, 36, 33, 37, 33, 40, 31, 30, 18, 30, 35, 31, 35, 32, 35, 36, 35, 37, 35, 38, 35, 39, 35, 42, 33,
40, 32, 40, 46, 40, 51, 40, 52, 40, 53, 40, 54, 41, 31, 41, 46, 41, 51, 42, 34, 42, 48, 42, 53, 42, 54, 42, 55, 42, 56, 43, 33, 43, 48, 43, 53,
44, 0, 44, 1, 44, 2, 48, 33, 55, 33, 56, 33, 57, 33, 58, 33, 59, 33, 46, 0, 46, 1, 46, 2, 50, 35, 57, 35, 58, 35, 59, 35, 60, 35, 61, 35,
60, 33, 61, 33, 62, 33, 63, 33, 64, 38, 64, 66, 65, 76, 65, 77, 67, 33, 62, 35, 63, 35, 64, 35, 65, 35, 66, 40, 66, 68, 67, 78, 67, 79, 69, 35,
68, 33, 69, 33, 70, 33, 71, 33, 72, 33, 73, 39, 73, 49, 73, 50, 74, 33, 70, 35, 71, 35, 72, 35, 73, 35, 74, 35, 75, 41, 75, 51, 75, 52, 76, 35,
75, 33, 78, 3, 78, 4, 78, 5, 78, 6, 78, 7, 78, 8, 78, 9, 79, 33, 77, 35, 80, 3, 80, 4, 80, 5, 80, 6, 80, 7, 80, 8, 80, 9, 81, 35,
80, 81, 82, 33, 83, 33, 84, 33, 85, 33, 86, 33}; 82, 83, 84, 35, 85, 35, 86, 35, 87, 35, 88, 35};
const char *const grpc_static_metadata_strings[GRPC_STATIC_MDSTR_COUNT] = { const char *const grpc_static_metadata_strings[GRPC_STATIC_MDSTR_COUNT] = {
"0", "1", "2", "200", "204", "206", "304", "400", "404", "500", "accept", "0", "1", "2", "200", "204", "206", "304", "400", "404", "500", "accept",
"accept-charset", "accept-encoding", "accept-language", "accept-ranges", "accept-charset", "accept-encoding", "accept-language", "accept-ranges",
"access-control-allow-origin", "age", "allow", "application/grpc", "access-control-allow-origin", "age", "allow", "application/grpc",
":authority", "authorization", "cache-control", "content-disposition", ":authority", "authorization", "cache-control", "census", "census-bin",
"content-encoding", "content-language", "content-length", "content-disposition", "content-encoding", "content-language",
"content-location", "content-range", "content-type", "cookie", "date", "content-length", "content-location", "content-range", "content-type",
"deflate", "deflate,gzip", "", "etag", "expect", "expires", "from", "GET", "cookie", "date", "deflate", "deflate,gzip", "", "etag", "expect",
"grpc", "grpc-accept-encoding", "grpc-encoding", "expires", "from", "GET", "grpc", "grpc-accept-encoding", "grpc-encoding",
"grpc-internal-encoding-request", "grpc-message", "grpc-status", "grpc-internal-encoding-request", "grpc-message", "grpc-status",
"grpc-timeout", "gzip", "gzip, deflate", "host", "http", "https", "grpc-timeout", "gzip", "gzip, deflate", "host", "http", "https",
"identity", "identity,deflate", "identity,deflate,gzip", "identity,gzip", "identity", "identity,deflate", "identity,deflate,gzip", "identity,gzip",

@ -46,7 +46,7 @@
#include "src/core/transport/metadata.h" #include "src/core/transport/metadata.h"
#define GRPC_STATIC_MDSTR_COUNT 87 #define GRPC_STATIC_MDSTR_COUNT 89
extern grpc_mdstr grpc_static_mdstr_table[GRPC_STATIC_MDSTR_COUNT]; extern grpc_mdstr grpc_static_mdstr_table[GRPC_STATIC_MDSTR_COUNT];
/* "0" */ /* "0" */
#define GRPC_MDSTR_0 (&grpc_static_mdstr_table[0]) #define GRPC_MDSTR_0 (&grpc_static_mdstr_table[0])
@ -92,137 +92,141 @@ extern grpc_mdstr grpc_static_mdstr_table[GRPC_STATIC_MDSTR_COUNT];
#define GRPC_MDSTR_AUTHORIZATION (&grpc_static_mdstr_table[20]) #define GRPC_MDSTR_AUTHORIZATION (&grpc_static_mdstr_table[20])
/* "cache-control" */ /* "cache-control" */
#define GRPC_MDSTR_CACHE_CONTROL (&grpc_static_mdstr_table[21]) #define GRPC_MDSTR_CACHE_CONTROL (&grpc_static_mdstr_table[21])
/* "census" */
#define GRPC_MDSTR_CENSUS (&grpc_static_mdstr_table[22])
/* "census-bin" */
#define GRPC_MDSTR_CENSUS_BIN (&grpc_static_mdstr_table[23])
/* "content-disposition" */ /* "content-disposition" */
#define GRPC_MDSTR_CONTENT_DISPOSITION (&grpc_static_mdstr_table[22]) #define GRPC_MDSTR_CONTENT_DISPOSITION (&grpc_static_mdstr_table[24])
/* "content-encoding" */ /* "content-encoding" */
#define GRPC_MDSTR_CONTENT_ENCODING (&grpc_static_mdstr_table[23]) #define GRPC_MDSTR_CONTENT_ENCODING (&grpc_static_mdstr_table[25])
/* "content-language" */ /* "content-language" */
#define GRPC_MDSTR_CONTENT_LANGUAGE (&grpc_static_mdstr_table[24]) #define GRPC_MDSTR_CONTENT_LANGUAGE (&grpc_static_mdstr_table[26])
/* "content-length" */ /* "content-length" */
#define GRPC_MDSTR_CONTENT_LENGTH (&grpc_static_mdstr_table[25]) #define GRPC_MDSTR_CONTENT_LENGTH (&grpc_static_mdstr_table[27])
/* "content-location" */ /* "content-location" */
#define GRPC_MDSTR_CONTENT_LOCATION (&grpc_static_mdstr_table[26]) #define GRPC_MDSTR_CONTENT_LOCATION (&grpc_static_mdstr_table[28])
/* "content-range" */ /* "content-range" */
#define GRPC_MDSTR_CONTENT_RANGE (&grpc_static_mdstr_table[27]) #define GRPC_MDSTR_CONTENT_RANGE (&grpc_static_mdstr_table[29])
/* "content-type" */ /* "content-type" */
#define GRPC_MDSTR_CONTENT_TYPE (&grpc_static_mdstr_table[28]) #define GRPC_MDSTR_CONTENT_TYPE (&grpc_static_mdstr_table[30])
/* "cookie" */ /* "cookie" */
#define GRPC_MDSTR_COOKIE (&grpc_static_mdstr_table[29]) #define GRPC_MDSTR_COOKIE (&grpc_static_mdstr_table[31])
/* "date" */ /* "date" */
#define GRPC_MDSTR_DATE (&grpc_static_mdstr_table[30]) #define GRPC_MDSTR_DATE (&grpc_static_mdstr_table[32])
/* "deflate" */ /* "deflate" */
#define GRPC_MDSTR_DEFLATE (&grpc_static_mdstr_table[31]) #define GRPC_MDSTR_DEFLATE (&grpc_static_mdstr_table[33])
/* "deflate,gzip" */ /* "deflate,gzip" */
#define GRPC_MDSTR_DEFLATE_COMMA_GZIP (&grpc_static_mdstr_table[32]) #define GRPC_MDSTR_DEFLATE_COMMA_GZIP (&grpc_static_mdstr_table[34])
/* "" */ /* "" */
#define GRPC_MDSTR_EMPTY (&grpc_static_mdstr_table[33]) #define GRPC_MDSTR_EMPTY (&grpc_static_mdstr_table[35])
/* "etag" */ /* "etag" */
#define GRPC_MDSTR_ETAG (&grpc_static_mdstr_table[34]) #define GRPC_MDSTR_ETAG (&grpc_static_mdstr_table[36])
/* "expect" */ /* "expect" */
#define GRPC_MDSTR_EXPECT (&grpc_static_mdstr_table[35]) #define GRPC_MDSTR_EXPECT (&grpc_static_mdstr_table[37])
/* "expires" */ /* "expires" */
#define GRPC_MDSTR_EXPIRES (&grpc_static_mdstr_table[36]) #define GRPC_MDSTR_EXPIRES (&grpc_static_mdstr_table[38])
/* "from" */ /* "from" */
#define GRPC_MDSTR_FROM (&grpc_static_mdstr_table[37]) #define GRPC_MDSTR_FROM (&grpc_static_mdstr_table[39])
/* "GET" */ /* "GET" */
#define GRPC_MDSTR_GET (&grpc_static_mdstr_table[38]) #define GRPC_MDSTR_GET (&grpc_static_mdstr_table[40])
/* "grpc" */ /* "grpc" */
#define GRPC_MDSTR_GRPC (&grpc_static_mdstr_table[39]) #define GRPC_MDSTR_GRPC (&grpc_static_mdstr_table[41])
/* "grpc-accept-encoding" */ /* "grpc-accept-encoding" */
#define GRPC_MDSTR_GRPC_ACCEPT_ENCODING (&grpc_static_mdstr_table[40]) #define GRPC_MDSTR_GRPC_ACCEPT_ENCODING (&grpc_static_mdstr_table[42])
/* "grpc-encoding" */ /* "grpc-encoding" */
#define GRPC_MDSTR_GRPC_ENCODING (&grpc_static_mdstr_table[41]) #define GRPC_MDSTR_GRPC_ENCODING (&grpc_static_mdstr_table[43])
/* "grpc-internal-encoding-request" */ /* "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[44])
/* "grpc-message" */ /* "grpc-message" */
#define GRPC_MDSTR_GRPC_MESSAGE (&grpc_static_mdstr_table[43]) #define GRPC_MDSTR_GRPC_MESSAGE (&grpc_static_mdstr_table[45])
/* "grpc-status" */ /* "grpc-status" */
#define GRPC_MDSTR_GRPC_STATUS (&grpc_static_mdstr_table[44]) #define GRPC_MDSTR_GRPC_STATUS (&grpc_static_mdstr_table[46])
/* "grpc-timeout" */ /* "grpc-timeout" */
#define GRPC_MDSTR_GRPC_TIMEOUT (&grpc_static_mdstr_table[45]) #define GRPC_MDSTR_GRPC_TIMEOUT (&grpc_static_mdstr_table[47])
/* "gzip" */ /* "gzip" */
#define GRPC_MDSTR_GZIP (&grpc_static_mdstr_table[46]) #define GRPC_MDSTR_GZIP (&grpc_static_mdstr_table[48])
/* "gzip, deflate" */ /* "gzip, deflate" */
#define GRPC_MDSTR_GZIP_COMMA_DEFLATE (&grpc_static_mdstr_table[47]) #define GRPC_MDSTR_GZIP_COMMA_DEFLATE (&grpc_static_mdstr_table[49])
/* "host" */ /* "host" */
#define GRPC_MDSTR_HOST (&grpc_static_mdstr_table[48]) #define GRPC_MDSTR_HOST (&grpc_static_mdstr_table[50])
/* "http" */ /* "http" */
#define GRPC_MDSTR_HTTP (&grpc_static_mdstr_table[49]) #define GRPC_MDSTR_HTTP (&grpc_static_mdstr_table[51])
/* "https" */ /* "https" */
#define GRPC_MDSTR_HTTPS (&grpc_static_mdstr_table[50]) #define GRPC_MDSTR_HTTPS (&grpc_static_mdstr_table[52])
/* "identity" */ /* "identity" */
#define GRPC_MDSTR_IDENTITY (&grpc_static_mdstr_table[51]) #define GRPC_MDSTR_IDENTITY (&grpc_static_mdstr_table[53])
/* "identity,deflate" */ /* "identity,deflate" */
#define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE (&grpc_static_mdstr_table[52]) #define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE (&grpc_static_mdstr_table[54])
/* "identity,deflate,gzip" */ /* "identity,deflate,gzip" */
#define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE_COMMA_GZIP \ #define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE_COMMA_GZIP \
(&grpc_static_mdstr_table[53]) (&grpc_static_mdstr_table[55])
/* "identity,gzip" */ /* "identity,gzip" */
#define GRPC_MDSTR_IDENTITY_COMMA_GZIP (&grpc_static_mdstr_table[54]) #define GRPC_MDSTR_IDENTITY_COMMA_GZIP (&grpc_static_mdstr_table[56])
/* "if-match" */ /* "if-match" */
#define GRPC_MDSTR_IF_MATCH (&grpc_static_mdstr_table[55]) #define GRPC_MDSTR_IF_MATCH (&grpc_static_mdstr_table[57])
/* "if-modified-since" */ /* "if-modified-since" */
#define GRPC_MDSTR_IF_MODIFIED_SINCE (&grpc_static_mdstr_table[56]) #define GRPC_MDSTR_IF_MODIFIED_SINCE (&grpc_static_mdstr_table[58])
/* "if-none-match" */ /* "if-none-match" */
#define GRPC_MDSTR_IF_NONE_MATCH (&grpc_static_mdstr_table[57]) #define GRPC_MDSTR_IF_NONE_MATCH (&grpc_static_mdstr_table[59])
/* "if-range" */ /* "if-range" */
#define GRPC_MDSTR_IF_RANGE (&grpc_static_mdstr_table[58]) #define GRPC_MDSTR_IF_RANGE (&grpc_static_mdstr_table[60])
/* "if-unmodified-since" */ /* "if-unmodified-since" */
#define GRPC_MDSTR_IF_UNMODIFIED_SINCE (&grpc_static_mdstr_table[59]) #define GRPC_MDSTR_IF_UNMODIFIED_SINCE (&grpc_static_mdstr_table[61])
/* "last-modified" */ /* "last-modified" */
#define GRPC_MDSTR_LAST_MODIFIED (&grpc_static_mdstr_table[60]) #define GRPC_MDSTR_LAST_MODIFIED (&grpc_static_mdstr_table[62])
/* "link" */ /* "link" */
#define GRPC_MDSTR_LINK (&grpc_static_mdstr_table[61]) #define GRPC_MDSTR_LINK (&grpc_static_mdstr_table[63])
/* "location" */ /* "location" */
#define GRPC_MDSTR_LOCATION (&grpc_static_mdstr_table[62]) #define GRPC_MDSTR_LOCATION (&grpc_static_mdstr_table[64])
/* "max-forwards" */ /* "max-forwards" */
#define GRPC_MDSTR_MAX_FORWARDS (&grpc_static_mdstr_table[63]) #define GRPC_MDSTR_MAX_FORWARDS (&grpc_static_mdstr_table[65])
/* ":method" */ /* ":method" */
#define GRPC_MDSTR_METHOD (&grpc_static_mdstr_table[64]) #define GRPC_MDSTR_METHOD (&grpc_static_mdstr_table[66])
/* ":path" */ /* ":path" */
#define GRPC_MDSTR_PATH (&grpc_static_mdstr_table[65]) #define GRPC_MDSTR_PATH (&grpc_static_mdstr_table[67])
/* "POST" */ /* "POST" */
#define GRPC_MDSTR_POST (&grpc_static_mdstr_table[66]) #define GRPC_MDSTR_POST (&grpc_static_mdstr_table[68])
/* "proxy-authenticate" */ /* "proxy-authenticate" */
#define GRPC_MDSTR_PROXY_AUTHENTICATE (&grpc_static_mdstr_table[67]) #define GRPC_MDSTR_PROXY_AUTHENTICATE (&grpc_static_mdstr_table[69])
/* "proxy-authorization" */ /* "proxy-authorization" */
#define GRPC_MDSTR_PROXY_AUTHORIZATION (&grpc_static_mdstr_table[68]) #define GRPC_MDSTR_PROXY_AUTHORIZATION (&grpc_static_mdstr_table[70])
/* "range" */ /* "range" */
#define GRPC_MDSTR_RANGE (&grpc_static_mdstr_table[69]) #define GRPC_MDSTR_RANGE (&grpc_static_mdstr_table[71])
/* "referer" */ /* "referer" */
#define GRPC_MDSTR_REFERER (&grpc_static_mdstr_table[70]) #define GRPC_MDSTR_REFERER (&grpc_static_mdstr_table[72])
/* "refresh" */ /* "refresh" */
#define GRPC_MDSTR_REFRESH (&grpc_static_mdstr_table[71]) #define GRPC_MDSTR_REFRESH (&grpc_static_mdstr_table[73])
/* "retry-after" */ /* "retry-after" */
#define GRPC_MDSTR_RETRY_AFTER (&grpc_static_mdstr_table[72]) #define GRPC_MDSTR_RETRY_AFTER (&grpc_static_mdstr_table[74])
/* ":scheme" */ /* ":scheme" */
#define GRPC_MDSTR_SCHEME (&grpc_static_mdstr_table[73]) #define GRPC_MDSTR_SCHEME (&grpc_static_mdstr_table[75])
/* "server" */ /* "server" */
#define GRPC_MDSTR_SERVER (&grpc_static_mdstr_table[74]) #define GRPC_MDSTR_SERVER (&grpc_static_mdstr_table[76])
/* "set-cookie" */ /* "set-cookie" */
#define GRPC_MDSTR_SET_COOKIE (&grpc_static_mdstr_table[75]) #define GRPC_MDSTR_SET_COOKIE (&grpc_static_mdstr_table[77])
/* "/" */ /* "/" */
#define GRPC_MDSTR_SLASH (&grpc_static_mdstr_table[76]) #define GRPC_MDSTR_SLASH (&grpc_static_mdstr_table[78])
/* "/index.html" */ /* "/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[79])
/* ":status" */ /* ":status" */
#define GRPC_MDSTR_STATUS (&grpc_static_mdstr_table[78]) #define GRPC_MDSTR_STATUS (&grpc_static_mdstr_table[80])
/* "strict-transport-security" */ /* "strict-transport-security" */
#define GRPC_MDSTR_STRICT_TRANSPORT_SECURITY (&grpc_static_mdstr_table[79]) #define GRPC_MDSTR_STRICT_TRANSPORT_SECURITY (&grpc_static_mdstr_table[81])
/* "te" */ /* "te" */
#define GRPC_MDSTR_TE (&grpc_static_mdstr_table[80]) #define GRPC_MDSTR_TE (&grpc_static_mdstr_table[82])
/* "trailers" */ /* "trailers" */
#define GRPC_MDSTR_TRAILERS (&grpc_static_mdstr_table[81]) #define GRPC_MDSTR_TRAILERS (&grpc_static_mdstr_table[83])
/* "transfer-encoding" */ /* "transfer-encoding" */
#define GRPC_MDSTR_TRANSFER_ENCODING (&grpc_static_mdstr_table[82]) #define GRPC_MDSTR_TRANSFER_ENCODING (&grpc_static_mdstr_table[84])
/* "user-agent" */ /* "user-agent" */
#define GRPC_MDSTR_USER_AGENT (&grpc_static_mdstr_table[83]) #define GRPC_MDSTR_USER_AGENT (&grpc_static_mdstr_table[85])
/* "vary" */ /* "vary" */
#define GRPC_MDSTR_VARY (&grpc_static_mdstr_table[84]) #define GRPC_MDSTR_VARY (&grpc_static_mdstr_table[86])
/* "via" */ /* "via" */
#define GRPC_MDSTR_VIA (&grpc_static_mdstr_table[85]) #define GRPC_MDSTR_VIA (&grpc_static_mdstr_table[87])
/* "www-authenticate" */ /* "www-authenticate" */
#define GRPC_MDSTR_WWW_AUTHENTICATE (&grpc_static_mdstr_table[86]) #define GRPC_MDSTR_WWW_AUTHENTICATE (&grpc_static_mdstr_table[88])
#define GRPC_STATIC_MDELEM_COUNT 78 #define GRPC_STATIC_MDELEM_COUNT 78
extern grpc_mdelem grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT]; extern grpc_mdelem grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT];

@ -50,6 +50,8 @@ CONFIG = [
'host', 'host',
'grpc-message', 'grpc-message',
'grpc-status', 'grpc-status',
'census',
'census-bin',
'', '',
('grpc-status', '0'), ('grpc-status', '0'),
('grpc-status', '1'), ('grpc-status', '1'),

Loading…
Cancel
Save