Skip to content

Commit e86ceba

Browse files
authored
[EXPORTER] OTLP file exporter (#2540)
1 parent 13a4c45 commit e86ceba

36 files changed

Lines changed: 4515 additions & 2 deletions

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ Increment the:
1515

1616
## [Unreleased]
1717

18+
* [EXPORTER] Add OTLP File exporters
19+
[#2540](https://github.com/open-telemetry/opentelemetry-cpp/pull/2540)
1820
* [EXPORTER] Gzip compression support for OTLP/HTTP and OTLP/gRPC exporter
1921
[#2530](https://github.com/open-telemetry/opentelemetry-cpp/pull/2530)
2022
* [EXPORTER] Support URL-encoded values for `OTEL_EXPORTER_OTLP_HEADERS`

CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,9 @@ option(WITH_OTLP_GRPC "Whether to include the OTLP gRPC exporter in the SDK"
204204
option(WITH_OTLP_HTTP "Whether to include the OTLP http exporter in the SDK"
205205
OFF)
206206

207+
option(WITH_OTLP_FILE "Whether to include the OTLP file exporter in the SDK"
208+
OFF)
209+
207210
option(
208211
WITH_OTLP_HTTP_COMPRESSION
209212
"Whether to include gzip compression for the OTLP http exporter in the SDK"
@@ -370,7 +373,9 @@ if(WITH_ABSEIL)
370373
find_package(absl CONFIG REQUIRED)
371374
endif()
372375

373-
if(WITH_OTLP_GRPC OR WITH_OTLP_HTTP)
376+
if(WITH_OTLP_GRPC
377+
OR WITH_OTLP_HTTP
378+
OR WITH_OTLP_FILE)
374379
find_package(Protobuf)
375380
if(Protobuf_VERSION AND Protobuf_VERSION VERSION_GREATER_EQUAL "3.22.0")
376381
if(NOT WITH_ABSEIL)
@@ -473,6 +478,7 @@ endif()
473478
if(WITH_ELASTICSEARCH
474479
OR WITH_ZIPKIN
475480
OR WITH_OTLP_HTTP
481+
OR WITH_OTLP_FILE
476482
OR BUILD_W3CTRACECONTEXT_TEST
477483
OR WITH_ETW)
478484
set(USE_NLOHMANN_JSON ON)

ci/do_ci.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ elif [[ "$1" == "cmake.maintainer.sync.test" ]]; then
114114
rm -rf *
115115
cmake "${CMAKE_OPTIONS[@]}" \
116116
-DWITH_OTLP_HTTP=ON \
117+
-DWITH_OTLP_FILE=ON \
117118
-DWITH_PROMETHEUS=ON \
118119
-DWITH_EXAMPLES=ON \
119120
-DWITH_EXAMPLES_HTTP=ON \
@@ -135,6 +136,7 @@ elif [[ "$1" == "cmake.maintainer.async.test" ]]; then
135136
rm -rf *
136137
cmake "${CMAKE_OPTIONS[@]}" \
137138
-DWITH_OTLP_HTTP=ON \
139+
-DWITH_OTLP_FILE=ON \
138140
-DWITH_PROMETHEUS=ON \
139141
-DWITH_EXAMPLES=ON \
140142
-DWITH_EXAMPLES_HTTP=ON \
@@ -157,6 +159,7 @@ elif [[ "$1" == "cmake.maintainer.cpp11.async.test" ]]; then
157159
cmake "${CMAKE_OPTIONS[@]}" \
158160
-DCMAKE_CXX_STANDARD=11 \
159161
-DWITH_OTLP_HTTP=ON \
162+
-DWITH_OTLP_FILE=ON \
160163
-DWITH_PROMETHEUS=ON \
161164
-DWITH_EXAMPLES=ON \
162165
-DWITH_EXAMPLES_HTTP=ON \
@@ -177,6 +180,7 @@ elif [[ "$1" == "cmake.maintainer.abiv2.test" ]]; then
177180
rm -rf *
178181
cmake "${CMAKE_OPTIONS[@]}" \
179182
-DWITH_OTLP_HTTP=ON \
183+
-DWITH_OTLP_FILE=ON \
180184
-DWITH_PROMETHEUS=ON \
181185
-DWITH_EXAMPLES=ON \
182186
-DWITH_EXAMPLES_HTTP=ON \
@@ -327,6 +331,7 @@ elif [[ "$1" == "cmake.legacy.exporter.otprotocol.test" ]]; then
327331
-DCMAKE_CXX_STANDARD=11 \
328332
-DWITH_OTLP_GRPC=ON \
329333
-DWITH_OTLP_HTTP=ON \
334+
-DWITH_OTLP_FILE=ON \
330335
-DWITH_ASYNC_EXPORT_PREVIEW=ON \
331336
"${SRC_DIR}"
332337
grpc_cpp_plugin=`which grpc_cpp_plugin`
@@ -344,6 +349,7 @@ elif [[ "$1" == "cmake.exporter.otprotocol.test" ]]; then
344349
cmake "${CMAKE_OPTIONS[@]}" \
345350
-DWITH_OTLP_GRPC=ON \
346351
-DWITH_OTLP_HTTP=ON \
352+
-DWITH_OTLP_FILE=ON \
347353
-DWITH_OTLP_GRPC_SSL_MTLS_PREVIEW=ON \
348354
"${SRC_DIR}"
349355
grpc_cpp_plugin=`which grpc_cpp_plugin`
@@ -358,6 +364,7 @@ elif [[ "$1" == "cmake.exporter.otprotocol.shared_libs.with_static_grpc.test" ]]
358364
cmake "${CMAKE_OPTIONS[@]}" \
359365
-DWITH_OTLP_GRPC=ON \
360366
-DWITH_OTLP_HTTP=ON \
367+
-DWITH_OTLP_FILE=ON \
361368
-DBUILD_SHARED_LIBS=ON \
362369
"${SRC_DIR}"
363370
grpc_cpp_plugin=`which grpc_cpp_plugin`
@@ -372,6 +379,7 @@ elif [[ "$1" == "cmake.exporter.otprotocol.with_async_export.test" ]]; then
372379
cmake "${CMAKE_OPTIONS[@]}" \
373380
-DWITH_OTLP_GRPC=ON \
374381
-DWITH_OTLP_HTTP=ON \
382+
-DWITH_OTLP_FILE=ON \
375383
-DWITH_ASYNC_EXPORT_PREVIEW=ON \
376384
"${SRC_DIR}"
377385
grpc_cpp_plugin=`which grpc_cpp_plugin`
@@ -386,6 +394,7 @@ elif [[ "$1" == "cmake.do_not_install.test" ]]; then
386394
cmake "${CMAKE_OPTIONS[@]}" \
387395
-DWITH_OTLP_GRPC=ON \
388396
-DWITH_OTLP_HTTP=ON \
397+
-DWITH_OTLP_FILE=ON \
389398
-DWITH_ASYNC_EXPORT_PREVIEW=ON \
390399
-DOPENTELEMETRY_INSTALL=OFF \
391400
"${SRC_DIR}"

cmake/opentelemetry-cpp-config.cmake.in

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@
4141
# opentelemetry-cpp::otlp_http_exporter - Imported target of opentelemetry-cpp::otlp_http_exporter
4242
# opentelemetry-cpp::otlp_http_log_record_exporter - Imported target of opentelemetry-cpp::otlp_http_log_record_exporter
4343
# opentelemetry-cpp::otlp_http_metric_exporter - Imported target of opentelemetry-cpp::otlp_http_metric_exporter
44+
# opentelemetry-cpp::otlp_file_client - Imported target of opentelemetry-cpp::otlp_file_client
45+
# opentelemetry-cpp::otlp_file_exporter - Imported target of opentelemetry-cpp::otlp_file_exporter
46+
# opentelemetry-cpp::otlp_file_log_record_exporter - Imported target of opentelemetry-cpp::otlp_file_log_record_exporter
47+
# opentelemetry-cpp::otlp_file_metric_exporter - Imported target of opentelemetry-cpp::otlp_file_metric_exporter
4448
# opentelemetry-cpp::ostream_log_record_exporter - Imported target of opentelemetry-cpp::ostream_log_record_exporter
4549
# opentelemetry-cpp::ostream_metrics_exporter - Imported target of opentelemetry-cpp::ostream_metrics_exporter
4650
# opentelemetry-cpp::ostream_span_exporter - Imported target of opentelemetry-cpp::ostream_span_exporter
@@ -93,6 +97,10 @@ set(_OPENTELEMETRY_CPP_LIBRARIES_TEST_TARGETS
9397
otlp_http_exporter
9498
otlp_http_log_record_exporter
9599
otlp_http_metric_exporter
100+
otlp_file_client
101+
otlp_file_exporter
102+
otlp_file_log_record_exporter
103+
otlp_file_metric_exporter
96104
ostream_log_record_exporter
97105
ostream_metrics_exporter
98106
ostream_span_exporter

exporters/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# Copyright The OpenTelemetry Authors
22
# SPDX-License-Identifier: Apache-2.0
33

4-
if(WITH_OTLP_GRPC OR WITH_OTLP_HTTP)
4+
if(WITH_OTLP_GRPC
5+
OR WITH_OTLP_HTTP
6+
OR WITH_OTLP_FILE)
57
add_subdirectory(otlp)
68
endif()
79

0 commit comments

Comments
 (0)