aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar Hongyu Chen <hongyu@google.com>2015-12-10 16:19:24 -0800
committerGravatar Hongyu Chen <hongyu@google.com>2015-12-10 16:19:24 -0800
commit134cac200437e2e86e500a342e801177b58e3756 (patch)
tree491fbd5d8c58df95a453b689a7a7dc06991a5557 /include
parent1fa931c374a5b5872bdeacdebd5e24c2638849b1 (diff)
Address comments: revert all changes except adding two new metadata keys
"census" and "census-bin"
Diffstat (limited to 'include')
-rw-r--r--include/grpc++/client_context.h10
-rw-r--r--include/grpc++/server_context.h3
-rw-r--r--include/grpc/census.h8
3 files changed, 13 insertions, 8 deletions
diff --git a/include/grpc++/client_context.h b/include/grpc++/client_context.h
index 9d64715803..1f46d8e417 100644
--- a/include/grpc++/client_context.h
+++ b/include/grpc++/client_context.h
@@ -37,6 +37,7 @@
/// side.
/// - Control call settings such as compression and authentication.
/// - Initial and trailing metadata coming from the server.
+/// - Get performace 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
@@ -63,6 +64,8 @@
#include <grpc/support/log.h>
#include <grpc/support/time.h>
+struct census_context;
+
namespace grpc {
class Channel;
@@ -265,6 +268,12 @@ 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.
///
@@ -314,6 +323,7 @@ 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 de4af7d1c2..85f384d477 100644
--- a/include/grpc++/server_context.h
+++ b/include/grpc++/server_context.h
@@ -47,6 +47,7 @@
struct gpr_timespec;
struct grpc_metadata;
struct grpc_call;
+struct census_context;
namespace grpc {
@@ -125,6 +126,8 @@ 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 2e6e19a016..d0bc90420c 100644
--- a/include/grpc/census.h
+++ b/include/grpc/census.h
@@ -79,14 +79,6 @@ 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: