Skip to content

Commit

Permalink
[EXPORTER] Add OTLP HTTP SSL support (#1793)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcalff authored Apr 5, 2023
1 parent 9bcfcb9 commit 0e52dfd
Show file tree
Hide file tree
Showing 55 changed files with 4,168 additions and 94 deletions.
1 change: 1 addition & 0 deletions .copyright-ignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
*.patch
*.json
*.nuspec
*.pem

# Packaging
*/CONTROL
Expand Down
102 changes: 94 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ jobs:
sudo -E ./ci/setup_thrift.sh
./ci/do_ci.sh cmake.test
cmake_gcc_maintainer_test:
name: CMake gcc 12 (maintainer mode)
cmake_gcc_maintainer_sync_test:
name: CMake gcc 12 (maintainer mode, sync)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -46,16 +46,59 @@ jobs:
sudo -E ./ci/setup_cmake.sh
sudo -E ./ci/setup_ci_environment.sh
sudo -E ./ci/install_protobuf.sh
- name: run cmake gcc (maintainer mode)
- name: run cmake gcc (maintainer mode, sync)
env:
CC: /usr/bin/gcc-12
CXX: /usr/bin/g++-12
run: |
sudo -E ./ci/setup_thrift.sh
./ci/do_ci.sh cmake.maintainer.test
./ci/do_ci.sh cmake.maintainer.sync.test
- name: generate test cert
env:
CFSSL_VERSION: 1.6.3
run: |
sudo -E ./tools/setup-cfssl.sh
(cd ./functional/cert; ./generate_cert.sh)
- name: run func test
run: |
(cd ./functional/otlp; ./run_test.sh)
cmake_gcc_maintainer_async_test:
name: CMake gcc 12 (maintainer mode, async)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: setup
env:
CC: /usr/bin/gcc-12
CXX: /usr/bin/g++-12
GOOGLETEST_VERSION: 1.12.1
PROTOBUF_VERSION: 21.12
run: |
sudo -E ./ci/setup_cmake.sh
sudo -E ./ci/setup_ci_environment.sh
sudo -E ./ci/install_protobuf.sh
- name: run cmake gcc (maintainer mode, async)
env:
CC: /usr/bin/gcc-12
CXX: /usr/bin/g++-12
run: |
sudo -E ./ci/setup_thrift.sh
./ci/do_ci.sh cmake.maintainer.async.test
- name: generate test cert
env:
CFSSL_VERSION: 1.6.3
run: |
sudo -E ./tools/setup-cfssl.sh
(cd ./functional/cert; ./generate_cert.sh)
- name: run func test
run: |
(cd ./functional/otlp; ./run_test.sh)
cmake_clang_maintainer_test:
name: CMake clang 14 (maintainer mode)
cmake_clang_maintainer_sync_test:
name: CMake clang 14 (maintainer mode, sync)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -71,13 +114,56 @@ jobs:
sudo -E ./ci/setup_cmake.sh
sudo -E ./ci/setup_ci_environment.sh
sudo -E ./ci/install_protobuf.sh
- name: run cmake clang (maintainer mode)
- name: run cmake clang (maintainer mode, sync)
env:
CC: /usr/bin/clang-14
CXX: /usr/bin/clang++-14
run: |
sudo -E ./ci/setup_thrift.sh
./ci/do_ci.sh cmake.maintainer.test
./ci/do_ci.sh cmake.maintainer.sync.test
- name: generate test cert
env:
CFSSL_VERSION: 1.6.3
run: |
sudo -E ./tools/setup-cfssl.sh
(cd ./functional/cert; ./generate_cert.sh)
- name: run func test
run: |
(cd ./functional/otlp; ./run_test.sh)
cmake_clang_maintainer_async_test:
name: CMake clang 14 (maintainer mode, async)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: setup
env:
CC: /usr/bin/clang-14
CXX: /usr/bin/clang++-14
GOOGLETEST_VERSION: 1.12.1
PROTOBUF_VERSION: 21.12
run: |
sudo -E ./ci/setup_cmake.sh
sudo -E ./ci/setup_ci_environment.sh
sudo -E ./ci/install_protobuf.sh
- name: run cmake clang (maintainer mode, async)
env:
CC: /usr/bin/clang-14
CXX: /usr/bin/clang++-14
run: |
sudo -E ./ci/setup_thrift.sh
./ci/do_ci.sh cmake.maintainer.async.test
- name: generate test cert
env:
CFSSL_VERSION: 1.6.3
run: |
sudo -E ./tools/setup-cfssl.sh
(cd ./functional/cert; ./generate_cert.sh)
- name: run func test
run: |
(cd ./functional/otlp; ./run_test.sh)
cmake_msvc_maintainer_test:
name: CMake msvc (maintainer mode)
Expand Down
21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,24 @@ tags

# Temporary dir used when generating semconv
./buildscripts/semantic-convention/opentelemetry-specification

# Generated cert keys in functional tests
functional/cert/ca.csr
functional/cert/ca.pem
functional/cert/ca-key.pem
functional/cert/client_cert.csr
functional/cert/client_cert.pem
functional/cert/client_cert-key.pem
functional/cert/server_cert.csr
functional/cert/server_cert.pem
functional/cert/server_cert-key.pem
functional/cert/ca_b.csr
functional/cert/ca_b.pem
functional/cert/ca_b-key.pem
functional/cert/client_cert_b.csr
functional/cert/client_cert_b.pem
functional/cert/client_cert_b-key.pem
functional/cert/server_cert_b.csr
functional/cert/server_cert_b.pem
functional/cert/server_cert_b-key.pem
functional/cert/unreadable.pem
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ Increment the:
[#2000](https://github.com/open-telemetry/opentelemetry-cpp/pull/2000)
* [SEMANTIC CONVENTIONS] Upgrade to version 1.19.0
[#2017](https://github.com/open-telemetry/opentelemetry-cpp/pull/2017)
* [EXPORTER] Add OTLP HTTP SSL support
[#1793](https://github.com/open-telemetry/opentelemetry-cpp/pull/1793)

Important changes:

Expand Down
20 changes: 20 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,18 @@ option(
"Whether to build http client/server examples. Requires WITH_EXAMPLES and CURL"
OFF)

option(WITH_FUNC_TESTS "Whether to build functional tests" ON)

option(WITH_LOGS_PREVIEW "Whether to build logs preview" OFF)
option(WITH_ASYNC_EXPORT_PREVIEW "Whether to enable async export" OFF)

# EXPERIMENTAL
option(WITH_OTLP_HTTP_SSL_PREVIEW "Whether to enable otlp http ssl export" OFF)

# EXPERIMENTAL
option(WITH_OTLP_HTTP_SSL_TLS_PREVIEW
"Whether to enable otlp http ssl tls min/max/cipher options" OFF)

# Exemplar specs status is experimental, so behind feature flag by default
option(WITH_METRICS_EXEMPLAR_PREVIEW
"Whether to enable exemplar within metrics" OFF)
Expand All @@ -233,6 +243,13 @@ if(WITH_EXAMPLES_HTTP AND NOT WITH_EXAMPLES)
message(FATAL_ERROR "WITH_EXAMPLES_HTTP=ON requires WITH_EXAMPLES=ON")
endif()

if(WITH_OTLP_HTTP_SSL_TLS_PREVIEW AND NOT WITH_OTLP_HTTP_SSL_PREVIEW)
message(
FATAL_ERROR
"WITH_OTLP_HTTP_SSL_TLS_PREVIEW=ON requires WITH_OTLP_HTTP_SSL_PREVIEW=ON"
)
endif()

find_package(Threads)

function(install_windows_deps)
Expand Down Expand Up @@ -584,6 +601,9 @@ if(NOT WITH_API_ONLY)
if(WITH_EXAMPLES)
add_subdirectory(examples)
endif()
if(WITH_FUNC_TESTS)
add_subdirectory(functional)
endif()
endif()

if(OPENTELEMETRY_INSTALL)
Expand Down
15 changes: 15 additions & 0 deletions api/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,21 @@ if(WITH_ASYNC_EXPORT_PREVIEW)
target_compile_definitions(opentelemetry_api INTERFACE ENABLE_ASYNC_EXPORT)
endif()

# A better place should be in sdk, not api
if(WITH_OTLP_HTTP_SSL_PREVIEW)
target_compile_definitions(opentelemetry_api
INTERFACE ENABLE_OTLP_HTTP_SSL_PREVIEW)
target_compile_definitions(opentelemetry_api
INTERFACE ENABLE_HTTP_SSL_PREVIEW)

if(WITH_OTLP_HTTP_SSL_TLS_PREVIEW)
target_compile_definitions(opentelemetry_api
INTERFACE ENABLE_OTLP_HTTP_SSL_TLS_PREVIEW)
target_compile_definitions(opentelemetry_api
INTERFACE ENABLE_HTTP_SSL_TLS_PREVIEW)
endif()
endif()

if(WITH_METRICS_EXEMPLAR_PREVIEW)
target_compile_definitions(opentelemetry_api
INTERFACE ENABLE_METRICS_EXEMPLAR_PREVIEW)
Expand Down
28 changes: 27 additions & 1 deletion ci/do_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,38 @@ if [[ "$1" == "cmake.test" ]]; then
make -j $(nproc)
make test
exit 0
elif [[ "$1" == "cmake.maintainer.test" ]]; then
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 \
-DWITH_PROMETHEUS=ON \
-DWITH_EXAMPLES=ON \
-DWITH_EXAMPLES_HTTP=ON \
-DWITH_ZIPKIN=ON \
-DWITH_JAEGER=OFF \
-DBUILD_W3CTRACECONTEXT_TEST=ON \
-DWITH_ELASTICSEARCH=ON \
-DWITH_LOGS_PREVIEW=ON \
-DWITH_METRICS_EXEMPLAR_PREVIEW=ON \
-DWITH_ASYNC_EXPORT_PREVIEW=OFF \
-DOTELCPP_MAINTAINER_MODE=ON \
-DWITH_NO_DEPRECATED_CODE=ON \
"${SRC_DIR}"
make -k
make test
exit 0
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 \
-DWITH_PROMETHEUS=ON \
-DWITH_EXAMPLES=ON \
-DWITH_EXAMPLES_HTTP=ON \
Expand Down
Loading

0 comments on commit 0e52dfd

Please sign in to comment.