Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions api/envoy/config/trace/v2/trace.proto
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ message OpenCensusConfig {
// The Cloud project_id to use for Stackdriver tracing.
string stackdriver_project_id = 4;

// (optional) By default, the Stackdriver exporter will connect to production
// Stackdriver. If stackdriver_address is non-empty, it will instead connect
// to this address, which is in the gRPC format:
// https://github.com/grpc/grpc/blob/master/doc/naming.md
string stackdriver_address = 10;

// Enables the Zipkin exporter if set to true. The url and service name must
// also be set.
bool zipkin_exporter_enabled = 5;
Expand Down
8 changes: 4 additions & 4 deletions bazel/repository_locations.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,10 @@ REPOSITORY_LOCATIONS = dict(
urls = ["https://files.pythonhosted.org/packages/b3/b2/238e2590826bfdd113244a40d9d3eb26918bd798fc187e2360a8367068db/six-1.10.0.tar.gz"],
),
io_opencensus_cpp = dict(
sha256 = "9223b4d54af4151910dede03aa58247e90df72167fcc91d5f75e73a141568036",
strip_prefix = "opencensus-cpp-e292a374fb42c6cb2743f1689234bd409f4fda20",
# 2019-07-15
urls = ["https://github.com/census-instrumentation/opencensus-cpp/archive/e292a374fb42c6cb2743f1689234bd409f4fda20.tar.gz"],
sha256 = "8d6016e47c2e19e7acbadb6f905b8c422748c64299d71101ac8f28151677e195",
strip_prefix = "opencensus-cpp-cad0d03ff3474cf14389fc249e16847ab7b6895f",
# 2019-07-31
urls = ["https://github.com/census-instrumentation/opencensus-cpp/archive/cad0d03ff3474cf14389fc249e16847ab7b6895f.tar.gz"],
),
com_github_curl = dict(
sha256 = "821aeb78421375f70e55381c9ad2474bf279fc454b791b7e95fc83562951c690",
Expand Down
1 change: 1 addition & 0 deletions source/extensions/tracers/opencensus/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ envoy_cc_library(
name = "opencensus_tracer_impl",
srcs = ["opencensus_tracer_impl.cc"],
hdrs = ["opencensus_tracer_impl.h"],
copts = ["-Wno-unused-parameter"],
external_deps = [
"opencensus_trace",
"opencensus_trace_cloud_trace_context",
Expand Down
10 changes: 9 additions & 1 deletion source/extensions/tracers/opencensus/opencensus_tracer_impl.cc
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
#include "extensions/tracers/opencensus/opencensus_tracer_impl.h"

#include <grpcpp/grpcpp.h>

#include "envoy/http/header_map.h"

#include "common/common/base64.h"

#include "absl/strings/str_cat.h"
#include "google/devtools/cloudtrace/v2/tracing.grpc.pb.h"
#include "opencensus/exporters/trace/stackdriver/stackdriver_exporter.h"
#include "opencensus/exporters/trace/stdout/stdout_exporter.h"
#include "opencensus/exporters/trace/zipkin/zipkin_exporter.h"
Expand Down Expand Up @@ -197,7 +200,12 @@ Driver::Driver(const envoy::config::trace::v2::OpenCensusConfig& oc_config,
if (oc_config.stackdriver_exporter_enabled()) {
::opencensus::exporters::trace::StackdriverOptions opts;
opts.project_id = oc_config.stackdriver_project_id();
::opencensus::exporters::trace::StackdriverExporter::Register(opts);
if (!oc_config.stackdriver_address().empty()) {
auto channel =
grpc::CreateChannel(oc_config.stackdriver_address(), grpc::InsecureChannelCredentials());
opts.trace_service_stub = ::google::devtools::cloudtrace::v2::TraceService::NewStub(channel);
}
::opencensus::exporters::trace::StackdriverExporter::Register(std::move(opts));
}
if (oc_config.zipkin_exporter_enabled()) {
::opencensus::exporters::trace::ZipkinExporterOptions opts(oc_config.zipkin_url());
Expand Down