aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Vijay Pai <vpai@google.com>2018-08-20 17:03:03 -0700
committerGravatar GitHub <noreply@github.com>2018-08-20 17:03:03 -0700
commitccc6ee3db0924e6f6e9aa1c8ccd60d7e562e6615 (patch)
tree096fe0a7c6b0a1d0dec5d203b4e9c5e23e1e6b4f
parent46008f0d76d158c4828934ab569a3570c0c21135 (diff)
parenteaa51cbc9de8e06c5714d1347dec25dea389950b (diff)
Merge pull request #15984 from g-easy/hdrs
Move GetSpanFromServerContext() to public header.
-rw-r--r--include/grpcpp/opencensus.h11
-rw-r--r--src/cpp/ext/filters/census/grpc_plugin.h4
2 files changed, 11 insertions, 4 deletions
diff --git a/include/grpcpp/opencensus.h b/include/grpcpp/opencensus.h
index 7e5d1dfeb4..07a1333986 100644
--- a/include/grpcpp/opencensus.h
+++ b/include/grpcpp/opencensus.h
@@ -19,6 +19,12 @@
#ifndef GRPCPP_OPENCENSUS_H
#define GRPCPP_OPENCENSUS_H
+#ifndef GRPC_BAZEL_BUILD
+#error OpenCensus for gRPC is only supported when building with bazel.
+#endif
+
+#include "opencensus/trace/span.h"
+
namespace grpc {
// These symbols in this file will not be included in the binary unless
// grpc_opencensus_plugin build target was added as a dependency. At the moment
@@ -36,6 +42,11 @@ void RegisterOpenCensusPlugin();
// ViewDescriptors below.
void RegisterOpenCensusViewsForExport();
+class ServerContext;
+
+// Returns the tracing Span for the current RPC.
+::opencensus::trace::Span GetSpanFromServerContext(ServerContext* context);
+
} // namespace grpc
#endif // GRPCPP_OPENCENSUS_H
diff --git a/src/cpp/ext/filters/census/grpc_plugin.h b/src/cpp/ext/filters/census/grpc_plugin.h
index 7ff2e7a8b8..9e319cb994 100644
--- a/src/cpp/ext/filters/census/grpc_plugin.h
+++ b/src/cpp/ext/filters/census/grpc_plugin.h
@@ -24,15 +24,11 @@
#include "absl/strings/string_view.h"
#include "include/grpcpp/opencensus.h"
#include "opencensus/stats/stats.h"
-#include "opencensus/trace/span.h"
namespace grpc {
class ServerContext;
-// Returns the tracing Span for the current RPC.
-::opencensus::trace::Span GetSpanFromServerContext(ServerContext* context);
-
// The tag keys set when recording RPC stats.
::opencensus::stats::TagKey ClientMethodTagKey();
::opencensus::stats::TagKey ClientStatusTagKey();