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
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ using ::google::cloud::golden_v1_mocks::MockGoldenKitchenSinkConnection;
using ::google::cloud::testing_util::StatusIs;
using ::testing::Return;

#ifdef GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
using ::google::cloud::testing_util::DisableTracing;
using ::google::cloud::testing_util::EnableTracing;
using ::google::cloud::testing_util::InstallSpanCatcher;
Expand Down Expand Up @@ -376,20 +375,6 @@ TEST(MakeGoldenKitchenSinkTracingConnection, TracingDisabled) {
EXPECT_THAT(spans, IsEmpty());
}

#else

TEST(MakeGoldenKitchenSinkTracingConnection, NoOpenTelemetry) {
auto mock = std::make_shared<MockGoldenKitchenSinkConnection>();
EXPECT_CALL(*mock, DoNothing)
.WillOnce(Return(internal::AbortedError("fail")));

auto under_test = MakeGoldenKitchenSinkTracingConnection(mock);
auto result = under_test->DoNothing({});
EXPECT_THAT(result, StatusIs(StatusCode::kAborted));
}

#endif // GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY

} // namespace
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
} // namespace golden_v1_internal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ namespace {
using ::google::cloud::testing_util::StatusIs;
using ::testing::Return;

#ifdef GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY

using ::google::cloud::testing_util::InstallSpanCatcher;
using ::google::cloud::testing_util::OTelAttribute;
using ::google::cloud::testing_util::OTelContextCaptured;
Expand Down Expand Up @@ -489,21 +487,6 @@ TEST(MakeGoldenKitchenSinkTracingStub, OpenTelemetry) {
EXPECT_THAT(spans, Not(IsEmpty()));
}

#else

TEST(MakeGoldenKitchenSinkTracingStub, NoOpenTelemetry) {
auto mock = std::make_shared<MockGoldenKitchenSinkStub>();
EXPECT_CALL(*mock, DoNothing)
.WillOnce(Return(internal::AbortedError("fail")));

auto under_test = MakeGoldenKitchenSinkTracingStub(mock);
grpc::ClientContext context;
auto result = under_test->DoNothing(context, Options{}, {});
EXPECT_THAT(result, StatusIs(StatusCode::kAborted));
}

#endif // GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY

} // namespace
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
} // namespace golden_v1_internal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1617,7 +1617,6 @@ TEST(GoldenThingAdminConnectionTest, CheckExpectedOptions) {
Contains(ContainsRegex("Unexpected option.+UnexpectedOption")));
}

#ifdef GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
using ::google::cloud::testing_util::DisableTracing;
using ::google::cloud::testing_util::EnableTracing;
using ::google::cloud::testing_util::SpanNamed;
Expand Down Expand Up @@ -1662,9 +1661,6 @@ TEST(GoldenThingAdminConnectionTest, TracingDisabled) {
Not(Contains(SpanNamed(
"golden_v1::GoldenThingAdminConnection::DeleteBackup"))));
}

#endif // GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY

} // namespace
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
} // namespace golden_v1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1678,7 +1678,6 @@ TEST(GoldenThingAdminConnectionTest, ConnectionCreatedWithOption) {
EXPECT_THAT(conn->options().get<EndpointOption>(), Eq("foo"));
}

#ifdef GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
using ::google::cloud::testing_util::DisableTracing;
using ::google::cloud::testing_util::EnableTracing;
using ::google::cloud::testing_util::SpanNamed;
Expand Down Expand Up @@ -1723,8 +1722,6 @@ TEST(GoldenThingAdminConnectionTest, TracingDisabled) {
Not(Contains(SpanNamed(
"golden_v1::GoldenThingAdminConnection::DeleteBackup"))));
}
#endif // GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY

} // namespace
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
} // namespace golden_v1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ using ::google::cloud::golden_v1_mocks::MockGoldenThingAdminConnection;
using ::google::cloud::testing_util::StatusIs;
using ::testing::Return;

#ifdef GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
using ::google::cloud::testing_util::DisableTracing;
using ::google::cloud::testing_util::EnableTracing;
using ::google::cloud::testing_util::InstallSpanCatcher;
Expand Down Expand Up @@ -702,20 +701,6 @@ TEST(MakeGoldenThingAdminTracingConnection, TracingDisabled) {
EXPECT_THAT(spans, IsEmpty());
}

#else

TEST(MakeGoldenThingAdminTracingConnection, NoOpenTelemetry) {
auto mock = std::make_shared<MockGoldenThingAdminConnection>();
EXPECT_CALL(*mock, DropDatabase)
.WillOnce(Return(internal::AbortedError("fail")));

auto under_test = MakeGoldenThingAdminTracingConnection(mock);
auto result = under_test->DropDatabase({});
EXPECT_THAT(result, StatusIs(StatusCode::kAborted));
}

#endif // GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY

} // namespace
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
} // namespace golden_v1_internal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ namespace golden_v1_internal {
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
namespace {

#ifdef GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY

using ::google::cloud::testing_util::InstallSpanCatcher;
using ::google::cloud::testing_util::OTelAttribute;
using ::google::cloud::testing_util::OTelContextCaptured;
Expand Down Expand Up @@ -698,24 +696,6 @@ TEST(MakeGoldenThingAdminTracingStub, OpenTelemetry) {
EXPECT_THAT(spans, Not(IsEmpty()));
}

#else

using ::google::cloud::testing_util::StatusIs;
using ::testing::Return;

TEST(MakeGoldenThingAdminTracingStub, NoOpenTelemetry) {
auto mock = std::make_shared<MockGoldenThingAdminStub>();
EXPECT_CALL(*mock, DropDatabase)
.WillOnce(Return(internal::AbortedError("fail")));

auto under_test = MakeGoldenThingAdminTracingStub(mock);
grpc::ClientContext context;
auto result = under_test->DropDatabase(context, Options{}, {});
EXPECT_THAT(result, StatusIs(StatusCode::kAborted));
}

#endif // GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY

} // namespace
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
} // namespace golden_v1_internal
Expand Down
4 changes: 0 additions & 4 deletions google/cloud/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@ cc_library(
name = "google_cloud_cpp_common_private",
srcs = google_cloud_cpp_common_srcs + ["internal/build_info.cc"],
hdrs = google_cloud_cpp_common_hdrs,
defines = [
# Enable OpenTelemetry features in google-cloud-cpp
"GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY",
],
linkopts = select({
"@platforms//os:windows": [
"-DEFAULTLIB:bcrypt.lib",
Expand Down
2 changes: 0 additions & 2 deletions google/cloud/bigtable/data_connection_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ TEST(MakeDataConnection, DefaultsOptions) {
<< "User supplied Options are overridden in MakeDataConnection()";
}

#ifdef GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
using ::google::cloud::testing_util::DisableTracing;
using ::google::cloud::testing_util::EnableTracing;
using ::google::cloud::testing_util::SpanNamed;
Expand All @@ -81,7 +80,6 @@ TEST(MakeDataConnection, TracingDisabled) {

EXPECT_THAT(span_catcher->GetSpans(), IsEmpty());
}
#endif // GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY

} // namespace
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Expand Down
2 changes: 0 additions & 2 deletions google/cloud/bigtable/internal/async_bulk_apply_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1119,7 +1119,6 @@ TEST_F(AsyncBulkApplyTest, BigtableCookie) {
CheckFailedMutations(actual.get(), expected);
}

#ifdef GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
using ::google::cloud::testing_util::EnableTracing;
using ::google::cloud::testing_util::IsActive;
using ::google::cloud::testing_util::SpanNamed;
Expand Down Expand Up @@ -1191,7 +1190,6 @@ TEST_F(AsyncBulkApplyTest, CallSpanActiveThroughout) {
auto overlay = opentelemetry::trace::Scope(internal::MakeSpan("overlay"));
(void)f.get();
}
#endif // GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY

} // namespace
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Expand Down
2 changes: 0 additions & 2 deletions google/cloud/bigtable/internal/async_row_reader_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1733,7 +1733,6 @@ TEST_F(AsyncRowReaderTest, BigtableCookie) {
std::make_shared<OperationContext>());
}

#ifdef GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
using ::google::cloud::testing_util::EnableTracing;
using ::google::cloud::testing_util::IsActive;
using ::google::cloud::testing_util::SpanNamed;
Expand Down Expand Up @@ -1811,7 +1810,6 @@ TEST_F(AsyncRowReaderTest, CallSpanActiveThroughout) {
// Block until the async call has completed.
p.get_future().get();
}
#endif // GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
} // namespace
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
} // namespace bigtable_internal
Expand Down
2 changes: 0 additions & 2 deletions google/cloud/bigtable/internal/async_row_sampler_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,6 @@ TEST_F(AsyncSampleRowKeysTest, BigtableCookie) {
EXPECT_THAT(sor, StatusIs(StatusCode::kPermissionDenied, HasSubstr("fail")));
}

#ifdef GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
using ::google::cloud::testing_util::EnableTracing;
using ::google::cloud::testing_util::IsActive;
using ::google::cloud::testing_util::SpanNamed;
Expand Down Expand Up @@ -838,7 +837,6 @@ TEST_F(AsyncSampleRowKeysTest, CallSpanActiveThroughout) {
auto overlay = opentelemetry::trace::Scope(internal::MakeSpan("overlay"));
(void)f.get();
}
#endif // GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY

} // namespace
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,6 @@ TEST(BigtableStubFactory, FeaturesFlags) {
(void)stub->MutateRow(context, Options{}, {});
}

#ifdef GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
using ::google::cloud::testing_util::DisableTracing;
using ::google::cloud::testing_util::EnableTracing;
using ::google::cloud::testing_util::SpanNamed;
Expand Down Expand Up @@ -335,7 +334,6 @@ TEST(BigtableStubFactory, TracingDisabled) {

EXPECT_THAT(span_catcher->GetSpans(), IsEmpty());
}
#endif // GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY

} // namespace
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Expand Down
10 changes: 0 additions & 10 deletions google/cloud/bigtable/internal/data_tracing_connection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ namespace cloud {
namespace bigtable_internal {
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN

#ifdef GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
namespace {

std::vector<bigtable::FailedMutation> EndBulkApplySpan(
Expand Down Expand Up @@ -215,15 +214,6 @@ std::shared_ptr<bigtable::DataConnection> MakeDataTracingConnection(
return std::make_shared<DataTracingConnection>(std::move(conn));
}

#else

std::shared_ptr<bigtable::DataConnection> MakeDataTracingConnection(
std::shared_ptr<bigtable::DataConnection> conn) {
return conn;
}

#endif // GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
} // namespace bigtable_internal
} // namespace cloud
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ namespace bigtable_internal {
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
namespace {

#ifdef GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
using ::google::cloud::bigtable_mocks::MockDataConnection;
using ::google::cloud::testing_util::InstallSpanCatcher;
using ::google::cloud::testing_util::IsOkAndHolds;
Expand Down Expand Up @@ -641,7 +640,6 @@ TEST(DataTracingConnection, AsyncReadRowFailure) {
Not(SpanHasAttributes(
OTelAttribute<bool>("gcloud.bigtable.row_found", _))))));
}
#endif // GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY

} // namespace
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Expand Down
2 changes: 0 additions & 2 deletions google/cloud/bigtable/internal/mutate_rows_limiter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@ TEST(MakeMutateRowsLimiter, LoggingDisabled) {
}
}

#ifdef GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
using ::google::cloud::testing_util::DisableTracing;
using ::google::cloud::testing_util::EnableTracing;
using ::google::cloud::testing_util::MockCompletionQueueImpl;
Expand Down Expand Up @@ -353,7 +352,6 @@ TEST(MakeMutateRowsLimiter, TracingDisabledAsync) {
EXPECT_THAT(span_catcher->GetSpans(), IsEmpty());
}
}
#endif // GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY

} // namespace
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Expand Down
2 changes: 0 additions & 2 deletions google/cloud/bigtable/internal/traced_row_reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifdef GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
#include "google/cloud/bigtable/internal/traced_row_reader.h"
#include "google/cloud/internal/opentelemetry.h"

Expand Down Expand Up @@ -72,4 +71,3 @@ GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
} // namespace bigtable_internal
} // namespace cloud
} // namespace google
#endif // GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
2 changes: 0 additions & 2 deletions google/cloud/bigtable/internal/traced_row_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGTABLE_INTERNAL_TRACED_ROW_READER_H
#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGTABLE_INTERNAL_TRACED_ROW_READER_H

#ifdef GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
#include "google/cloud/bigtable/row_reader.h"

namespace google {
Expand All @@ -36,6 +35,5 @@ GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
} // namespace bigtable_internal
} // namespace cloud
} // namespace google
#endif // GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY

#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGTABLE_INTERNAL_TRACED_ROW_READER_H
2 changes: 0 additions & 2 deletions google/cloud/bigtable/internal/traced_row_reader_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifdef GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
#include "google/cloud/bigtable/internal/traced_row_reader.h"
#include "google/cloud/bigtable/mocks/mock_row_reader.h"
#include "google/cloud/internal/make_status.h"
Expand Down Expand Up @@ -151,4 +150,3 @@ GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
} // namespace bigtable_internal
} // namespace cloud
} // namespace google
#endif // GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
2 changes: 0 additions & 2 deletions google/cloud/bigtable/row_reader_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ TEST(RowReaderTest, OptionsSpan) {
}
}

#ifdef GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
using ::google::cloud::testing_util::IsActive;

TEST(RowReader, CallSpanActiveThroughout) {
Expand Down Expand Up @@ -121,7 +120,6 @@ TEST(RowReader, CallSpanActiveThroughout) {
EXPECT_STATUS_OK(row);
}
}
#endif // GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY

} // anonymous namespace
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Expand Down
4 changes: 0 additions & 4 deletions google/cloud/google_cloud_cpp_common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,6 @@ if (opentelemetry IN_LIST GOOGLE_CLOUD_CPP_ENABLE)
if (opentelemetry-cpp_FOUND)
target_link_libraries(google_cloud_cpp_common
PUBLIC opentelemetry-cpp::api)
target_compile_definitions(
google_cloud_cpp_common
PUBLIC # Enable OpenTelemetry features in google-cloud-cpp
GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY)
set(GOOGLE_CLOUD_CPP_FIND_OPTIONAL_DEPENDENCIES
"find_dependency(opentelemetry-cpp)")
set(GOOGLE_CLOUD_CPP_OPENTELEMETRY_API "opentelemetry_api")
Expand Down
4 changes: 0 additions & 4 deletions google/cloud/internal/async_connection_ready_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ TEST(CompletionQueueTest, SuccessfulWaitingForConnection) {
cli_thread.join();
}

#ifdef GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY

TEST(CompletionQueueTest, PropagateCallContext) {
auto span_catcher = testing_util::InstallSpanCatcher();

Expand Down Expand Up @@ -137,8 +135,6 @@ TEST(CompletionQueueTest, PropagateCallContext) {
t.join();
}

#endif // GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY

} // namespace
} // namespace internal
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Expand Down
Loading