Skip to content

Commit 350e1c2

Browse files
committed
feat: remove ifdef GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY from generator and golden tests
1 parent 76d84d7 commit 350e1c2

File tree

6 files changed

+0
-34
lines changed

6 files changed

+0
-34
lines changed

generator/integration_tests/tests/golden_kitchen_sink_connection_test.cc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,6 @@ TEST(GoldenKitchenSinkConnectionTest, CheckExpectedOptions) {
371371
Contains(ContainsRegex("Unexpected option.+UnexpectedOption")));
372372
}
373373

374-
#ifdef GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
375374
using ::google::cloud::testing_util::DisableTracing;
376375
using ::google::cloud::testing_util::EnableTracing;
377376
using ::google::cloud::testing_util::SpanNamed;
@@ -417,8 +416,6 @@ TEST(GoldenKitchenSinkConnectionTest, TracingDisabled) {
417416
"golden_v1::GoldenKitchenSinkConnection::DoNothing"))));
418417
}
419418

420-
#endif // GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
421-
422419
} // namespace
423420
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
424421
} // namespace golden_v1

generator/integration_tests/tests/golden_kitchen_sink_rest_connection_test.cc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,6 @@ TEST(GoldenKitchenSinkConnectionTest, CheckExpectedOptions) {
329329
Contains(ContainsRegex("Unexpected option.+UnexpectedOption")));
330330
}
331331

332-
#ifdef GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
333332
using ::google::cloud::testing_util::DisableTracing;
334333
using ::google::cloud::testing_util::EnableTracing;
335334
using ::google::cloud::testing_util::SpanNamed;
@@ -374,8 +373,6 @@ TEST(GoldenKitchenSinkConnectionTest, TracingDisabled) {
374373
Not(Contains(SpanNamed(
375374
"golden_v1::GoldenKitchenSinkConnection::DoNothing"))));
376375
}
377-
#endif // GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
378-
379376
} // namespace
380377
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
381378
} // namespace golden_v1

generator/integration_tests/tests/golden_kitchen_sink_stub_factory_test.cc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ TEST(GoldenKitchenSinkStubFactoryTest, DefaultStubWithAuth) {
7171
EXPECT_THAT(response, StatusIs(StatusCode::kAborted, "fail"));
7272
}
7373

74-
#ifdef GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
7574
using ::google::cloud::testing_util::DisableTracing;
7675
using ::google::cloud::testing_util::EnableTracing;
7776
using ::google::cloud::testing_util::SpanNamed;
@@ -108,8 +107,6 @@ TEST(GoldenKitchenSinkStubFactoryTest, DefaultStubWithTracingDisabled) {
108107
"google.test.admin.database.v1.GoldenKitchenSink/DoNothing"))));
109108
}
110109

111-
#endif // GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
112-
113110
} // namespace
114111
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
115112
} // namespace golden_v1_internal

generator/integration_tests/tests/golden_thing_admin_stub_factory_test.cc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ TEST(GoldenStubFactoryTest, DefaultStubWithAuth) {
7171
EXPECT_THAT(response, StatusIs(StatusCode::kAborted, "fail"));
7272
}
7373

74-
#ifdef GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
7574
using ::google::cloud::testing_util::DisableTracing;
7675
using ::google::cloud::testing_util::EnableTracing;
7776
using ::google::cloud::testing_util::SpanNamed;
@@ -109,8 +108,6 @@ TEST(GoldenStubFactoryTest, DefaultStubWithTracingDisabled) {
109108
"google.test.admin.database.v1.GoldenThingAdmin/DeleteBackup"))));
110109
}
111110

112-
#endif // GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
113-
114111
} // namespace
115112
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
116113
} // namespace golden_v1_internal

generator/internal/tracing_connection_generator.cc

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ Status TracingConnectionGenerator::GenerateHeader() {
5757
if (!result.ok()) return result;
5858

5959
HeaderPrint(R"""(
60-
#ifdef GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
61-
6260
class $tracing_connection_class_name$
6361
: public $product_namespace$::$connection_class_name$ {
6462
public:
@@ -87,8 +85,6 @@ class $tracing_connection_class_name$
8785
std::shared_ptr<$product_namespace$::$connection_class_name$> child_;
8886
};
8987
90-
#endif // GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
91-
9288
/**
9389
* Conditionally applies the tracing decorator to the given connection.
9490
*
@@ -130,8 +126,6 @@ Status TracingConnectionGenerator::GenerateCc() {
130126
if (!result.ok()) return result;
131127

132128
CcPrint(R"""(
133-
#ifdef GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
134-
135129
$tracing_connection_class_name$::$tracing_connection_class_name$(
136130
std::shared_ptr<$product_namespace$::$connection_class_name$> child)
137131
: child_(std::move(child)) {}
@@ -148,16 +142,12 @@ Status TracingConnectionGenerator::GenerateCc() {
148142
}
149143

150144
CcPrint(R"""(
151-
#endif // GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
152-
153145
std::shared_ptr<$product_namespace$::$connection_class_name$>
154146
Make$tracing_connection_class_name$(
155147
std::shared_ptr<$product_namespace$::$connection_class_name$> conn) {
156-
#ifdef GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
157148
if (internal::TracingEnabled(conn->options())) {
158149
conn = std::make_shared<$tracing_connection_class_name$>(std::move(conn));
159150
}
160-
#endif // GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
161151
return conn;
162152
}
163153
)""");

generator/internal/tracing_stub_generator.cc

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ Status TracingStubGenerator::GenerateHeader() {
5757
// Tracing stub class definition
5858
HeaderPrint(
5959
R"""(
60-
#ifdef GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
61-
6260
class $tracing_stub_class_name$ : public $stub_class_name$ {
6361
public:
6462
~$tracing_stub_class_name$() override = default;
@@ -74,8 +72,6 @@ class $tracing_stub_class_name$ : public $stub_class_name$ {
7472
std::shared_ptr<opentelemetry::context::propagation::TextMapPropagator> propagator_;
7573
};
7674
77-
#endif // GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
78-
7975
/**
8076
* Applies the tracing decorator to the given stub.
8177
*
@@ -129,8 +125,6 @@ Status TracingStubGenerator::GenerateCc() {
129125
// constructor
130126
CcPrint(
131127
R"""(
132-
#ifdef GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
133-
134128
$tracing_stub_class_name$::$tracing_stub_class_name$(
135129
std::shared_ptr<$stub_class_name$> child)
136130
: child_(std::move(child)), propagator_(internal::MakePropagator()) {}
@@ -346,15 +340,9 @@ future<Status> $tracing_stub_class_name$::AsyncCancelOperation(
346340
}
347341

348342
CcPrint(R"""(
349-
#endif // GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
350-
351343
std::shared_ptr<$stub_class_name$> Make$tracing_stub_class_name$(
352344
std::shared_ptr<$stub_class_name$> stub) {
353-
#ifdef GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
354345
return std::make_shared<$tracing_stub_class_name$>(std::move(stub));
355-
#else
356-
return stub;
357-
#endif // GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
358346
}
359347
)""");
360348
CcCloseNamespaces();

0 commit comments

Comments
 (0)