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

[EXPORTER] OTLP file exporter #2540

Merged
merged 32 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
dbc2ed4
OTLP file exporter.
owent Feb 18, 2024
f60c08c
Fix include problem
owent Feb 18, 2024
581c6d5
Fix dependency and style
owent Feb 18, 2024
a2f4fa4
Add unit tests for factory of OTLP file exporters.
owent Feb 19, 2024
02f866a
Unit tests for OTLP file exporters
owent Feb 19, 2024
bd2462d
Fix bazel build for OTLP file exporters
owent Feb 19, 2024
07809cd
Fix unit test dependency of OTLP file client in bazel
owent Feb 19, 2024
0e2f49b
Fix tsan and valgrind problems.
owent Feb 19, 2024
5d21c69
Fix possiable memory leak in Shutdown.
owent Feb 19, 2024
55116b6
Add a standalone `OtlpFileAppender` to allow users to custom set thei…
owent Feb 20, 2024
b624880
Merge branch 'main' into otlp_file_exporter
ThomsonTan Feb 21, 2024
e25e27b
Merge branch 'main' into otlp_file_exporter
owent Feb 23, 2024
046ba78
Merge remote-tracking branch 'github/main' into otlp_file_exporter
owent Feb 27, 2024
a3900bc
Merge remote-tracking branch 'github/main' into otlp_file_exporter
owent Mar 14, 2024
be123e1
Merge branch 'main' into otlp_file_exporter
owent Mar 21, 2024
0ff8047
Merge branch 'main' into otlp_file_exporter
owent Mar 22, 2024
2797725
Simple the error message
owent Mar 22, 2024
e9c69a7
Fix OTLP file may wait too long when shutdown
owent Mar 22, 2024
ecff7cf
Fix lint
owent Mar 22, 2024
1850210
Add logs when create new directories
owent Mar 22, 2024
734ea68
Add more logs to check why create directory failed.
owent Mar 22, 2024
d8509a6
Fix implementation of `DirName`
owent Mar 22, 2024
f720bf1
Merge branch 'main' into otlp_file_exporter
owent Mar 25, 2024
558ac1d
Optimize error log when creating directory
owent Mar 25, 2024
1714c87
Merge remote-tracking branch 'github/main' into otlp_file_exporter
owent Mar 25, 2024
6624ad1
Do not reuse the fstream instance to clear file content.
owent Mar 25, 2024
065c2eb
Fix test directory conflict with executable name
owent Mar 25, 2024
cce21b1
Merge branch 'main' into otlp_file_exporter
ThomsonTan Mar 26, 2024
c991452
Merge branch 'main' into otlp_file_exporter
ThomsonTan Mar 27, 2024
a64cc74
Merge remote-tracking branch 'github/main' into otlp_file_exporter
owent Mar 29, 2024
a63ab2f
Removed unused headers
owent Mar 29, 2024
7526cab
Merge branch 'main' into otlp_file_exporter
marcalff Apr 3, 2024
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Increment the:

## [Unreleased]

* [EXPORTER] Add OTLP File exporters
[#2540](https://github.com/open-telemetry/opentelemetry-cpp/pull/2540)
* [EXPORTER] Gzip compression support for OTLP/HTTP and OTLP/gRPC exporter
[#2530](https://github.com/open-telemetry/opentelemetry-cpp/pull/2530)
* [EXPORTER] Support URL-encoded values for `OTEL_EXPORTER_OTLP_HEADERS`
Expand Down
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,9 @@ option(WITH_OTLP_GRPC "Whether to include the OTLP gRPC exporter in the SDK"
option(WITH_OTLP_HTTP "Whether to include the OTLP http exporter in the SDK"
OFF)

option(WITH_OTLP_FILE_PREVIOUS
"Whether to include the OTLP file exporter in the SDK" OFF)
set(WITH_OTLP_FILE ${WITH_OTLP_FILE_PREVIOUS})
owent marked this conversation as resolved.
Show resolved Hide resolved
option(
WITH_OTLP_HTTP_COMPRESSION
"Whether to include gzip compression for the OTLP http exporter in the SDK"
Expand Down Expand Up @@ -370,7 +373,9 @@ if(WITH_ABSEIL)
find_package(absl CONFIG REQUIRED)
endif()

if(WITH_OTLP_GRPC OR WITH_OTLP_HTTP)
if(WITH_OTLP_GRPC
OR WITH_OTLP_HTTP
OR WITH_OTLP_FILE)
find_package(Protobuf)
if(Protobuf_VERSION AND Protobuf_VERSION VERSION_GREATER_EQUAL "3.22.0")
if(NOT WITH_ABSEIL)
Expand Down Expand Up @@ -473,6 +478,7 @@ endif()
if(WITH_ELASTICSEARCH
OR WITH_ZIPKIN
OR WITH_OTLP_HTTP
OR WITH_OTLP_FILE
OR BUILD_W3CTRACECONTEXT_TEST
OR WITH_ETW)
set(USE_NLOHMANN_JSON ON)
Expand Down
9 changes: 9 additions & 0 deletions ci/do_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ elif [[ "$1" == "cmake.maintainer.sync.test" ]]; then
rm -rf *
cmake ${CMAKE_OPTIONS[@]} \
-DWITH_OTLP_HTTP=ON \
-DWITH_OTLP_FILE=ON \
-DWITH_PROMETHEUS=ON \
-DWITH_EXAMPLES=ON \
-DWITH_EXAMPLES_HTTP=ON \
Expand All @@ -131,6 +132,7 @@ elif [[ "$1" == "cmake.maintainer.async.test" ]]; then
rm -rf *
cmake ${CMAKE_OPTIONS[@]} \
-DWITH_OTLP_HTTP=ON \
-DWITH_OTLP_FILE=ON \
-DWITH_PROMETHEUS=ON \
-DWITH_EXAMPLES=ON \
-DWITH_EXAMPLES_HTTP=ON \
Expand All @@ -153,6 +155,7 @@ elif [[ "$1" == "cmake.maintainer.cpp11.async.test" ]]; then
cmake ${CMAKE_OPTIONS[@]} \
-DCMAKE_CXX_STANDARD=11 \
-DWITH_OTLP_HTTP=ON \
-DWITH_OTLP_FILE=ON \
-DWITH_PROMETHEUS=ON \
-DWITH_EXAMPLES=ON \
-DWITH_EXAMPLES_HTTP=ON \
Expand All @@ -173,6 +176,7 @@ elif [[ "$1" == "cmake.maintainer.abiv2.test" ]]; then
rm -rf *
cmake ${CMAKE_OPTIONS[@]} \
-DWITH_OTLP_HTTP=ON \
-DWITH_OTLP_FILE=ON \
-DWITH_PROMETHEUS=ON \
-DWITH_EXAMPLES=ON \
-DWITH_EXAMPLES_HTTP=ON \
Expand Down Expand Up @@ -323,6 +327,7 @@ elif [[ "$1" == "cmake.legacy.exporter.otprotocol.test" ]]; then
-DCMAKE_CXX_STANDARD=11 \
-DWITH_OTLP_GRPC=ON \
-DWITH_OTLP_HTTP=ON \
-DWITH_OTLP_FILE=ON \
-DWITH_ASYNC_EXPORT_PREVIEW=ON \
"${SRC_DIR}"
grpc_cpp_plugin=`which grpc_cpp_plugin`
Expand All @@ -340,6 +345,7 @@ elif [[ "$1" == "cmake.exporter.otprotocol.test" ]]; then
cmake ${CMAKE_OPTIONS[@]} \
-DWITH_OTLP_GRPC=ON \
-DWITH_OTLP_HTTP=ON \
-DWITH_OTLP_FILE=ON \
-DWITH_OTLP_GRPC_SSL_MTLS_PREVIEW=ON \
"${SRC_DIR}"
grpc_cpp_plugin=`which grpc_cpp_plugin`
Expand All @@ -354,6 +360,7 @@ elif [[ "$1" == "cmake.exporter.otprotocol.shared_libs.with_static_grpc.test" ]]
cmake ${CMAKE_OPTIONS[@]} \
-DWITH_OTLP_GRPC=ON \
-DWITH_OTLP_HTTP=ON \
-DWITH_OTLP_FILE=ON \
-DBUILD_SHARED_LIBS=ON \
"${SRC_DIR}"
grpc_cpp_plugin=`which grpc_cpp_plugin`
Expand All @@ -368,6 +375,7 @@ elif [[ "$1" == "cmake.exporter.otprotocol.with_async_export.test" ]]; then
cmake ${CMAKE_OPTIONS[@]} \
-DWITH_OTLP_GRPC=ON \
-DWITH_OTLP_HTTP=ON \
-DWITH_OTLP_FILE=ON \
-DWITH_ASYNC_EXPORT_PREVIEW=ON \
"${SRC_DIR}"
grpc_cpp_plugin=`which grpc_cpp_plugin`
Expand All @@ -382,6 +390,7 @@ elif [[ "$1" == "cmake.do_not_install.test" ]]; then
cmake ${CMAKE_OPTIONS[@]} \
-DWITH_OTLP_GRPC=ON \
-DWITH_OTLP_HTTP=ON \
-DWITH_OTLP_FILE=ON \
-DWITH_ASYNC_EXPORT_PREVIEW=ON \
-DOPENTELEMETRY_INSTALL=OFF \
"${SRC_DIR}"
Expand Down
8 changes: 8 additions & 0 deletions cmake/opentelemetry-cpp-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@
# opentelemetry-cpp::otlp_http_exporter - Imported target of opentelemetry-cpp::otlp_http_exporter
# opentelemetry-cpp::otlp_http_log_record_exporter - Imported target of opentelemetry-cpp::otlp_http_log_record_exporter
# opentelemetry-cpp::otlp_http_metric_exporter - Imported target of opentelemetry-cpp::otlp_http_metric_exporter
# opentelemetry-cpp::otlp_file_client - Imported target of opentelemetry-cpp::otlp_file_client
# opentelemetry-cpp::otlp_file_exporter - Imported target of opentelemetry-cpp::otlp_file_exporter
# opentelemetry-cpp::otlp_file_log_record_exporter - Imported target of opentelemetry-cpp::otlp_file_log_record_exporter
# opentelemetry-cpp::otlp_file_metric_exporter - Imported target of opentelemetry-cpp::otlp_file_metric_exporter
# opentelemetry-cpp::ostream_log_record_exporter - Imported target of opentelemetry-cpp::ostream_log_record_exporter
# opentelemetry-cpp::ostream_metrics_exporter - Imported target of opentelemetry-cpp::ostream_metrics_exporter
# opentelemetry-cpp::ostream_span_exporter - Imported target of opentelemetry-cpp::ostream_span_exporter
Expand Down Expand Up @@ -93,6 +97,10 @@ set(_OPENTELEMETRY_CPP_LIBRARIES_TEST_TARGETS
otlp_http_exporter
otlp_http_log_record_exporter
otlp_http_metric_exporter
otlp_file_client
otlp_file_exporter
otlp_file_log_record_exporter
otlp_file_metric_exporter
ostream_log_record_exporter
ostream_metrics_exporter
ostream_span_exporter
Expand Down
4 changes: 3 additions & 1 deletion exporters/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

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

Expand Down
Loading