Skip to content
Closed
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
5 changes: 5 additions & 0 deletions bazel/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,8 @@ config_setting(
name = "disable_signal_trace",
values = {"define": "signal_trace=disabled"},
)

config_setting(
name = "disable_lightstep",
values = {"define": "lightstep_tracing=disabled"},
)
19 changes: 10 additions & 9 deletions source/common/tracing/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,8 @@ envoy_package()

envoy_cc_library(
name = "http_tracer_lib",
srcs = [
"http_tracer_impl.cc",
"lightstep_tracer_impl.cc",
],
hdrs = [
"http_tracer_impl.h",
"lightstep_tracer_impl.h",
],
external_deps = ["lightstep"],
srcs = ["http_tracer_impl.cc"],
hdrs = ["http_tracer_impl.h"],
deps = [
"//include/envoy/local_info:local_info_interface",
"//include/envoy/runtime:runtime_interface",
Expand All @@ -39,3 +32,11 @@ envoy_cc_library(
"//source/common/runtime:uuid_util_lib",
],
)

envoy_cc_library(
name = "lightstep_tracer_lib",
srcs = ["lightstep_tracer_impl.cc"],
hdrs = ["lightstep_tracer_impl.h"],
external_deps = ["lightstep"],
deps = [":http_tracer_lib"],
)
13 changes: 11 additions & 2 deletions source/server/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,17 @@ envoy_cc_library(
name = "configuration_lib",
srcs = ["configuration_impl.cc"],
hdrs = ["configuration_impl.h"],
deps = [
copts = select({
# TODO(tschroed): This allows linking against Google code, but is very hacky.
# https://github.com/lyft/envoy/issues/967 to do it properly, at which point
# the -D can be removed.
"//bazel:disable_lightstep": ["-DDISABLE_LIGHTSTEP_TRACING"],
"//conditions:default": [],
}),
deps = select({
"//bazel:disable_lightstep": [],
"//conditions:default": ["//source/common/tracing:lightstep_tracer_lib"],
}) + [
"//include/envoy/http:filter_interface",
"//include/envoy/network:connection_interface",
"//include/envoy/network:filter_interface",
Expand All @@ -36,7 +46,6 @@ envoy_cc_library(
"//source/common/network:utility_lib",
"//source/common/ratelimit:ratelimit_lib",
"//source/common/ssl:context_config_lib",
"//source/common/tracing:http_tracer_lib",
"//source/common/tracing/zipkin:zipkin_lib",
"//source/common/upstream:cluster_manager_lib",
],
Expand Down
7 changes: 7 additions & 0 deletions source/server/configuration_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
#include "common/ratelimit/ratelimit_impl.h"
#include "common/ssl/context_config_impl.h"
#include "common/tracing/http_tracer_impl.h"

#ifndef DISABLE_LIGHTSTEP_TRACING
#include "common/tracing/lightstep_tracer_impl.h"
#endif // DISABLE_LIGHTSTEP_TRACING
#include "common/tracing/zipkin/zipkin_tracer_impl.h"
#include "common/upstream/cluster_manager_impl.h"

Expand Down Expand Up @@ -117,6 +120,7 @@ void MainImpl::initializeTracers(const Json::Object& configuration) {

::Runtime::RandomGenerator& rand = server_.random();

#ifndef DISABLE_LIGHTSTEP_TRACING
if (type == "lightstep") {
Json::ObjectPtr lightstep_config = driver->getObject("config");

Expand All @@ -134,6 +138,9 @@ void MainImpl::initializeTracers(const Json::Object& configuration) {
http_tracer_.reset(
new Tracing::HttpTracerImpl(std::move(lightstep_driver), server_.localInfo()));
} else {
#else
{
#endif // DISABLE_LIGHTSTEP_TRACING
ASSERT(type == "zipkin");

Tracing::DriverPtr zipkin_driver(
Expand Down
2 changes: 1 addition & 1 deletion test/common/tracing/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ envoy_cc_test(
"//source/common/http:message_lib",
"//source/common/runtime:runtime_lib",
"//source/common/runtime:uuid_util_lib",
"//source/common/tracing:http_tracer_lib",
"//source/common/tracing:lightstep_tracer_lib",
"//test/mocks/http:http_mocks",
"//test/mocks/local_info:local_info_mocks",
"//test/mocks/runtime:runtime_mocks",
Expand Down