Skip to content

Commit 885b2b3

Browse files
authored
feat(otel): GA for cmake (#12735)
1 parent bcfaa7e commit 885b2b3

File tree

13 files changed

+38
-30
lines changed

13 files changed

+38
-30
lines changed

ci/cloudbuild/builds/cmake-install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ env -C "${out_dir}" ctest "${ctest_args[@]}"
201201
# shellcheck disable=SC2046
202202
feature_list="$(printf "%s;" $(features::libraries))"
203203
# GCS+gRPC and OpenTelemetry also have quickstarts.
204-
feature_list="${feature_list}experimental-storage_grpc;experimental-opentelemetry"
204+
feature_list="${feature_list}experimental-storage_grpc;opentelemetry"
205205
cmake -G Ninja \
206206
-S "${PROJECT_ROOT}/ci/verify_quickstart" \
207207
-B "${PROJECT_ROOT}/cmake-out/quickstart" \

ci/cloudbuild/builds/lib/features.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function features::always_build() {
3939
logging
4040
# Build our code with OpenTelemetry. This feature includes both the client
4141
# library instrumentation, and the GCP exporters.
42-
experimental-opentelemetry
42+
opentelemetry
4343
# Enable storage_grpc in most builds.
4444
experimental-storage_grpc
4545
)
@@ -62,10 +62,10 @@ function features::libraries() {
6262
function features::list_full() {
6363
local feature_list
6464
mapfile -t feature_list < <(features::libraries)
65-
feature_list+=(experimental-opentelemetry experimental-storage_grpc grafeas)
65+
feature_list+=(opentelemetry experimental-storage_grpc grafeas)
6666
printf "%s\n" "${feature_list[@]}" | sort -u
6767
}
6868

6969
function features::list_full_cmake() {
70-
echo "__ga_libraries__,__experimental_libraries__,experimental-storage_grpc,experimental-opentelemetry,experimental-bigquery_rest"
70+
echo "__ga_libraries__,__experimental_libraries__,experimental-storage_grpc,opentelemetry,experimental-bigquery_rest"
7171
}

ci/cloudbuild/builds/publish-docs.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,11 @@ io::log_h2 "Publishing DocFX"
152152
io::log "branch: ${BRANCH_NAME}"
153153
io::log "bucket: gs://${docfx_bucket}"
154154

155-
# Upload the documents for all features, including common. We need to
156-
# rename `experimental-opentelemetry`. Some features do not have documentation,
157-
# such as `experimental-storage_grpc`. These are harmless, as the
158-
# `stage_docfx()`` function skips missing directories without an error.
155+
# Upload the documents for all features, including common. Some features do not
156+
# have documentation, such as `experimental-storage_grpc`. These are harmless,
157+
# as the `stage_docfx()` function skips missing directories without an error.
159158
uploaded=(common)
160-
uploaded+=("${FEATURE_LIST[@]/experimental-opentelemetry/opentelemetry}")
159+
uploaded+=("${FEATURE_LIST[@]}")
161160
echo "${uploaded[@]}" | xargs -P "$(nproc)" -n 1 \
162161
bash -c "TIMEFORMAT=\"\${0} completed in %0lR\";
163162
time ci/retry-command.sh 3 120 stage_docfx \"\${0}\" \"${docfx_bucket}\" cmake-out \"cmake-out/\${0}.docfx.log\""

ci/verify_quickstart/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ foreach (feature IN LISTS FEATURES)
105105
add_make_quickstart_target("${feature}" storage quickstart_grpc)
106106
continue()
107107
endif ()
108-
if ("${feature}" STREQUAL "experimental-opentelemetry")
108+
if ("${feature}" STREQUAL "opentelemetry")
109109
add_cmake_quickstart_target("${feature}" opentelemetry quickstart)
110110
# TODO(#10795) - sort out opentelemetry-cpp pkgconfig
111111
# add_make_quickstart_target("${feature}" opentelemetry quickstart)

cmake/GoogleCloudCppFeatures.cmake

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,14 @@ macro (google_cloud_cpp_enable_deps)
322322
list(INSERT GOOGLE_CLOUD_CPP_ENABLE 0 storage)
323323
endif ()
324324
if (experimental-opentelemetry IN_LIST GOOGLE_CLOUD_CPP_ENABLE)
325+
message(
326+
WARNING
327+
"The feature `experimental-opentelemetry` is deprecated. Please use `opentelemetry` instead."
328+
)
329+
list(REMOVE_ITEM GOOGLE_CLOUD_CPP_ENABLE experimental-opentelemetry)
330+
list(INSERT GOOGLE_CLOUD_CPP_ENABLE 0 opentelemetry)
331+
endif ()
332+
if (opentelemetry IN_LIST GOOGLE_CLOUD_CPP_ENABLE)
325333
list(INSERT GOOGLE_CLOUD_CPP_ENABLE 0 trace)
326334
endif ()
327335
endmacro ()
@@ -357,7 +365,7 @@ macro (google_cloud_cpp_enable_cleanup)
357365
OR (compute IN_LIST GOOGLE_CLOUD_CPP_ENABLE)
358366
OR (compute_features)
359367
OR (experimental-bigquery_rest IN_LIST GOOGLE_CLOUD_CPP_ENABLE)
360-
OR (experimental-opentelemetry IN_LIST GOOGLE_CLOUD_CPP_ENABLE)
368+
OR (opentelemetry IN_LIST GOOGLE_CLOUD_CPP_ENABLE)
361369
OR (sql IN_LIST GOOGLE_CLOUD_CPP_ENABLE)
362370
OR (generator IN_LIST GOOGLE_CLOUD_CPP_ENABLE))
363371
set(GOOGLE_CLOUD_CPP_ENABLE_REST ON)
@@ -385,8 +393,6 @@ function (google_cloud_cpp_enable_features)
385393
endif ()
386394
elseif ("${feature}" STREQUAL "experimental-http-transcoding")
387395
continue()
388-
elseif ("${feature}" STREQUAL "experimental-opentelemetry")
389-
add_subdirectory(google/cloud/opentelemetry)
390396
elseif ("${feature}" MATCHES "^compute_.*")
391397
if (NOT compute_added)
392398
add_subdirectory(google/cloud/compute)

doc/compile-time-configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ customers will need to use these. If you have specific questions please start a
3939
team if you want to use this feature or are interested in the GA timeline.
4040
- `experimental-http-transcoding` enables support for HTTP/1.1 transport (as
4141
opposed to gRPC over HTTP/2) in some libraries.
42-
- `experimental-opentelemetry` enables support for [OpenTelemetry].
42+
- `opentelemetry` enables support for [OpenTelemetry].
4343

4444
### Override Protobuf compiler and gRPC's plugin
4545

google/cloud/google_cloud_cpp_common.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ target_link_libraries(
171171
Threads::Threads
172172
OpenSSL::Crypto)
173173

174-
if (experimental-opentelemetry IN_LIST GOOGLE_CLOUD_CPP_ENABLE)
174+
if (opentelemetry IN_LIST GOOGLE_CLOUD_CPP_ENABLE)
175175
find_package(opentelemetry-cpp CONFIG)
176176
if (opentelemetry-cpp_FOUND)
177177
target_link_libraries(google_cloud_cpp_common

google/cloud/opentelemetry/CMakeLists.txt

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ target_compile_options(google_cloud_cpp_opentelemetry
5757
PUBLIC ${GOOGLE_CLOUD_CPP_EXCEPTIONS_FLAG})
5858
set_target_properties(
5959
google_cloud_cpp_opentelemetry
60-
PROPERTIES EXPORT_NAME "google-cloud-cpp::experimental-opentelemetry"
60+
PROPERTIES EXPORT_NAME "google-cloud-cpp::opentelemetry"
6161
VERSION ${PROJECT_VERSION}
6262
SOVERSION ${PROJECT_VERSION_MAJOR})
63-
add_library(google-cloud-cpp::experimental-opentelemetry ALIAS
63+
add_library(google-cloud-cpp::opentelemetry ALIAS
6464
google_cloud_cpp_opentelemetry)
6565
create_bazel_config(google_cloud_cpp_opentelemetry YEAR 2023)
6666

@@ -109,7 +109,6 @@ if (NOT BUILD_TESTING)
109109
endif ()
110110

111111
add_subdirectory(integration_tests)
112-
add_subdirectory(samples)
113112

114113
set(opentelemetry_unit_tests
115114
# cmake-format: sort
@@ -130,7 +129,7 @@ foreach (fname ${opentelemetry_unit_tests})
130129
PRIVATE google_cloud_cpp_testing
131130
google_cloud_cpp_testing_grpc
132131
google_cloud_cpp_testing_rest
133-
google-cloud-cpp::experimental-opentelemetry
132+
google-cloud-cpp::opentelemetry
134133
google_cloud_cpp_trace_mocks
135134
GTest::gmock_main
136135
GTest::gmock
@@ -149,9 +148,8 @@ endif ()
149148
include(CTest)
150149
add_executable(opentelemetry_quickstart "quickstart/quickstart.cc")
151150
target_link_libraries(
152-
opentelemetry_quickstart
153-
PRIVATE google-cloud-cpp::experimental-opentelemetry
154-
google-cloud-cpp::storage)
151+
opentelemetry_quickstart PRIVATE google-cloud-cpp::opentelemetry
152+
google-cloud-cpp::storage)
155153
google_cloud_cpp_add_common_options(opentelemetry_quickstart)
156154
add_test(
157155
NAME opentelemetry_quickstart

google/cloud/opentelemetry/config.cmake.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,8 @@ find_dependency(google_cloud_cpp_trace)
1818
find_dependency(opentelemetry-cpp)
1919

2020
include("${CMAKE_CURRENT_LIST_DIR}/google_cloud_cpp_opentelemetry-targets.cmake")
21+
22+
if (NOT TARGET google-cloud-cpp::experimental-opentelemetry)
23+
add_library(google-cloud-cpp::experimental-opentelemetry
24+
ALIAS google-cloud-cpp::opentelemetry)
25+
endif ()

google/cloud/opentelemetry/integration_tests/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ foreach (fname ${opentelemetry_integration_tests})
3737
google_cloud_cpp_add_executable(target "opentelemetry" "${fname}")
3838
target_link_libraries(
3939
${target}
40-
PRIVATE google-cloud-cpp::experimental-opentelemetry
41-
google_cloud_cpp_testing_grpc google_cloud_cpp_testing
42-
GTest::gmock_main GTest::gmock GTest::gtest)
40+
PRIVATE google-cloud-cpp::opentelemetry google_cloud_cpp_testing_grpc
41+
google_cloud_cpp_testing GTest::gmock_main GTest::gmock
42+
GTest::gtest)
4343
google_cloud_cpp_add_common_options(${target})
4444
add_test(NAME ${target} COMMAND ${target})
4545
set_tests_properties(${target} PROPERTIES LABELS "integration-test")

0 commit comments

Comments
 (0)