diff --git a/include/grpc++/server_context.h b/include/grpc++/server_context.h index 3bfa48fbb656d3c97779b213c9457e13649f9d33..5597798e3ea54f154110df2e4e6ed92a980e9923 100644 --- a/include/grpc++/server_context.h +++ b/include/grpc++/server_context.h @@ -46,6 +46,7 @@ struct gpr_timespec; struct grpc_metadata; struct grpc_call; +struct census_context; namespace grpc { @@ -116,6 +117,8 @@ class ServerContext { std::shared_ptr<const AuthContext> auth_context() const; + const struct census_context* census_context() const; + private: friend class ::grpc::testing::InteropContextInspector; friend class ::grpc::Server; diff --git a/src/cpp/server/server_context.cc b/src/cpp/server/server_context.cc index bf7a4ba5ec1de7c112e6d8fc3b03af679cb274dc..f54ed8aa29d4809a54384c7898645c66450efb5d 100644 --- a/src/cpp/server/server_context.cc +++ b/src/cpp/server/server_context.cc @@ -39,6 +39,7 @@ #include <grpc++/impl/sync.h> #include <grpc++/time.h> +#include "src/core/census/grpc_context.h" #include "src/core/channel/compress_filter.h" #include "src/cpp/common/create_auth_context.h" @@ -179,4 +180,8 @@ std::shared_ptr<const AuthContext> ServerContext::auth_context() const { return auth_context_; } +const struct census_context* ServerContext::census_context() const { + return grpc_census_call_get_context(call_); +} + } // namespace grpc