Skip to content

Commit 0e52dfd

Browse files
authored
[EXPORTER] Add OTLP HTTP SSL support (#1793)
1 parent 9bcfcb9 commit 0e52dfd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+4168
-94
lines changed

.copyright-ignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
*.patch
3535
*.json
3636
*.nuspec
37+
*.pem
3738

3839
# Packaging
3940
*/CONTROL

.github/workflows/ci.yml

Lines changed: 94 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ jobs:
2929
sudo -E ./ci/setup_thrift.sh
3030
./ci/do_ci.sh cmake.test
3131
32-
cmake_gcc_maintainer_test:
33-
name: CMake gcc 12 (maintainer mode)
32+
cmake_gcc_maintainer_sync_test:
33+
name: CMake gcc 12 (maintainer mode, sync)
3434
runs-on: ubuntu-latest
3535
steps:
3636
- uses: actions/checkout@v3
@@ -46,16 +46,59 @@ jobs:
4646
sudo -E ./ci/setup_cmake.sh
4747
sudo -E ./ci/setup_ci_environment.sh
4848
sudo -E ./ci/install_protobuf.sh
49-
- name: run cmake gcc (maintainer mode)
49+
- name: run cmake gcc (maintainer mode, sync)
5050
env:
5151
CC: /usr/bin/gcc-12
5252
CXX: /usr/bin/g++-12
5353
run: |
5454
sudo -E ./ci/setup_thrift.sh
55-
./ci/do_ci.sh cmake.maintainer.test
55+
./ci/do_ci.sh cmake.maintainer.sync.test
56+
- name: generate test cert
57+
env:
58+
CFSSL_VERSION: 1.6.3
59+
run: |
60+
sudo -E ./tools/setup-cfssl.sh
61+
(cd ./functional/cert; ./generate_cert.sh)
62+
- name: run func test
63+
run: |
64+
(cd ./functional/otlp; ./run_test.sh)
65+
66+
cmake_gcc_maintainer_async_test:
67+
name: CMake gcc 12 (maintainer mode, async)
68+
runs-on: ubuntu-latest
69+
steps:
70+
- uses: actions/checkout@v3
71+
with:
72+
submodules: 'recursive'
73+
- name: setup
74+
env:
75+
CC: /usr/bin/gcc-12
76+
CXX: /usr/bin/g++-12
77+
GOOGLETEST_VERSION: 1.12.1
78+
PROTOBUF_VERSION: 21.12
79+
run: |
80+
sudo -E ./ci/setup_cmake.sh
81+
sudo -E ./ci/setup_ci_environment.sh
82+
sudo -E ./ci/install_protobuf.sh
83+
- name: run cmake gcc (maintainer mode, async)
84+
env:
85+
CC: /usr/bin/gcc-12
86+
CXX: /usr/bin/g++-12
87+
run: |
88+
sudo -E ./ci/setup_thrift.sh
89+
./ci/do_ci.sh cmake.maintainer.async.test
90+
- name: generate test cert
91+
env:
92+
CFSSL_VERSION: 1.6.3
93+
run: |
94+
sudo -E ./tools/setup-cfssl.sh
95+
(cd ./functional/cert; ./generate_cert.sh)
96+
- name: run func test
97+
run: |
98+
(cd ./functional/otlp; ./run_test.sh)
5699
57-
cmake_clang_maintainer_test:
58-
name: CMake clang 14 (maintainer mode)
100+
cmake_clang_maintainer_sync_test:
101+
name: CMake clang 14 (maintainer mode, sync)
59102
runs-on: ubuntu-latest
60103
steps:
61104
- uses: actions/checkout@v3
@@ -71,13 +114,56 @@ jobs:
71114
sudo -E ./ci/setup_cmake.sh
72115
sudo -E ./ci/setup_ci_environment.sh
73116
sudo -E ./ci/install_protobuf.sh
74-
- name: run cmake clang (maintainer mode)
117+
- name: run cmake clang (maintainer mode, sync)
75118
env:
76119
CC: /usr/bin/clang-14
77120
CXX: /usr/bin/clang++-14
78121
run: |
79122
sudo -E ./ci/setup_thrift.sh
80-
./ci/do_ci.sh cmake.maintainer.test
123+
./ci/do_ci.sh cmake.maintainer.sync.test
124+
- name: generate test cert
125+
env:
126+
CFSSL_VERSION: 1.6.3
127+
run: |
128+
sudo -E ./tools/setup-cfssl.sh
129+
(cd ./functional/cert; ./generate_cert.sh)
130+
- name: run func test
131+
run: |
132+
(cd ./functional/otlp; ./run_test.sh)
133+
134+
cmake_clang_maintainer_async_test:
135+
name: CMake clang 14 (maintainer mode, async)
136+
runs-on: ubuntu-latest
137+
steps:
138+
- uses: actions/checkout@v3
139+
with:
140+
submodules: 'recursive'
141+
- name: setup
142+
env:
143+
CC: /usr/bin/clang-14
144+
CXX: /usr/bin/clang++-14
145+
GOOGLETEST_VERSION: 1.12.1
146+
PROTOBUF_VERSION: 21.12
147+
run: |
148+
sudo -E ./ci/setup_cmake.sh
149+
sudo -E ./ci/setup_ci_environment.sh
150+
sudo -E ./ci/install_protobuf.sh
151+
- name: run cmake clang (maintainer mode, async)
152+
env:
153+
CC: /usr/bin/clang-14
154+
CXX: /usr/bin/clang++-14
155+
run: |
156+
sudo -E ./ci/setup_thrift.sh
157+
./ci/do_ci.sh cmake.maintainer.async.test
158+
- name: generate test cert
159+
env:
160+
CFSSL_VERSION: 1.6.3
161+
run: |
162+
sudo -E ./tools/setup-cfssl.sh
163+
(cd ./functional/cert; ./generate_cert.sh)
164+
- name: run func test
165+
run: |
166+
(cd ./functional/otlp; ./run_test.sh)
81167
82168
cmake_msvc_maintainer_test:
83169
name: CMake msvc (maintainer mode)

.gitignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,24 @@ tags
5858

5959
# Temporary dir used when generating semconv
6060
./buildscripts/semantic-convention/opentelemetry-specification
61+
62+
# Generated cert keys in functional tests
63+
functional/cert/ca.csr
64+
functional/cert/ca.pem
65+
functional/cert/ca-key.pem
66+
functional/cert/client_cert.csr
67+
functional/cert/client_cert.pem
68+
functional/cert/client_cert-key.pem
69+
functional/cert/server_cert.csr
70+
functional/cert/server_cert.pem
71+
functional/cert/server_cert-key.pem
72+
functional/cert/ca_b.csr
73+
functional/cert/ca_b.pem
74+
functional/cert/ca_b-key.pem
75+
functional/cert/client_cert_b.csr
76+
functional/cert/client_cert_b.pem
77+
functional/cert/client_cert_b-key.pem
78+
functional/cert/server_cert_b.csr
79+
functional/cert/server_cert_b.pem
80+
functional/cert/server_cert_b-key.pem
81+
functional/cert/unreadable.pem

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ Increment the:
2525
[#2000](https://github.com/open-telemetry/opentelemetry-cpp/pull/2000)
2626
* [SEMANTIC CONVENTIONS] Upgrade to version 1.19.0
2727
[#2017](https://github.com/open-telemetry/opentelemetry-cpp/pull/2017)
28+
* [EXPORTER] Add OTLP HTTP SSL support
29+
[#1793](https://github.com/open-telemetry/opentelemetry-cpp/pull/1793)
2830

2931
Important changes:
3032

CMakeLists.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,18 @@ option(
219219
"Whether to build http client/server examples. Requires WITH_EXAMPLES and CURL"
220220
OFF)
221221

222+
option(WITH_FUNC_TESTS "Whether to build functional tests" ON)
223+
222224
option(WITH_LOGS_PREVIEW "Whether to build logs preview" OFF)
223225
option(WITH_ASYNC_EXPORT_PREVIEW "Whether to enable async export" OFF)
226+
227+
# EXPERIMENTAL
228+
option(WITH_OTLP_HTTP_SSL_PREVIEW "Whether to enable otlp http ssl export" OFF)
229+
230+
# EXPERIMENTAL
231+
option(WITH_OTLP_HTTP_SSL_TLS_PREVIEW
232+
"Whether to enable otlp http ssl tls min/max/cipher options" OFF)
233+
224234
# Exemplar specs status is experimental, so behind feature flag by default
225235
option(WITH_METRICS_EXEMPLAR_PREVIEW
226236
"Whether to enable exemplar within metrics" OFF)
@@ -233,6 +243,13 @@ if(WITH_EXAMPLES_HTTP AND NOT WITH_EXAMPLES)
233243
message(FATAL_ERROR "WITH_EXAMPLES_HTTP=ON requires WITH_EXAMPLES=ON")
234244
endif()
235245

246+
if(WITH_OTLP_HTTP_SSL_TLS_PREVIEW AND NOT WITH_OTLP_HTTP_SSL_PREVIEW)
247+
message(
248+
FATAL_ERROR
249+
"WITH_OTLP_HTTP_SSL_TLS_PREVIEW=ON requires WITH_OTLP_HTTP_SSL_PREVIEW=ON"
250+
)
251+
endif()
252+
236253
find_package(Threads)
237254

238255
function(install_windows_deps)
@@ -584,6 +601,9 @@ if(NOT WITH_API_ONLY)
584601
if(WITH_EXAMPLES)
585602
add_subdirectory(examples)
586603
endif()
604+
if(WITH_FUNC_TESTS)
605+
add_subdirectory(functional)
606+
endif()
587607
endif()
588608

589609
if(OPENTELEMETRY_INSTALL)

api/CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,21 @@ if(WITH_ASYNC_EXPORT_PREVIEW)
9898
target_compile_definitions(opentelemetry_api INTERFACE ENABLE_ASYNC_EXPORT)
9999
endif()
100100

101+
# A better place should be in sdk, not api
102+
if(WITH_OTLP_HTTP_SSL_PREVIEW)
103+
target_compile_definitions(opentelemetry_api
104+
INTERFACE ENABLE_OTLP_HTTP_SSL_PREVIEW)
105+
target_compile_definitions(opentelemetry_api
106+
INTERFACE ENABLE_HTTP_SSL_PREVIEW)
107+
108+
if(WITH_OTLP_HTTP_SSL_TLS_PREVIEW)
109+
target_compile_definitions(opentelemetry_api
110+
INTERFACE ENABLE_OTLP_HTTP_SSL_TLS_PREVIEW)
111+
target_compile_definitions(opentelemetry_api
112+
INTERFACE ENABLE_HTTP_SSL_TLS_PREVIEW)
113+
endif()
114+
endif()
115+
101116
if(WITH_METRICS_EXEMPLAR_PREVIEW)
102117
target_compile_definitions(opentelemetry_api
103118
INTERFACE ENABLE_METRICS_EXEMPLAR_PREVIEW)

ci/do_ci.sh

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,38 @@ if [[ "$1" == "cmake.test" ]]; then
9090
make -j $(nproc)
9191
make test
9292
exit 0
93-
elif [[ "$1" == "cmake.maintainer.test" ]]; then
93+
elif [[ "$1" == "cmake.maintainer.sync.test" ]]; then
9494
cd "${BUILD_DIR}"
9595
rm -rf *
9696
cmake -DCMAKE_BUILD_TYPE=Debug \
9797
-DWITH_OTLP=ON \
9898
-DWITH_OTLP_HTTP=ON \
99+
-DWITH_OTLP_HTTP_SSL_PREVIEW=ON \
100+
-DWITH_OTLP_HTTP_SSL_TLS_PREVIEW=ON \
101+
-DWITH_PROMETHEUS=ON \
102+
-DWITH_EXAMPLES=ON \
103+
-DWITH_EXAMPLES_HTTP=ON \
104+
-DWITH_ZIPKIN=ON \
105+
-DWITH_JAEGER=OFF \
106+
-DBUILD_W3CTRACECONTEXT_TEST=ON \
107+
-DWITH_ELASTICSEARCH=ON \
108+
-DWITH_LOGS_PREVIEW=ON \
109+
-DWITH_METRICS_EXEMPLAR_PREVIEW=ON \
110+
-DWITH_ASYNC_EXPORT_PREVIEW=OFF \
111+
-DOTELCPP_MAINTAINER_MODE=ON \
112+
-DWITH_NO_DEPRECATED_CODE=ON \
113+
"${SRC_DIR}"
114+
make -k
115+
make test
116+
exit 0
117+
elif [[ "$1" == "cmake.maintainer.async.test" ]]; then
118+
cd "${BUILD_DIR}"
119+
rm -rf *
120+
cmake -DCMAKE_BUILD_TYPE=Debug \
121+
-DWITH_OTLP=ON \
122+
-DWITH_OTLP_HTTP=ON \
123+
-DWITH_OTLP_HTTP_SSL_PREVIEW=ON \
124+
-DWITH_OTLP_HTTP_SSL_TLS_PREVIEW=ON \
99125
-DWITH_PROMETHEUS=ON \
100126
-DWITH_EXAMPLES=ON \
101127
-DWITH_EXAMPLES_HTTP=ON \

0 commit comments

Comments
 (0)