Skip to content

Commit 76f76c1

Browse files
authored
feat(otel): promote OpenTelemetryTracingOption to GA (#12728)
1 parent 9f2e656 commit 76f76c1

File tree

9 files changed

+19
-21
lines changed

9 files changed

+19
-21
lines changed
3.46 KB
Binary file not shown.

google/cloud/internal/opentelemetry.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ void EndSpan(opentelemetry::trace::Span& span) { EndSpanImpl(span, Status{}); }
7676

7777
#ifdef GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY
7878
bool TracingEnabled(Options const& options) {
79-
return options.get<experimental::OpenTelemetryTracingOption>();
79+
return options.get<OpenTelemetryTracingOption>();
8080
}
8181
#else
8282
bool TracingEnabled(Options const&) { return false; }

google/cloud/internal/opentelemetry_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,10 +277,10 @@ TEST(OpenTelemetry, TracingEnabled) {
277277
auto options = Options{};
278278
EXPECT_FALSE(TracingEnabled(options));
279279

280-
options.set<experimental::OpenTelemetryTracingOption>(false);
280+
options.set<OpenTelemetryTracingOption>(false);
281281
EXPECT_FALSE(TracingEnabled(options));
282282

283-
options.set<experimental::OpenTelemetryTracingOption>(true);
283+
options.set<OpenTelemetryTracingOption>(true);
284284
EXPECT_TRUE(TracingEnabled(options));
285285
}
286286

google/cloud/internal/populate_common_options.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Options PopulateCommonOptions(Options opts, std::string const& endpoint_env_var,
6161

6262
e = GetEnv("GOOGLE_CLOUD_CPP_OPENTELEMETRY_TRACING");
6363
if (e && !e->empty()) {
64-
opts.set<experimental::OpenTelemetryTracingOption>(true);
64+
opts.set<OpenTelemetryTracingOption>(true);
6565
}
6666
if (!opts.has<TracingComponentsOption>()) {
6767
opts.set<TracingComponentsOption>(DefaultTracingComponents());
@@ -81,9 +81,9 @@ std::set<std::string> DefaultTracingComponents() {
8181

8282
Options MakeAuthOptions(Options const& options) {
8383
Options opts;
84-
if (options.has<experimental::OpenTelemetryTracingOption>()) {
85-
opts.set<experimental::OpenTelemetryTracingOption>(
86-
options.get<experimental::OpenTelemetryTracingOption>());
84+
if (options.has<OpenTelemetryTracingOption>()) {
85+
opts.set<OpenTelemetryTracingOption>(
86+
options.get<OpenTelemetryTracingOption>());
8787
}
8888
return opts;
8989
}

google/cloud/internal/populate_common_options_test.cc

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,11 @@ TEST(PopulateCommonOptions, OpenTelemetryTracing) {
132132
{"", false},
133133
{"ON", true},
134134
};
135-
auto const input =
136-
Options{}.set<experimental::OpenTelemetryTracingOption>(false);
135+
auto const input = Options{}.set<OpenTelemetryTracingOption>(false);
137136
for (auto const& test : tests) {
138137
ScopedEnvironment env("GOOGLE_CLOUD_CPP_OPENTELEMETRY_TRACING", test.env);
139138
auto options = PopulateCommonOptions(input, {}, {}, {}, {});
140-
EXPECT_EQ(options.get<experimental::OpenTelemetryTracingOption>(),
141-
test.value);
139+
EXPECT_EQ(options.get<OpenTelemetryTracingOption>(), test.value);
142140
}
143141
}
144142

@@ -158,16 +156,16 @@ TEST(MakeAuthOptions, WithoutTracing) {
158156
auto options = Options{}.set<EndpointOption>("endpoint_option");
159157
auto auth_options = MakeAuthOptions(options);
160158
EXPECT_FALSE(auth_options.has<EndpointOption>());
161-
EXPECT_FALSE(auth_options.get<experimental::OpenTelemetryTracingOption>());
159+
EXPECT_FALSE(auth_options.get<OpenTelemetryTracingOption>());
162160
}
163161

164162
TEST(MakeAuthOptions, WithTracing) {
165163
auto options = Options{}
166164
.set<EndpointOption>("endpoint_option")
167-
.set<experimental::OpenTelemetryTracingOption>(true);
165+
.set<OpenTelemetryTracingOption>(true);
168166
auto auth_options = MakeAuthOptions(options);
169167
EXPECT_FALSE(auth_options.has<EndpointOption>());
170-
EXPECT_TRUE(auth_options.get<experimental::OpenTelemetryTracingOption>());
168+
EXPECT_TRUE(auth_options.get<OpenTelemetryTracingOption>());
171169
}
172170

173171
} // namespace

google/cloud/opentelemetry/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ int main(int argc, char* argv[]) {
4646
auto configuration = gc::otel::ConfigureBasicTracing(project);
4747

4848
// Create a client with OpenTelemetry tracing enabled.
49-
auto options =
50-
gc::Options{}.set<gc::experimental::OpenTelemetryTracingOption>(true);
49+
auto options = gc::Options{}.set<gc::OpenTelemetryTracingOption>(true);
5150
auto client = gcs::Client(options);
5251

5352
auto writer = client.WriteObject(bucket_name, "quickstart.txt");

google/cloud/opentelemetry/quickstart/quickstart.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ int main(int argc, char* argv[]) {
3636
auto configuration = gc::otel::ConfigureBasicTracing(project);
3737

3838
// Create a client with OpenTelemetry tracing enabled.
39-
auto options =
40-
gc::Options{}.set<gc::experimental::OpenTelemetryTracingOption>(true);
39+
auto options = gc::Options{}.set<gc::OpenTelemetryTracingOption>(true);
4140
auto client = gcs::Client(options);
4241

4342
auto writer = client.WriteObject(bucket_name, "quickstart.txt");

google/cloud/opentelemetry_options.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
namespace google {
2121
namespace cloud {
2222
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
23-
namespace experimental {
2423

2524
/**
2625
* Enables tracing with [OpenTelemetry]
@@ -79,6 +78,9 @@ struct OpenTelemetryTracingOption {
7978
using Type = bool;
8079
};
8180

81+
namespace experimental {
82+
/// @deprecated Use google::cloud::OpenTelemetryTracingOption instead.
83+
using OpenTelemetryTracingOption = ::google::cloud::OpenTelemetryTracingOption;
8284
} // namespace experimental
8385
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
8486
} // namespace cloud

google/cloud/testing_util/opentelemetry_matchers.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,12 @@ std::shared_ptr<SpanCatcher> InstallSpanCatcher() {
172172
}
173173

174174
Options EnableTracing(Options options) {
175-
options.set<experimental::OpenTelemetryTracingOption>(true);
175+
options.set<OpenTelemetryTracingOption>(true);
176176
return options;
177177
}
178178

179179
Options DisableTracing(Options options) {
180-
options.set<experimental::OpenTelemetryTracingOption>(false);
180+
options.set<OpenTelemetryTracingOption>(false);
181181
return options;
182182
}
183183

0 commit comments

Comments
 (0)