Skip to content

Commit 67720cd

Browse files
authored
feat: remove ifdef opentelemetry statements in handwritten libs (#15838)
* feat: remove ifdef opentelemetry statements in handwritten libs
1 parent febba47 commit 67720cd

File tree

145 files changed

+11
-823
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

145 files changed

+11
-823
lines changed

generator/integration_tests/tests/golden_kitchen_sink_tracing_connection_test.cc

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ using ::google::cloud::golden_v1_mocks::MockGoldenKitchenSinkConnection;
3232
using ::google::cloud::testing_util::StatusIs;
3333
using ::testing::Return;
3434

35-
#ifdef GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
3635
using ::google::cloud::testing_util::DisableTracing;
3736
using ::google::cloud::testing_util::EnableTracing;
3837
using ::google::cloud::testing_util::InstallSpanCatcher;
@@ -376,20 +375,6 @@ TEST(MakeGoldenKitchenSinkTracingConnection, TracingDisabled) {
376375
EXPECT_THAT(spans, IsEmpty());
377376
}
378377

379-
#else
380-
381-
TEST(MakeGoldenKitchenSinkTracingConnection, NoOpenTelemetry) {
382-
auto mock = std::make_shared<MockGoldenKitchenSinkConnection>();
383-
EXPECT_CALL(*mock, DoNothing)
384-
.WillOnce(Return(internal::AbortedError("fail")));
385-
386-
auto under_test = MakeGoldenKitchenSinkTracingConnection(mock);
387-
auto result = under_test->DoNothing({});
388-
EXPECT_THAT(result, StatusIs(StatusCode::kAborted));
389-
}
390-
391-
#endif // GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
392-
393378
} // namespace
394379
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
395380
} // namespace golden_v1_internal

generator/integration_tests/tests/golden_kitchen_sink_tracing_stub_test.cc

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ namespace {
3333
using ::google::cloud::testing_util::StatusIs;
3434
using ::testing::Return;
3535

36-
#ifdef GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
37-
3836
using ::google::cloud::testing_util::InstallSpanCatcher;
3937
using ::google::cloud::testing_util::OTelAttribute;
4038
using ::google::cloud::testing_util::OTelContextCaptured;
@@ -489,21 +487,6 @@ TEST(MakeGoldenKitchenSinkTracingStub, OpenTelemetry) {
489487
EXPECT_THAT(spans, Not(IsEmpty()));
490488
}
491489

492-
#else
493-
494-
TEST(MakeGoldenKitchenSinkTracingStub, NoOpenTelemetry) {
495-
auto mock = std::make_shared<MockGoldenKitchenSinkStub>();
496-
EXPECT_CALL(*mock, DoNothing)
497-
.WillOnce(Return(internal::AbortedError("fail")));
498-
499-
auto under_test = MakeGoldenKitchenSinkTracingStub(mock);
500-
grpc::ClientContext context;
501-
auto result = under_test->DoNothing(context, Options{}, {});
502-
EXPECT_THAT(result, StatusIs(StatusCode::kAborted));
503-
}
504-
505-
#endif // GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
506-
507490
} // namespace
508491
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
509492
} // namespace golden_v1_internal

generator/integration_tests/tests/golden_thing_admin_connection_test.cc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1617,7 +1617,6 @@ TEST(GoldenThingAdminConnectionTest, CheckExpectedOptions) {
16171617
Contains(ContainsRegex("Unexpected option.+UnexpectedOption")));
16181618
}
16191619

1620-
#ifdef GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
16211620
using ::google::cloud::testing_util::DisableTracing;
16221621
using ::google::cloud::testing_util::EnableTracing;
16231622
using ::google::cloud::testing_util::SpanNamed;
@@ -1662,9 +1661,6 @@ TEST(GoldenThingAdminConnectionTest, TracingDisabled) {
16621661
Not(Contains(SpanNamed(
16631662
"golden_v1::GoldenThingAdminConnection::DeleteBackup"))));
16641663
}
1665-
1666-
#endif // GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
1667-
16681664
} // namespace
16691665
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
16701666
} // namespace golden_v1

generator/integration_tests/tests/golden_thing_admin_rest_connection_test.cc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1678,7 +1678,6 @@ TEST(GoldenThingAdminConnectionTest, ConnectionCreatedWithOption) {
16781678
EXPECT_THAT(conn->options().get<EndpointOption>(), Eq("foo"));
16791679
}
16801680

1681-
#ifdef GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
16821681
using ::google::cloud::testing_util::DisableTracing;
16831682
using ::google::cloud::testing_util::EnableTracing;
16841683
using ::google::cloud::testing_util::SpanNamed;
@@ -1723,8 +1722,6 @@ TEST(GoldenThingAdminConnectionTest, TracingDisabled) {
17231722
Not(Contains(SpanNamed(
17241723
"golden_v1::GoldenThingAdminConnection::DeleteBackup"))));
17251724
}
1726-
#endif // GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
1727-
17281725
} // namespace
17291726
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
17301727
} // namespace golden_v1

generator/integration_tests/tests/golden_thing_admin_tracing_connection_test.cc

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ using ::google::cloud::golden_v1_mocks::MockGoldenThingAdminConnection;
3232
using ::google::cloud::testing_util::StatusIs;
3333
using ::testing::Return;
3434

35-
#ifdef GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
3635
using ::google::cloud::testing_util::DisableTracing;
3736
using ::google::cloud::testing_util::EnableTracing;
3837
using ::google::cloud::testing_util::InstallSpanCatcher;
@@ -702,20 +701,6 @@ TEST(MakeGoldenThingAdminTracingConnection, TracingDisabled) {
702701
EXPECT_THAT(spans, IsEmpty());
703702
}
704703

705-
#else
706-
707-
TEST(MakeGoldenThingAdminTracingConnection, NoOpenTelemetry) {
708-
auto mock = std::make_shared<MockGoldenThingAdminConnection>();
709-
EXPECT_CALL(*mock, DropDatabase)
710-
.WillOnce(Return(internal::AbortedError("fail")));
711-
712-
auto under_test = MakeGoldenThingAdminTracingConnection(mock);
713-
auto result = under_test->DropDatabase({});
714-
EXPECT_THAT(result, StatusIs(StatusCode::kAborted));
715-
}
716-
717-
#endif // GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
718-
719704
} // namespace
720705
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
721706
} // namespace golden_v1_internal

generator/integration_tests/tests/golden_thing_admin_tracing_stub_test.cc

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ namespace golden_v1_internal {
2626
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
2727
namespace {
2828

29-
#ifdef GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
30-
3129
using ::google::cloud::testing_util::InstallSpanCatcher;
3230
using ::google::cloud::testing_util::OTelAttribute;
3331
using ::google::cloud::testing_util::OTelContextCaptured;
@@ -698,24 +696,6 @@ TEST(MakeGoldenThingAdminTracingStub, OpenTelemetry) {
698696
EXPECT_THAT(spans, Not(IsEmpty()));
699697
}
700698

701-
#else
702-
703-
using ::google::cloud::testing_util::StatusIs;
704-
using ::testing::Return;
705-
706-
TEST(MakeGoldenThingAdminTracingStub, NoOpenTelemetry) {
707-
auto mock = std::make_shared<MockGoldenThingAdminStub>();
708-
EXPECT_CALL(*mock, DropDatabase)
709-
.WillOnce(Return(internal::AbortedError("fail")));
710-
711-
auto under_test = MakeGoldenThingAdminTracingStub(mock);
712-
grpc::ClientContext context;
713-
auto result = under_test->DropDatabase(context, Options{}, {});
714-
EXPECT_THAT(result, StatusIs(StatusCode::kAborted));
715-
}
716-
717-
#endif // GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
718-
719699
} // namespace
720700
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
721701
} // namespace golden_v1_internal

google/cloud/BUILD.bazel

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,6 @@ cc_library(
5454
name = "google_cloud_cpp_common_private",
5555
srcs = google_cloud_cpp_common_srcs + ["internal/build_info.cc"],
5656
hdrs = google_cloud_cpp_common_hdrs,
57-
defines = [
58-
# Enable OpenTelemetry features in google-cloud-cpp
59-
"GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY",
60-
],
6157
linkopts = select({
6258
"@platforms//os:windows": [
6359
"-DEFAULTLIB:bcrypt.lib",

google/cloud/bigtable/data_connection_test.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ TEST(MakeDataConnection, DefaultsOptions) {
5454
<< "User supplied Options are overridden in MakeDataConnection()";
5555
}
5656

57-
#ifdef GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
5857
using ::google::cloud::testing_util::DisableTracing;
5958
using ::google::cloud::testing_util::EnableTracing;
6059
using ::google::cloud::testing_util::SpanNamed;
@@ -81,7 +80,6 @@ TEST(MakeDataConnection, TracingDisabled) {
8180

8281
EXPECT_THAT(span_catcher->GetSpans(), IsEmpty());
8382
}
84-
#endif // GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
8583

8684
} // namespace
8785
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END

google/cloud/bigtable/internal/async_bulk_apply_test.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,7 +1119,6 @@ TEST_F(AsyncBulkApplyTest, BigtableCookie) {
11191119
CheckFailedMutations(actual.get(), expected);
11201120
}
11211121

1122-
#ifdef GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
11231122
using ::google::cloud::testing_util::EnableTracing;
11241123
using ::google::cloud::testing_util::IsActive;
11251124
using ::google::cloud::testing_util::SpanNamed;
@@ -1191,7 +1190,6 @@ TEST_F(AsyncBulkApplyTest, CallSpanActiveThroughout) {
11911190
auto overlay = opentelemetry::trace::Scope(internal::MakeSpan("overlay"));
11921191
(void)f.get();
11931192
}
1194-
#endif // GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
11951193

11961194
} // namespace
11971195
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END

google/cloud/bigtable/internal/async_row_reader_test.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1733,7 +1733,6 @@ TEST_F(AsyncRowReaderTest, BigtableCookie) {
17331733
std::make_shared<OperationContext>());
17341734
}
17351735

1736-
#ifdef GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
17371736
using ::google::cloud::testing_util::EnableTracing;
17381737
using ::google::cloud::testing_util::IsActive;
17391738
using ::google::cloud::testing_util::SpanNamed;
@@ -1811,7 +1810,6 @@ TEST_F(AsyncRowReaderTest, CallSpanActiveThroughout) {
18111810
// Block until the async call has completed.
18121811
p.get_future().get();
18131812
}
1814-
#endif // GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
18151813
} // namespace
18161814
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
18171815
} // namespace bigtable_internal

0 commit comments

Comments
 (0)