Merge pull request #23180 from karthikravis/opencensus

Move OpenCensus back to ::grpc from ::grpc_impl
pull/23183/head
Karthik Ravi Shankar 5 years ago committed by GitHub
commit 70465c92ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      include/grpcpp/opencensus.h
  2. 6
      src/cpp/ext/filters/census/grpc_plugin.cc
  3. 8
      test/cpp/microbenchmarks/bm_opencensus_plugin.cc

@ -1,6 +1,6 @@
/*
*
* Copyright 2018 gRPC authors.
* Copyright 2019 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -23,7 +23,7 @@
namespace grpc_impl {
class ServerContext;
}
} // namespace grpc_impl
namespace grpc {
// These symbols in this file will not be included in the binary unless

@ -55,8 +55,9 @@ void RegisterOpenCensusPlugin() {
RpcServerReceivedMessagesPerRpc();
}
::opencensus::trace::Span GetSpanFromServerContext(ServerContext* context) {
return reinterpret_cast<const CensusContext*>(context->census_context())
::opencensus::trace::Span GetSpanFromServerContext(
grpc::ServerContext* context) {
return reinterpret_cast<const grpc::CensusContext*>(context->census_context())
->Span();
}
@ -127,5 +128,4 @@ ABSL_CONST_INIT const absl::string_view
ABSL_CONST_INIT const absl::string_view kRpcServerServerLatencyMeasureName =
"grpc.io/server/server_latency";
} // namespace grpc

@ -24,18 +24,14 @@
#include "absl/strings/str_cat.h"
#include "include/grpc/grpc.h"
#include "include/grpcpp/grpcpp.h"
#include "include/grpcpp/opencensus.h"
#include "opencensus/stats/stats.h"
#include "src/cpp/ext/filters/census/grpc_plugin.h"
#include "src/proto/grpc/testing/echo.grpc.pb.h"
#include "test/core/util/test_config.h"
#include "test/cpp/microbenchmarks/helpers.h"
using ::grpc::RegisterOpenCensusPlugin;
using ::grpc::RegisterOpenCensusViewsForExport;
absl::once_flag once;
void RegisterOnce() { absl::call_once(once, RegisterOpenCensusPlugin); }
void RegisterOnce() { absl::call_once(once, grpc::RegisterOpenCensusPlugin); }
class EchoServer final : public grpc::testing::EchoTestService::Service {
grpc::Status Echo(grpc::ServerContext* context,
@ -110,7 +106,7 @@ static void BM_E2eLatencyCensusEnabled(benchmark::State& state) {
RegisterOnce();
// This we can safely repeat, and doing so clears accumulated data to avoid
// initialization costs varying between runs.
RegisterOpenCensusViewsForExport();
grpc::RegisterOpenCensusViewsForExport();
EchoServerThread server;
std::unique_ptr<grpc::testing::EchoTestService::Stub> stub =

Loading…
Cancel
Save