Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUILD] Remove option WITH_OTLP #2161

Merged
merged 7 commits into from
May 31, 2023
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
24 changes: 9 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -159,15 +159,16 @@ if(WITH_STL)
endif()
endif()

option(WITH_OTLP "Whether to include the OpenTelemetry Protocol in the SDK" OFF)

if(WITH_OTLP)
if(DEFINED WITH_OTLP)
ThomsonTan marked this conversation as resolved.
Show resolved Hide resolved
message(
WARNING
"WITH_OTLP is deprecated and will be removed in future. Please set either WITH_OTLP_GRPC or WITH_OTLP_HTTP, or even both."
FATAL_ERROR
"WITH_OTLP is deprecated. Please set either WITH_OTLP_GRPC=ON, WITH_OTLP_HTTP=ON, or both to ON."
)
endif()

option(WITH_OTLP_GRPC "Whether to include the OTLP gRPC exporter in the SDK"
OFF)

option(WITH_OTLP_HTTP "Whether to include the OTLP http exporter in the SDK"
OFF)

Expand Down Expand Up @@ -355,11 +356,10 @@ if(WITH_PROMETHEUS)
endif()
endif()

if(WITH_OTLP)
if(WITH_OTLP_GRPC OR WITH_OTLP_HTTP)
set(protobuf_MODULE_COMPATIBLE ON)
find_package(Protobuf)
if(WITH_OTLP_GRPC OR (NOT DEFINED WITH_OTLP_GRPC AND NOT DEFINED
CACHE{WITH_OTLP_GRPC}))
if(WITH_OTLP_GRPC)
find_package(gRPC)
endif()
if((NOT Protobuf_FOUND AND NOT PROTOBUF_FOUND) OR (NOT gRPC_FOUND))
Expand All @@ -377,9 +377,7 @@ if(WITH_OTLP)
if(NOT Protobuf_FOUND AND NOT PROTOBUF_FOUND)
find_package(Protobuf REQUIRED)
endif()
if(NOT gRPC_FOUND
AND (WITH_OTLP_GRPC OR (NOT DEFINED WITH_OTLP_GRPC
AND NOT DEFINED CACHE{WITH_OTLP_GRPC})))
if(NOT gRPC_FOUND AND WITH_OTLP_GRPC)
find_package(gRPC)
endif()
if(WIN32)
Expand All @@ -397,10 +395,6 @@ if(WITH_OTLP)
endif()
include(CMakeDependentOption)

cmake_dependent_option(
WITH_OTLP_GRPC "Whether to include the OTLP gRPC exporter in the SDK" ON
"gRPC_FOUND" OFF)

message(STATUS "PROTOBUF_PROTOC_EXECUTABLE=${PROTOBUF_PROTOC_EXECUTABLE}")
include(cmake/opentelemetry-proto.cmake)
endif()
Expand Down
10 changes: 5 additions & 5 deletions CMakeSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"ctestCommandArgs": "",
"variables": [
{
"name": "WITH_OTLP",
"name": "WITH_OTLP_GRPC",
"value": "True",
"type": "BOOL"
},
Expand All @@ -40,7 +40,7 @@
"cmakeToolchain": "",
"variables": [
{
"name": "WITH_OTLP",
"name": "WITH_OTLP_GRPC",
"value": "True",
"type": "BOOL"
},
Expand Down Expand Up @@ -70,7 +70,7 @@
"type": "BOOL"
},
{
"name": "WITH_OTLP",
"name": "WITH_OTLP_GRPC",
"value": "True",
"type": "BOOL"
},
Expand Down Expand Up @@ -106,7 +106,7 @@
"type": "BOOL"
},
{
"name": "WITH_OTLP",
"name": "WITH_OTLP_GRPC",
"value": "True",
"type": "BOOL"
},
Expand All @@ -123,4 +123,4 @@
]
}
]
}
}
3 changes: 2 additions & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ You can link OpenTelemetry C++ SDK with libraries provided in
- `-DBUILD_SHARED_LIBS=ON` : To build shared libraries for the targets.
Please refer to note [below](#building-shared-libs-for-windows) for
Windows DLL support.
- `-DWITH_OTLP=ON` : To enable building OTLP exporter.
- `-DWITH_OTLP_GRPC=ON` : To enable building OTLP GRPC exporter.
- `-DWITH_OTLP_HTTP=ON` : To enable building OTLP HTTP exporter.
- `-DWITH_PROMETHEUS=ON` : To enable building prometheus exporter.

3. Once the build configuration is created, build the CMake targets - this
Expand Down
13 changes: 5 additions & 8 deletions ci/do_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ elif [[ "$1" == "cmake.maintainer.sync.test" ]]; then
cd "${BUILD_DIR}"
rm -rf *
cmake -DCMAKE_BUILD_TYPE=Debug \
-DWITH_OTLP=ON \
-DWITH_OTLP_HTTP=ON \
-DWITH_OTLP_HTTP_SSL_PREVIEW=ON \
-DWITH_OTLP_HTTP_SSL_TLS_PREVIEW=ON \
Expand All @@ -118,7 +117,6 @@ elif [[ "$1" == "cmake.maintainer.async.test" ]]; then
cd "${BUILD_DIR}"
rm -rf *
cmake -DCMAKE_BUILD_TYPE=Debug \
-DWITH_OTLP=ON \
-DWITH_OTLP_HTTP=ON \
-DWITH_OTLP_HTTP_SSL_PREVIEW=ON \
-DWITH_OTLP_HTTP_SSL_TLS_PREVIEW=ON \
Expand All @@ -143,7 +141,6 @@ elif [[ "$1" == "cmake.maintainer.cpp11.async.test" ]]; then
rm -rf *
cmake -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_STANDARD=11 \
-DWITH_OTLP=ON \
-DWITH_OTLP_HTTP=ON \
-DWITH_OTLP_HTTP_SSL_PREVIEW=ON \
-DWITH_OTLP_HTTP_SSL_TLS_PREVIEW=ON \
Expand Down Expand Up @@ -245,7 +242,7 @@ elif [[ "$1" == "cmake.legacy.exporter.otprotocol.test" ]]; then
${SRC_DIR}/tools/build-benchmark.sh
cmake -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_STANDARD=11 \
-DWITH_OTLP=ON \
-DWITH_OTLP_GRPC=ON \
-DWITH_OTLP_HTTP=ON \
-DWITH_ASYNC_EXPORT_PREVIEW=ON \
"${SRC_DIR}"
Expand All @@ -259,7 +256,7 @@ elif [[ "$1" == "cmake.exporter.otprotocol.test" ]]; then
cd "${BUILD_DIR}"
rm -rf *
cmake -DCMAKE_BUILD_TYPE=Debug \
-DWITH_OTLP=ON \
-DWITH_OTLP_GRPC=ON \
-DWITH_OTLP_HTTP=ON \
"${SRC_DIR}"
grpc_cpp_plugin=`which grpc_cpp_plugin`
Expand All @@ -272,7 +269,7 @@ elif [[ "$1" == "cmake.exporter.otprotocol.shared_libs.with_static_grpc.test" ]]
cd "${BUILD_DIR}"
rm -rf *
cmake -DCMAKE_BUILD_TYPE=Debug \
-DWITH_OTLP=ON \
-DWITH_OTLP_GRPC=ON \
-DWITH_OTLP_HTTP=ON \
-DBUILD_SHARED_LIBS=ON \
"${SRC_DIR}"
Expand All @@ -286,7 +283,7 @@ elif [[ "$1" == "cmake.exporter.otprotocol.with_async_export.test" ]]; then
cd "${BUILD_DIR}"
rm -rf *
cmake -DCMAKE_BUILD_TYPE=Debug \
-DWITH_OTLP=ON \
-DWITH_OTLP_GRPC=ON \
-DWITH_OTLP_HTTP=ON \
-DWITH_ASYNC_EXPORT_PREVIEW=ON \
"${SRC_DIR}"
Expand All @@ -300,7 +297,7 @@ elif [[ "$1" == "cmake.do_not_install.test" ]]; then
cd "${BUILD_DIR}"
rm -rf *
cmake -DCMAKE_BUILD_TYPE=Debug \
-DWITH_OTLP=ON \
-DWITH_OTLP_GRPC=ON \
-DWITH_OTLP_HTTP=ON \
-DWITH_ASYNC_EXPORT_PREVIEW=ON \
-DOPENTELEMETRY_INSTALL=OFF \
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ RUN git clone --recurse-submodules -j ${CORES} --depth=1 \
-DWITH_JAEGER=ON \
-DCMAKE_INSTALL_PREFIX=/opt/third_party/install \
-DBUILD_TESTING=OFF \
-DWITH_OTLP=ON \
ThomsonTan marked this conversation as resolved.
Show resolved Hide resolved
-DWITH_OTLP_GRPC=ON \
-DWITH_OTLP_HTTP=ON \
-DBUILD_SHARED_LIBS=ON \
.. \
&& cmake --build . -j ${CORES} --target install
Expand Down
3 changes: 2 additions & 1 deletion docker/Dockerfile.centos
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ RUN git clone --depth=1 https://github.com/open-telemetry/opentelemetry-cpp.git
-DWITH_ZIPKIN=ON \
-DWITH_JAEGER=ON \
-DBUILD_TESTING=OFF \
-DWITH_OTLP=ON \
-DWITH_OTLP_GRPC=ON \
-DWITH_OTLP_HTTP=ON \
.. \
&& make -j${nproc} install && ldconfig
3 changes: 2 additions & 1 deletion docker/ubuntuLatest/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ RUN apt-get install -y --no-install-recommends libcurl4-openssl-dev && git clone
-DWITH_ZIPKIN=ON \
-DWITH_JAEGER=ON \
-DBUILD_TESTING=OFF \
-DWITH_OTLP=ON \
-DWITH_OTLP_GRPC=ON \
-DWITH_OTLP_HTTP=ON \
.. && \
make -j${nproc} install && ldconfig && \
cd ../..
2 changes: 1 addition & 1 deletion exporters/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

if(WITH_OTLP)
if(WITH_OTLP_GRPC OR WITH_OTLP_HTTP)
add_subdirectory(otlp)
endif()

Expand Down