Skip to content

Commit 76d84d7

Browse files
authored
feat: mark opentelemetry as required in build files (#15830)
1 parent 42aae3c commit 76d84d7

File tree

13 files changed

+21
-171
lines changed

13 files changed

+21
-171
lines changed

.bazelrc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@ build --experimental_ui_max_stdouterr_bytes=-1
5454
# in a random order to help expose undesirable interdependencies.
5555
test --test_env=GTEST_SHUFFLE --test_env=GTEST_RANDOM_SEED
5656

57-
# By default, build the library with OpenTelemetry
58-
build --//:enable_opentelemetry
59-
6057
# Don't show warnings when building external dependencies. This still shows
6158
# warnings when using these dependencies (say in headers).
6259
build --output_filter='^//((?!(external):).)*$'

BUILD.bazel

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,3 @@ cc_library(
254254
"//google/cloud:google_cloud_cpp_universe_domain",
255255
],
256256
)
257-
258-
bool_flag(
259-
name = "enable_opentelemetry",
260-
build_setting_default = False,
261-
)

bazel/workspace0.bzl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,7 @@ def gl_cpp_workspace0(name = None):
274274
)
275275

276276
# Open Telemetry
277-
maybe(
278-
http_archive,
277+
http_archive(
279278
name = "opentelemetry-cpp",
280279
urls = [
281280
"https://github.com/open-telemetry/opentelemetry-cpp/archive/v1.20.0.tar.gz",
-164 KB
Binary file not shown.

ci/cloudbuild/builds/otel-disabled-bazel.sh

Lines changed: 0 additions & 37 deletions
This file was deleted.

ci/cloudbuild/triggers/otel-disabled-bazel-ci.yaml

Lines changed: 0 additions & 28 deletions
This file was deleted.

ci/cloudbuild/triggers/otel-disabled-bazel-pr.yaml

Lines changed: 0 additions & 29 deletions
This file was deleted.

cmake/GoogleCloudCppFeatures.cmake

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,8 @@ export_libraries_bzl()
302302
# other feature, or even if no features are enabled.
303303
# ~~~
304304
macro (google_cloud_cpp_enable_deps)
305-
find_package(opentelemetry-cpp CONFIG)
305+
list(APPEND GOOGLE_CLOUD_CPP_ENABLE monitoring trace opentelemetry
306+
universe_domain)
306307
if (__ga_libraries__ IN_LIST GOOGLE_CLOUD_CPP_ENABLE)
307308
list(APPEND GOOGLE_CLOUD_CPP_ENABLE ${GOOGLE_CLOUD_CPP_GA_LIBRARIES})
308309
list(APPEND GOOGLE_CLOUD_CPP_ENABLE
@@ -341,11 +342,6 @@ macro (google_cloud_cpp_enable_deps)
341342
if (asset IN_LIST GOOGLE_CLOUD_CPP_ENABLE)
342343
list(INSERT GOOGLE_CLOUD_CPP_ENABLE 0 accesscontextmanager osconfig)
343344
endif ()
344-
if (bigtable IN_LIST GOOGLE_CLOUD_CPP_ENABLE)
345-
if (opentelemetry-cpp_FOUND)
346-
list(INSERT GOOGLE_CLOUD_CPP_ENABLE 0 opentelemetry)
347-
endif ()
348-
endif ()
349345
if (contentwarehouse IN_LIST GOOGLE_CLOUD_CPP_ENABLE)
350346
list(INSERT GOOGLE_CLOUD_CPP_ENABLE 0 documentai)
351347
endif ()
@@ -360,9 +356,6 @@ macro (google_cloud_cpp_enable_deps)
360356
OR (experimental-storage_grpc IN_LIST GOOGLE_CLOUD_CPP_ENABLE))
361357
list(INSERT GOOGLE_CLOUD_CPP_ENABLE 0 storage)
362358
endif ()
363-
if (opentelemetry IN_LIST GOOGLE_CLOUD_CPP_ENABLE)
364-
list(INSERT GOOGLE_CLOUD_CPP_ENABLE 0 monitoring trace opentelemetry)
365-
endif ()
366359
endmacro ()
367360

368361
# Cleanup the "GOOGLE_CLOUD_CPP_ENABLE" variable. Remove duplicates, and set

generator/integration_tests/tests/request_id_tracing_stub_test.cc

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#ifdef GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
16-
1715
#include "generator/integration_tests/golden/v1/internal/request_id_tracing_stub.h"
1816
#include "generator/integration_tests/golden/v1/internal/request_id_connection_impl.h"
1917
#include "generator/integration_tests/golden/v1/internal/request_id_option_defaults.h"
@@ -39,27 +37,16 @@ namespace {
3937
using ::google::cloud::golden_v1_testing::MockRequestIdServiceStub;
4038
using ::google::cloud::testing_util::InstallSpanCatcher;
4139
using ::google::cloud::testing_util::OTelAttribute;
42-
using ::google::cloud::testing_util::OTelContextCaptured;
4340
using ::google::cloud::testing_util::SpanHasAttributes;
44-
using ::google::cloud::testing_util::SpanHasInstrumentationScope;
45-
using ::google::cloud::testing_util::SpanKindIsClient;
4641
using ::google::cloud::testing_util::SpanNamed;
47-
using ::google::cloud::testing_util::SpanWithStatus;
4842
using ::google::cloud::testing_util::ThereIsAnActiveSpan;
4943
using ::google::cloud::testing_util::ValidatePropagator;
5044
using ::google::test::requestid::v1::CreateFooRequest;
5145
using ::google::test::requestid::v1::Foo;
52-
using ::google::test::requestid::v1::ListFoosRequest;
53-
using ::google::test::requestid::v1::ListFoosResponse;
5446
using ::google::test::requestid::v1::RenameFooRequest;
55-
using ::testing::_;
56-
using ::testing::ByMove;
5747
using ::testing::ElementsAre;
58-
using ::testing::Eq;
5948
using ::testing::IsEmpty;
6049
using ::testing::Not;
61-
using ::testing::ResultOf;
62-
using ::testing::Return;
6350

6451
Status TransientError() {
6552
return Status(StatusCode::kUnavailable, "try-again");
@@ -214,5 +201,3 @@ GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
214201
} // namespace golden_v1
215202
} // namespace cloud
216203
} // namespace google
217-
218-
#endif // GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY

google/cloud/BUILD.bazel

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,6 @@ capture_build_info(
4444
],
4545
)
4646

47-
config_setting(
48-
name = "enable_opentelemetry",
49-
flag_values = {
50-
"//:enable_opentelemetry": "true",
51-
},
52-
)
53-
5447
filegroup(
5548
name = "common_hdrs",
5649
srcs = [h for h in google_cloud_cpp_common_hdrs if not h.startswith("internal/")],
@@ -61,13 +54,10 @@ cc_library(
6154
name = "google_cloud_cpp_common_private",
6255
srcs = google_cloud_cpp_common_srcs + ["internal/build_info.cc"],
6356
hdrs = google_cloud_cpp_common_hdrs,
64-
defines = select({
65-
":enable_opentelemetry": [
66-
# Enable OpenTelemetry features in google-cloud-cpp
67-
"GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY",
68-
],
69-
"//conditions:default": [],
70-
}),
57+
defines = [
58+
# Enable OpenTelemetry features in google-cloud-cpp
59+
"GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY",
60+
],
7161
linkopts = select({
7262
"@platforms//os:windows": [
7363
"-DEFAULTLIB:bcrypt.lib",
@@ -94,12 +84,8 @@ cc_library(
9484
"@abseil-cpp//absl/types:optional",
9585
"@abseil-cpp//absl/types:span",
9686
"@abseil-cpp//absl/types:variant",
87+
"@opentelemetry-cpp//api",
9788
] + select({
98-
":enable_opentelemetry": [
99-
"@opentelemetry-cpp//api",
100-
],
101-
"//conditions:default": [],
102-
}) + select({
10389
"@platforms//os:windows": [],
10490
"//conditions:default": [
10591
"@boringssl//:crypto",

0 commit comments

Comments
 (0)