diff --git a/CHANGELOG.md b/CHANGELOG.md index 12bdc28c18..9e95bd0fb0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,9 @@ Increment the: ## [Unreleased] +* [SDK] Mark logs signal as stable API/SDK + [#2229](https://github.com/open-telemetry/opentelemetry-cpp/pull/2229) + Breaking changes: * [SDK] Add unit to Instrument selection criteria diff --git a/CMakeLists.txt b/CMakeLists.txt index 4c8c126888..3cd71503cf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -236,7 +236,10 @@ option( option(WITH_FUNC_TESTS "Whether to build functional tests" ON) -option(WITH_LOGS_PREVIEW "Whether to build logs preview" OFF) +if(DEFINED WITH_LOGS_PREVIEW) + message(WARNING "WITH_LOGS_PREVIEW is removed because logs signal is stable") +endif() + option(WITH_ASYNC_EXPORT_PREVIEW "Whether to enable async export" OFF) # EXPERIMENTAL diff --git a/README.md b/README.md index 6dd56949fd..25b9cd8170 100644 --- a/README.md +++ b/README.md @@ -14,12 +14,7 @@ The C++ [OpenTelemetry](https://opentelemetry.io/) client. | ------- | ----------------------- | ------------------------------------------------------------------------ | | Traces | Public Release | N/A | | Metrics | Public Release | N/A | -| Logs | Experimental [1] | [Release Milestone](https://github.com/open-telemetry/opentelemetry-cpp/milestone/18)| - -* [1]: The current Log Signal Implementation is Experimental, and will change as - the current OpenTelemetry Log specification matures. The current - implementation can be included in build by setting `ENABLE_LOGS_PREVIEW` - preprocessor macro. +| Logs | Public Release | N/A | ## Supported C++ Versions diff --git a/api/CMakeLists.txt b/api/CMakeLists.txt index d1a6a77fa3..8a2788ed17 100644 --- a/api/CMakeLists.txt +++ b/api/CMakeLists.txt @@ -17,11 +17,6 @@ if(OPENTELEMETRY_INSTALL) LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) - set(LOGS_EXCLUDE_PATTERN "") - if(NOT WITH_LOGS_PREVIEW) - set(LOGS_EXCLUDE_PATTERN "logs") - endif() - install( DIRECTORY include/opentelemetry DESTINATION include @@ -33,8 +28,7 @@ if(OPENTELEMETRY_INSTALL) DIRECTORY include/opentelemetry DESTINATION include FILES_MATCHING - PATTERN "*.h" - PATTERN "${LOGS_EXCLUDE_PATTERN}" EXCLUDE) + PATTERN "*.h") endif() if(BUILD_TESTING) @@ -79,10 +73,6 @@ if(WITH_GSL) endif() endif() -if(WITH_LOGS_PREVIEW) - target_compile_definitions(opentelemetry_api INTERFACE ENABLE_LOGS_PREVIEW) -endif() - if(WITH_NO_GETENV) target_compile_definitions(opentelemetry_api INTERFACE NO_GETENV) endif() diff --git a/api/include/opentelemetry/logs/event_id.h b/api/include/opentelemetry/logs/event_id.h index 60d020827c..dc07484d09 100644 --- a/api/include/opentelemetry/logs/event_id.h +++ b/api/include/opentelemetry/logs/event_id.h @@ -3,13 +3,11 @@ #pragma once -#ifdef ENABLE_LOGS_PREVIEW +#include -# include - -# include "opentelemetry/nostd/string_view.h" -# include "opentelemetry/nostd/unique_ptr.h" -# include "opentelemetry/version.h" +#include "opentelemetry/nostd/string_view.h" +#include "opentelemetry/nostd/unique_ptr.h" +#include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace logs @@ -37,4 +35,3 @@ class EventId } // namespace logs OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/api/include/opentelemetry/logs/event_logger.h b/api/include/opentelemetry/logs/event_logger.h index c87997816b..2ede6f3fa1 100644 --- a/api/include/opentelemetry/logs/event_logger.h +++ b/api/include/opentelemetry/logs/event_logger.h @@ -2,15 +2,14 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifdef ENABLE_LOGS_PREVIEW -# include "opentelemetry/logs/log_record.h" -# include "opentelemetry/logs/logger.h" -# include "opentelemetry/logs/logger_type_traits.h" -# include "opentelemetry/nostd/shared_ptr.h" -# include "opentelemetry/nostd/string_view.h" -# include "opentelemetry/nostd/unique_ptr.h" -# include "opentelemetry/version.h" +#include "opentelemetry/logs/log_record.h" +#include "opentelemetry/logs/logger.h" +#include "opentelemetry/logs/logger_type_traits.h" +#include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/nostd/string_view.h" +#include "opentelemetry/nostd/unique_ptr.h" +#include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace logs @@ -84,5 +83,3 @@ class EventLogger }; } // namespace logs OPENTELEMETRY_END_NAMESPACE - -#endif diff --git a/api/include/opentelemetry/logs/event_logger_provider.h b/api/include/opentelemetry/logs/event_logger_provider.h index 06170dccab..8fba83c759 100644 --- a/api/include/opentelemetry/logs/event_logger_provider.h +++ b/api/include/opentelemetry/logs/event_logger_provider.h @@ -2,11 +2,10 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifdef ENABLE_LOGS_PREVIEW -# include "opentelemetry/nostd/shared_ptr.h" -# include "opentelemetry/nostd/string_view.h" -# include "opentelemetry/version.h" +#include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/nostd/string_view.h" +#include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace logs @@ -34,4 +33,3 @@ class EventLoggerProvider }; } // namespace logs OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/api/include/opentelemetry/logs/log_record.h b/api/include/opentelemetry/logs/log_record.h index 1014a880bc..81dec568e5 100644 --- a/api/include/opentelemetry/logs/log_record.h +++ b/api/include/opentelemetry/logs/log_record.h @@ -2,11 +2,10 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifdef ENABLE_LOGS_PREVIEW -# include "opentelemetry/common/attribute_value.h" -# include "opentelemetry/common/timestamp.h" -# include "opentelemetry/version.h" +#include "opentelemetry/common/attribute_value.h" +#include "opentelemetry/common/timestamp.h" +#include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace trace @@ -91,4 +90,3 @@ class LogRecord }; } // namespace logs OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/api/include/opentelemetry/logs/logger.h b/api/include/opentelemetry/logs/logger.h index d991a13d88..a2bd2c0bcf 100644 --- a/api/include/opentelemetry/logs/logger.h +++ b/api/include/opentelemetry/logs/logger.h @@ -2,13 +2,12 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifdef ENABLE_LOGS_PREVIEW -# include "opentelemetry/logs/logger_type_traits.h" -# include "opentelemetry/logs/severity.h" -# include "opentelemetry/nostd/string_view.h" -# include "opentelemetry/nostd/unique_ptr.h" -# include "opentelemetry/version.h" +#include "opentelemetry/logs/logger_type_traits.h" +#include "opentelemetry/logs/severity.h" +#include "opentelemetry/nostd/string_view.h" +#include "opentelemetry/nostd/unique_ptr.h" +#include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace common @@ -475,5 +474,3 @@ class Logger }; } // namespace logs OPENTELEMETRY_END_NAMESPACE - -#endif // end of ENABLE_LOGS_PREVIEW diff --git a/api/include/opentelemetry/logs/logger_provider.h b/api/include/opentelemetry/logs/logger_provider.h index e2a72bcc54..ab1493c5cd 100644 --- a/api/include/opentelemetry/logs/logger_provider.h +++ b/api/include/opentelemetry/logs/logger_provider.h @@ -3,15 +3,13 @@ #pragma once -#ifdef ENABLE_LOGS_PREVIEW - -# include "opentelemetry/common/key_value_iterable.h" -# include "opentelemetry/common/key_value_iterable_view.h" -# include "opentelemetry/nostd/shared_ptr.h" -# include "opentelemetry/nostd/span.h" -# include "opentelemetry/nostd/string_view.h" -# include "opentelemetry/nostd/type_traits.h" -# include "opentelemetry/version.h" +#include "opentelemetry/common/key_value_iterable.h" +#include "opentelemetry/common/key_value_iterable_view.h" +#include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/nostd/span.h" +#include "opentelemetry/nostd/string_view.h" +#include "opentelemetry/nostd/type_traits.h" +#include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace logs @@ -71,5 +69,3 @@ class OPENTELEMETRY_EXPORT LoggerProvider }; } // namespace logs OPENTELEMETRY_END_NAMESPACE - -#endif // ENABLE_LOGS_PREVIEW diff --git a/api/include/opentelemetry/logs/logger_type_traits.h b/api/include/opentelemetry/logs/logger_type_traits.h index b1e5e560d3..aea2173689 100644 --- a/api/include/opentelemetry/logs/logger_type_traits.h +++ b/api/include/opentelemetry/logs/logger_type_traits.h @@ -2,24 +2,23 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifdef ENABLE_LOGS_PREVIEW - -# include -# include - -# include "opentelemetry/common/attribute_value.h" -# include "opentelemetry/common/key_value_iterable.h" -# include "opentelemetry/common/timestamp.h" -# include "opentelemetry/logs/event_id.h" -# include "opentelemetry/logs/log_record.h" -# include "opentelemetry/logs/severity.h" -# include "opentelemetry/nostd/string_view.h" -# include "opentelemetry/nostd/type_traits.h" -# include "opentelemetry/trace/span_context.h" -# include "opentelemetry/trace/span_id.h" -# include "opentelemetry/trace/trace_flags.h" -# include "opentelemetry/trace/trace_id.h" -# include "opentelemetry/version.h" + +#include +#include + +#include "opentelemetry/common/attribute_value.h" +#include "opentelemetry/common/key_value_iterable.h" +#include "opentelemetry/common/timestamp.h" +#include "opentelemetry/logs/event_id.h" +#include "opentelemetry/logs/log_record.h" +#include "opentelemetry/logs/severity.h" +#include "opentelemetry/nostd/string_view.h" +#include "opentelemetry/nostd/type_traits.h" +#include "opentelemetry/trace/span_context.h" +#include "opentelemetry/trace/span_id.h" +#include "opentelemetry/trace/trace_flags.h" +#include "opentelemetry/trace/trace_id.h" +#include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace logs @@ -198,5 +197,3 @@ struct LogRecordHasType } // namespace logs OPENTELEMETRY_END_NAMESPACE - -#endif diff --git a/api/include/opentelemetry/logs/noop.h b/api/include/opentelemetry/logs/noop.h index 5303b2e77f..b4590c987f 100644 --- a/api/include/opentelemetry/logs/noop.h +++ b/api/include/opentelemetry/logs/noop.h @@ -2,21 +2,20 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifdef ENABLE_LOGS_PREVIEW // Please refer to provider.h for documentation on how to obtain a Logger object. // // This file is part of the internal implementation of OpenTelemetry. Nothing in this file should be // used directly. Please refer to logger.h for documentation on these interfaces. -# include "opentelemetry/logs/event_logger.h" -# include "opentelemetry/logs/event_logger_provider.h" -# include "opentelemetry/logs/logger.h" -# include "opentelemetry/logs/logger_provider.h" -# include "opentelemetry/nostd/shared_ptr.h" -# include "opentelemetry/nostd/string_view.h" -# include "opentelemetry/nostd/unique_ptr.h" -# include "opentelemetry/version.h" +#include "opentelemetry/logs/event_logger.h" +#include "opentelemetry/logs/event_logger_provider.h" +#include "opentelemetry/logs/logger.h" +#include "opentelemetry/logs/logger_provider.h" +#include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/nostd/string_view.h" +#include "opentelemetry/nostd/unique_ptr.h" +#include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace common @@ -100,4 +99,3 @@ class NoopEventLoggerProvider final : public EventLoggerProvider } // namespace logs OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/api/include/opentelemetry/logs/provider.h b/api/include/opentelemetry/logs/provider.h index a33b26dbac..bced5c97ea 100644 --- a/api/include/opentelemetry/logs/provider.h +++ b/api/include/opentelemetry/logs/provider.h @@ -2,15 +2,14 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifdef ENABLE_LOGS_PREVIEW -# include +#include -# include "opentelemetry/common/macros.h" -# include "opentelemetry/common/spin_lock_mutex.h" -# include "opentelemetry/logs/noop.h" -# include "opentelemetry/nostd/shared_ptr.h" -# include "opentelemetry/version.h" +#include "opentelemetry/common/macros.h" +#include "opentelemetry/common/spin_lock_mutex.h" +#include "opentelemetry/logs/noop.h" +#include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace logs @@ -90,4 +89,3 @@ class OPENTELEMETRY_EXPORT Provider } // namespace logs OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/api/include/opentelemetry/logs/severity.h b/api/include/opentelemetry/logs/severity.h index 6a435f38fc..5247d30be8 100644 --- a/api/include/opentelemetry/logs/severity.h +++ b/api/include/opentelemetry/logs/severity.h @@ -2,10 +2,9 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifdef ENABLE_LOGS_PREVIEW -# include "opentelemetry/nostd/string_view.h" -# include "opentelemetry/version.h" +#include "opentelemetry/nostd/string_view.h" +#include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace logs @@ -64,4 +63,3 @@ const nostd::string_view SeverityNumToText[25] = { } // namespace logs OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/api/test/CMakeLists.txt b/api/test/CMakeLists.txt index 2d051cc726..20c9f4e949 100644 --- a/api/test/CMakeLists.txt +++ b/api/test/CMakeLists.txt @@ -7,9 +7,7 @@ add_subdirectory(plugin) add_subdirectory(nostd) add_subdirectory(trace) add_subdirectory(metrics) -if(WITH_LOGS_PREVIEW) - add_subdirectory(logs) -endif() +add_subdirectory(logs) add_subdirectory(common) add_subdirectory(baggage) add_subdirectory(singleton) diff --git a/api/test/logs/logger_benchmark.cc b/api/test/logs/logger_benchmark.cc index fa5ad2b0c6..098b9c7df8 100644 --- a/api/test/logs/logger_benchmark.cc +++ b/api/test/logs/logger_benchmark.cc @@ -1,21 +1,19 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifdef ENABLE_LOGS_PREVIEW +#include "opentelemetry/common/timestamp.h" +#include "opentelemetry/logs/logger.h" +#include "opentelemetry/logs/provider.h" +#include "opentelemetry/nostd/shared_ptr.h" -# include "opentelemetry/common/timestamp.h" -# include "opentelemetry/logs/logger.h" -# include "opentelemetry/logs/provider.h" -# include "opentelemetry/nostd/shared_ptr.h" +#include +#include +#include +#include +#include +#include -# include -# include -# include -# include -# include -# include - -# include +#include using opentelemetry::logs::EventId; using opentelemetry::logs::Logger; @@ -256,5 +254,3 @@ int main(int argc, char **argv) benchmark::Initialize(&argc, argv); benchmark::RunSpecifiedBenchmarks(); } - -#endif diff --git a/api/test/logs/logger_test.cc b/api/test/logs/logger_test.cc index 789ffd1259..a9567a6d3f 100644 --- a/api/test/logs/logger_test.cc +++ b/api/test/logs/logger_test.cc @@ -1,16 +1,14 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifdef ENABLE_LOGS_PREVIEW +#include +#include +#include -# include -# include -# include - -# include "opentelemetry/common/timestamp.h" -# include "opentelemetry/logs/logger.h" -# include "opentelemetry/logs/provider.h" -# include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/common/timestamp.h" +#include "opentelemetry/logs/logger.h" +#include "opentelemetry/logs/provider.h" +#include "opentelemetry/nostd/shared_ptr.h" using opentelemetry::logs::EventId; using opentelemetry::logs::Logger; @@ -221,4 +219,3 @@ TEST(Logger, PushLoggerImplementation) auto logger = lp->GetLogger("TestLogger", "opentelelemtry_library", "", schema_url); ASSERT_EQ("test logger", logger->GetName()); } -#endif diff --git a/api/test/logs/provider_test.cc b/api/test/logs/provider_test.cc index 27af9b0c43..92c589ef7e 100644 --- a/api/test/logs/provider_test.cc +++ b/api/test/logs/provider_test.cc @@ -1,13 +1,11 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifdef ENABLE_LOGS_PREVIEW +#include +#include -# include -# include - -# include "opentelemetry/logs/provider.h" -# include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/logs/provider.h" +#include "opentelemetry/nostd/shared_ptr.h" using opentelemetry::logs::EventLogger; using opentelemetry::logs::EventLoggerProvider; @@ -108,5 +106,3 @@ TEST(Provider, CreateEventLogger) EXPECT_EQ(nullptr, logger); } - -#endif diff --git a/ci/do_ci.ps1 b/ci/do_ci.ps1 index a91ebc0255..e55cf8e536 100644 --- a/ci/do_ci.ps1 +++ b/ci/do_ci.ps1 @@ -10,7 +10,7 @@ $nproc = (Get-ComputerInfo).CsNumberOfLogicalProcessors $SRC_DIR = (Get-Item -Path ".\").FullName -$BAZEL_OPTIONS = "--copt=-DENABLE_LOGS_PREVIEW --copt=-DENABLE_ASYNC_EXPORT" +$BAZEL_OPTIONS = "--copt=-DENABLE_ASYNC_EXPORT" $BAZEL_TEST_OPTIONS = "$BAZEL_OPTIONS --test_output=errors" if (!(test-path build)) { diff --git a/ci/do_ci.sh b/ci/do_ci.sh index 013a9f0ec8..fce868e37f 100755 --- a/ci/do_ci.sh +++ b/ci/do_ci.sh @@ -69,7 +69,7 @@ fi echo "make command: ${MAKE_COMMAND}" echo "IWYU option: ${IWYU}" -BAZEL_OPTIONS_DEFAULT="--copt=-DENABLE_LOGS_PREVIEW --copt=-DENABLE_TEST --copt=-DENABLE_METRICS_EXEMPLAR_PREVIEW" +BAZEL_OPTIONS_DEFAULT="--copt=-DENABLE_TEST --copt=-DENABLE_METRICS_EXEMPLAR_PREVIEW" BAZEL_OPTIONS="--cxxopt=-std=c++14 $BAZEL_OPTIONS_DEFAULT" BAZEL_TEST_OPTIONS="$BAZEL_OPTIONS --test_output=errors" @@ -94,7 +94,6 @@ if [[ "$1" == "cmake.test" ]]; then -DWITH_ZIPKIN=ON \ -DWITH_ELASTICSEARCH=ON \ -DWITH_METRICS_EXEMPLAR_PREVIEW=ON \ - -DWITH_LOGS_PREVIEW=ON \ -DCMAKE_CXX_FLAGS="-Werror $CXXFLAGS" \ "${SRC_DIR}" make -j $(nproc) @@ -115,7 +114,6 @@ elif [[ "$1" == "cmake.maintainer.sync.test" ]]; then -DWITH_ZIPKIN=ON \ -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 \ @@ -140,7 +138,6 @@ elif [[ "$1" == "cmake.maintainer.async.test" ]]; then -DWITH_ZIPKIN=ON \ -DBUILD_W3CTRACECONTEXT_TEST=ON \ -DWITH_ELASTICSEARCH=ON \ - -DWITH_LOGS_PREVIEW=ON \ -DWITH_METRICS_EXEMPLAR_PREVIEW=ON \ -DWITH_ASYNC_EXPORT_PREVIEW=ON \ -DOTELCPP_MAINTAINER_MODE=ON \ @@ -165,7 +162,6 @@ elif [[ "$1" == "cmake.maintainer.cpp11.async.test" ]]; then -DWITH_ZIPKIN=ON \ -DBUILD_W3CTRACECONTEXT_TEST=ON \ -DWITH_ELASTICSEARCH=ON \ - -DWITH_LOGS_PREVIEW=ON \ -DWITH_METRICS_EXEMPLAR_PREVIEW=ON \ -DWITH_ASYNC_EXPORT_PREVIEW=ON \ -DOTELCPP_MAINTAINER_MODE=ON \ @@ -183,7 +179,6 @@ elif [[ "$1" == "cmake.with_async_export.test" ]]; then -DWITH_ZIPKIN=ON \ -DWITH_ELASTICSEARCH=ON \ -DWITH_METRICS_EXEMPLAR_PREVIEW=ON \ - -DWITH_LOGS_PREVIEW=ON \ -DCMAKE_CXX_FLAGS="-Werror $CXXFLAGS" \ -DWITH_ASYNC_EXPORT_PREVIEW=ON \ "${SRC_DIR}" @@ -196,7 +191,6 @@ elif [[ "$1" == "cmake.abseil.test" ]]; then cmake -DCMAKE_BUILD_TYPE=Debug \ -DCMAKE_CXX_STANDARD=14 \ -DWITH_METRICS_EXEMPLAR_PREVIEW=ON \ - -DWITH_LOGS_PREVIEW=ON \ -DCMAKE_CXX_FLAGS="-Werror $CXXFLAGS" \ -DWITH_ASYNC_EXPORT_PREVIEW=ON \ -DWITH_ABSEIL=ON \ @@ -233,7 +227,6 @@ elif [[ "$1" == "cmake.c++20.stl.test" ]]; then cmake -DCMAKE_BUILD_TYPE=Debug \ -DCMAKE_CXX_STANDARD=20 \ -DWITH_METRICS_EXEMPLAR_PREVIEW=ON \ - -DWITH_LOGS_PREVIEW=ON \ -DCMAKE_CXX_FLAGS="-Werror $CXXFLAGS" \ -DWITH_ASYNC_EXPORT_PREVIEW=ON \ -DWITH_STL=ON \ diff --git a/ci/setup_cmake.sh b/ci/setup_cmake.sh index 7194286b86..0eda07c0ec 100755 --- a/ci/setup_cmake.sh +++ b/ci/setup_cmake.sh @@ -10,7 +10,7 @@ apt-get update if [ "x$CMAKE_VERSION" = "x" ]; then # By default, CMake version set the following version. - export CMAKE_VERSION=3.15.2 + export CMAKE_VERSION=3.16.3 fi if [ -z "${GOOGLETEST_VERSION}" ]; then diff --git a/ci/setup_windows_cmake.ps1 b/ci/setup_windows_cmake.ps1 index 172b126aaa..619a9b7e82 100755 --- a/ci/setup_windows_cmake.ps1 +++ b/ci/setup_windows_cmake.ps1 @@ -4,7 +4,7 @@ $ErrorActionPreference = "Stop" trap { $host.SetShouldExit(1) } -$CMAKE_VERSION="3.15.2" +$CMAKE_VERSION="3.16.3" $CWD=(Get-Item -Path ".\").FullName (new-object System.Net.WebClient). ` DownloadFile("https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-win64-x64.zip", ` diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index fb64ed21c0..6a237af982 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -18,9 +18,7 @@ endif() if(WITH_PROMETHEUS) add_subdirectory(prometheus) endif() -if(WITH_LOGS_PREVIEW) - add_subdirectory(logs_simple) -endif() +add_subdirectory(logs_simple) add_subdirectory(plugin) add_subdirectory(simple) add_subdirectory(batch) diff --git a/examples/common/CMakeLists.txt b/examples/common/CMakeLists.txt index f1e02f8e2d..834980ae4f 100644 --- a/examples/common/CMakeLists.txt +++ b/examples/common/CMakeLists.txt @@ -2,7 +2,5 @@ # SPDX-License-Identifier: Apache-2.0 add_subdirectory(foo_library) -if(WITH_LOGS_PREVIEW) - add_subdirectory(logs_foo_library) -endif() +add_subdirectory(logs_foo_library) add_subdirectory(metrics_foo_library) diff --git a/examples/common/logs_foo_library/foo_library.cc b/examples/common/logs_foo_library/foo_library.cc index e952220108..5fd274193c 100644 --- a/examples/common/logs_foo_library/foo_library.cc +++ b/examples/common/logs_foo_library/foo_library.cc @@ -1,11 +1,11 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifdef ENABLE_LOGS_PREVIEW -# include -# include -# include "opentelemetry/logs/provider.h" -# include "opentelemetry/sdk/version/version.h" -# include "opentelemetry/trace/provider.h" + +#include +#include +#include "opentelemetry/logs/provider.h" +#include "opentelemetry/sdk/version/version.h" +#include "opentelemetry/trace/provider.h" namespace logs = opentelemetry::logs; namespace trace = opentelemetry::trace; @@ -36,4 +36,3 @@ void foo_library() ctx.span_id(), ctx.trace_flags(), opentelemetry::common::SystemTimestamp(std::chrono::system_clock::now())); } -#endif diff --git a/examples/logs_simple/CMakeLists.txt b/examples/logs_simple/CMakeLists.txt index 7b4548ec52..3e62745ccc 100644 --- a/examples/logs_simple/CMakeLists.txt +++ b/examples/logs_simple/CMakeLists.txt @@ -7,16 +7,14 @@ endif() include_directories(${CMAKE_SOURCE_DIR}/exporters/ostream/include) -if(WITH_LOGS_PREVIEW) - add_executable(example_logs_simple main.cc) - target_link_libraries(example_logs_simple ${CMAKE_THREAD_LIBS_INIT} - common_logs_foo_library) +add_executable(example_logs_simple main.cc) +target_link_libraries(example_logs_simple ${CMAKE_THREAD_LIBS_INIT} + common_logs_foo_library) - if(DEFINED OPENTELEMETRY_BUILD_DLL) - target_link_libraries(example_logs_simple opentelemetry_cpp) - else() - target_link_libraries( - example_logs_simple opentelemetry_trace opentelemetry_logs - opentelemetry_exporter_ostream_span opentelemetry_exporter_ostream_logs) - endif() +if(DEFINED OPENTELEMETRY_BUILD_DLL) + target_link_libraries(example_logs_simple opentelemetry_cpp) +else() + target_link_libraries( + example_logs_simple opentelemetry_trace opentelemetry_logs + opentelemetry_exporter_ostream_span opentelemetry_exporter_ostream_logs) endif() diff --git a/examples/logs_simple/main.cc b/examples/logs_simple/main.cc index c12733d4c3..54a872ad0e 100644 --- a/examples/logs_simple/main.cc +++ b/examples/logs_simple/main.cc @@ -1,25 +1,24 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifdef ENABLE_LOGS_PREVIEW -# include "opentelemetry/exporters/ostream/span_exporter_factory.h" -# include "opentelemetry/sdk/trace/exporter.h" -# include "opentelemetry/sdk/trace/processor.h" -# include "opentelemetry/sdk/trace/simple_processor_factory.h" -# include "opentelemetry/sdk/trace/tracer_provider_factory.h" -# include "opentelemetry/trace/provider.h" +#include "opentelemetry/exporters/ostream/span_exporter_factory.h" +#include "opentelemetry/sdk/trace/exporter.h" +#include "opentelemetry/sdk/trace/processor.h" +#include "opentelemetry/sdk/trace/simple_processor_factory.h" +#include "opentelemetry/sdk/trace/tracer_provider_factory.h" +#include "opentelemetry/trace/provider.h" -# include "opentelemetry/exporters/ostream/log_record_exporter.h" -# include "opentelemetry/logs/provider.h" -# include "opentelemetry/sdk/logs/logger_provider_factory.h" -# include "opentelemetry/sdk/logs/processor.h" -# include "opentelemetry/sdk/logs/simple_log_record_processor_factory.h" +#include "opentelemetry/exporters/ostream/log_record_exporter.h" +#include "opentelemetry/logs/provider.h" +#include "opentelemetry/sdk/logs/logger_provider_factory.h" +#include "opentelemetry/sdk/logs/processor.h" +#include "opentelemetry/sdk/logs/simple_log_record_processor_factory.h" -# ifdef BAZEL_BUILD -# include "examples/common/logs_foo_library/foo_library.h" -# else -# include "logs_foo_library/foo_library.h" -# endif +#ifdef BAZEL_BUILD +# include "examples/common/logs_foo_library/foo_library.h" +#else +# include "logs_foo_library/foo_library.h" +#endif namespace logs_api = opentelemetry::logs; namespace logs_sdk = opentelemetry::sdk::logs; @@ -78,9 +77,3 @@ int main() CleanupTracer(); CleanupLogger(); } -#else -int main() -{ - return 0; -} -#endif // ENABLE_LOGS_PREVIEW diff --git a/examples/otlp/CMakeLists.txt b/examples/otlp/CMakeLists.txt index dd8cc054c2..398300ab36 100644 --- a/examples/otlp/CMakeLists.txt +++ b/examples/otlp/CMakeLists.txt @@ -35,18 +35,16 @@ if(WITH_OTLP_GRPC) # LOG - if(WITH_LOGS_PREVIEW) - add_executable(example_otlp_grpc_log grpc_log_main.cc) - - target_link_libraries(example_otlp_grpc_log ${CMAKE_THREAD_LIBS_INIT} - common_logs_foo_library) - if(DEFINED OPENTELEMETRY_BUILD_DLL) - target_link_libraries(example_otlp_grpc_log opentelemetry_cpp) - else() - target_link_libraries( - example_otlp_grpc_log opentelemetry_trace opentelemetry_logs - opentelemetry_exporter_otlp_grpc opentelemetry_exporter_otlp_grpc_log) - endif() + add_executable(example_otlp_grpc_log grpc_log_main.cc) + + target_link_libraries(example_otlp_grpc_log ${CMAKE_THREAD_LIBS_INIT} + common_logs_foo_library) + if(DEFINED OPENTELEMETRY_BUILD_DLL) + target_link_libraries(example_otlp_grpc_log opentelemetry_cpp) + else() + target_link_libraries( + example_otlp_grpc_log opentelemetry_trace opentelemetry_logs + opentelemetry_exporter_otlp_grpc opentelemetry_exporter_otlp_grpc_log) endif() endif() @@ -75,20 +73,18 @@ if(WITH_OTLP_HTTP) # LOG - if(WITH_LOGS_PREVIEW) - add_executable(example_otlp_http_log http_log_main.cc) - target_link_libraries(example_otlp_http_log ${CMAKE_THREAD_LIBS_INIT} - common_logs_foo_library) - - if(DEFINED OPENTELEMETRY_BUILD_DLL) - target_link_libraries(example_otlp_http_log opentelemetry_cpp - opentelemetry_common) - else() - target_link_libraries( - example_otlp_http_log common_logs_foo_library opentelemetry_trace - opentelemetry_logs opentelemetry_exporter_otlp_http - opentelemetry_exporter_otlp_http_log) - endif() + add_executable(example_otlp_http_log http_log_main.cc) + target_link_libraries(example_otlp_http_log ${CMAKE_THREAD_LIBS_INIT} + common_logs_foo_library) + if(DEFINED OPENTELEMETRY_BUILD_DLL) + target_link_libraries(example_otlp_http_log opentelemetry_cpp + opentelemetry_common) + else() + target_link_libraries( + example_otlp_http_log common_logs_foo_library opentelemetry_trace + opentelemetry_logs opentelemetry_exporter_otlp_http + opentelemetry_exporter_otlp_http_log) endif() + endif() diff --git a/examples/otlp/grpc_log_main.cc b/examples/otlp/grpc_log_main.cc index f6f6685922..b1726de358 100644 --- a/examples/otlp/grpc_log_main.cc +++ b/examples/otlp/grpc_log_main.cc @@ -1,32 +1,31 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifdef ENABLE_LOGS_PREVIEW -# include "opentelemetry/exporters/otlp/otlp_grpc_exporter_factory.h" -# include "opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter_factory.h" -# include "opentelemetry/logs/provider.h" -# include "opentelemetry/sdk/logs/exporter.h" -# include "opentelemetry/sdk/logs/logger_provider_factory.h" -# include "opentelemetry/sdk/logs/processor.h" -# include "opentelemetry/sdk/logs/simple_log_record_processor_factory.h" -# include "opentelemetry/sdk/trace/exporter.h" -# include "opentelemetry/sdk/trace/processor.h" -# include "opentelemetry/sdk/trace/simple_processor_factory.h" -# include "opentelemetry/sdk/trace/tracer_provider_factory.h" -# include "opentelemetry/trace/provider.h" +#include "opentelemetry/exporters/otlp/otlp_grpc_exporter_factory.h" +#include "opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter_factory.h" +#include "opentelemetry/logs/provider.h" +#include "opentelemetry/sdk/logs/exporter.h" +#include "opentelemetry/sdk/logs/logger_provider_factory.h" +#include "opentelemetry/sdk/logs/processor.h" +#include "opentelemetry/sdk/logs/simple_log_record_processor_factory.h" +#include "opentelemetry/sdk/trace/exporter.h" +#include "opentelemetry/sdk/trace/processor.h" +#include "opentelemetry/sdk/trace/simple_processor_factory.h" +#include "opentelemetry/sdk/trace/tracer_provider_factory.h" +#include "opentelemetry/trace/provider.h" // sdk::TracerProvider and sdk::LoggerProvider is just used to call ForceFlush and prevent to cancel // running exportings when destroy and shutdown exporters.It's optional to users. -# include "opentelemetry/sdk/logs/logger_provider.h" -# include "opentelemetry/sdk/trace/tracer_provider.h" +#include "opentelemetry/sdk/logs/logger_provider.h" +#include "opentelemetry/sdk/trace/tracer_provider.h" -# include +#include -# ifdef BAZEL_BUILD -# include "examples/common/logs_foo_library/foo_library.h" -# else -# include "logs_foo_library/foo_library.h" -# endif +#ifdef BAZEL_BUILD +# include "examples/common/logs_foo_library/foo_library.h" +#else +# include "logs_foo_library/foo_library.h" +#endif namespace trace = opentelemetry::trace; namespace nostd = opentelemetry::nostd; @@ -106,9 +105,3 @@ int main(int argc, char *argv[]) CleanupTracer(); CleanupLogger(); } -#else -int main() -{ - return 0; -} -#endif diff --git a/examples/otlp/http_log_main.cc b/examples/otlp/http_log_main.cc index 5a5eeb599a..7b68ad44c7 100644 --- a/examples/otlp/http_log_main.cc +++ b/examples/otlp/http_log_main.cc @@ -1,33 +1,32 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifdef ENABLE_LOGS_PREVIEW -# include "opentelemetry/exporters/otlp/otlp_http_exporter_factory.h" -# include "opentelemetry/exporters/otlp/otlp_http_log_record_exporter_factory.h" -# include "opentelemetry/exporters/otlp/otlp_http_log_record_exporter_options.h" -# include "opentelemetry/logs/provider.h" -# include "opentelemetry/sdk/common/global_log_handler.h" -# include "opentelemetry/sdk/logs/logger_provider_factory.h" -# include "opentelemetry/sdk/logs/processor.h" -# include "opentelemetry/sdk/logs/simple_log_record_processor_factory.h" -# include "opentelemetry/sdk/trace/processor.h" -# include "opentelemetry/sdk/trace/simple_processor_factory.h" -# include "opentelemetry/sdk/trace/tracer_provider_factory.h" -# include "opentelemetry/trace/provider.h" +#include "opentelemetry/exporters/otlp/otlp_http_exporter_factory.h" +#include "opentelemetry/exporters/otlp/otlp_http_log_record_exporter_factory.h" +#include "opentelemetry/exporters/otlp/otlp_http_log_record_exporter_options.h" +#include "opentelemetry/logs/provider.h" +#include "opentelemetry/sdk/common/global_log_handler.h" +#include "opentelemetry/sdk/logs/logger_provider_factory.h" +#include "opentelemetry/sdk/logs/processor.h" +#include "opentelemetry/sdk/logs/simple_log_record_processor_factory.h" +#include "opentelemetry/sdk/trace/processor.h" +#include "opentelemetry/sdk/trace/simple_processor_factory.h" +#include "opentelemetry/sdk/trace/tracer_provider_factory.h" +#include "opentelemetry/trace/provider.h" // sdk::TracerProvider and sdk::LoggerProvider is just used to call ForceFlush and prevent to cancel // running exportings when destroy and shutdown exporters.It's optional to users. -# include "opentelemetry/sdk/logs/logger_provider.h" -# include "opentelemetry/sdk/trace/tracer_provider.h" +#include "opentelemetry/sdk/logs/logger_provider.h" +#include "opentelemetry/sdk/trace/tracer_provider.h" -# include -# include +#include +#include -# ifdef BAZEL_BUILD -# include "examples/common/logs_foo_library/foo_library.h" -# else -# include "logs_foo_library/foo_library.h" -# endif +#ifdef BAZEL_BUILD +# include "examples/common/logs_foo_library/foo_library.h" +#else +# include "logs_foo_library/foo_library.h" +#endif namespace trace = opentelemetry::trace; namespace otlp = opentelemetry::exporter::otlp; @@ -154,9 +153,3 @@ int main(int argc, char *argv[]) CleanupTracer(); CleanupLogger(); } -#else -int main() -{ - return 0; -} -#endif diff --git a/exporters/CMakeLists.txt b/exporters/CMakeLists.txt index 78f845aadf..c40ff48654 100644 --- a/exporters/CMakeLists.txt +++ b/exporters/CMakeLists.txt @@ -16,7 +16,7 @@ if(WITH_ZIPKIN) add_subdirectory(zipkin) endif() -if(WITH_ELASTICSEARCH AND WITH_LOGS_PREVIEW) +if(WITH_ELASTICSEARCH) add_subdirectory(elasticsearch) endif() diff --git a/exporters/elasticsearch/include/opentelemetry/exporters/elasticsearch/es_log_record_exporter.h b/exporters/elasticsearch/include/opentelemetry/exporters/elasticsearch/es_log_record_exporter.h index 63e096ff97..8579c99138 100644 --- a/exporters/elasticsearch/include/opentelemetry/exporters/elasticsearch/es_log_record_exporter.h +++ b/exporters/elasticsearch/include/opentelemetry/exporters/elasticsearch/es_log_record_exporter.h @@ -2,22 +2,21 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifdef ENABLE_LOGS_PREVIEW - -# include "nlohmann/json.hpp" -# include "opentelemetry/common/spin_lock_mutex.h" -# include "opentelemetry/ext/http/client/http_client_factory.h" -# include "opentelemetry/nostd/shared_ptr.h" -# include "opentelemetry/nostd/type_traits.h" -# include "opentelemetry/sdk/logs/exporter.h" -# include "opentelemetry/sdk/logs/recordable.h" - -# include -# include -# include -# include -# include -# include + +#include "nlohmann/json.hpp" +#include "opentelemetry/common/spin_lock_mutex.h" +#include "opentelemetry/ext/http/client/http_client_factory.h" +#include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/nostd/type_traits.h" +#include "opentelemetry/sdk/logs/exporter.h" +#include "opentelemetry/sdk/logs/recordable.h" + +#include +#include +#include +#include +#include +#include OPENTELEMETRY_BEGIN_NAMESPACE namespace exporter @@ -122,7 +121,7 @@ class ElasticsearchLogRecordExporter final : public opentelemetry::sdk::logs::Lo mutable opentelemetry::common::SpinLockMutex lock_; bool isShutdown() const noexcept; -# ifdef ENABLE_ASYNC_EXPORT +#ifdef ENABLE_ASYNC_EXPORT struct SynchronizationData { std::atomic session_counter_{0}; @@ -132,9 +131,8 @@ class ElasticsearchLogRecordExporter final : public opentelemetry::sdk::logs::Lo std::recursive_mutex force_flush_m; }; nostd::shared_ptr synchronization_data_; -# endif +#endif }; } // namespace logs } // namespace exporter OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/exporters/elasticsearch/include/opentelemetry/exporters/elasticsearch/es_log_recordable.h b/exporters/elasticsearch/include/opentelemetry/exporters/elasticsearch/es_log_recordable.h index c5be2a2cd8..feb68f7f9c 100644 --- a/exporters/elasticsearch/include/opentelemetry/exporters/elasticsearch/es_log_recordable.h +++ b/exporters/elasticsearch/include/opentelemetry/exporters/elasticsearch/es_log_recordable.h @@ -2,18 +2,17 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifdef ENABLE_LOGS_PREVIEW -# include -# include -# include -# include +#include +#include +#include +#include -# include "nlohmann/json.hpp" -# include "opentelemetry/common/macros.h" -# include "opentelemetry/sdk/common/attribute_utils.h" -# include "opentelemetry/sdk/logs/recordable.h" -# include "opentelemetry/version.h" +#include "nlohmann/json.hpp" +#include "opentelemetry/common/macros.h" +#include "opentelemetry/sdk/common/attribute_utils.h" +#include "opentelemetry/sdk/logs/recordable.h" +#include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace exporter @@ -128,4 +127,3 @@ class ElasticSearchRecordable final : public sdk::logs::Recordable } // namespace logs } // namespace exporter OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/exporters/elasticsearch/src/es_log_record_exporter.cc b/exporters/elasticsearch/src/es_log_record_exporter.cc index 14fd87d600..c90072e4e4 100644 --- a/exporters/elasticsearch/src/es_log_record_exporter.cc +++ b/exporters/elasticsearch/src/es_log_record_exporter.cc @@ -1,15 +1,13 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifdef ENABLE_LOGS_PREVIEW +#include // std::stringstream -# include // std::stringstream - -# include -# include -# include "opentelemetry/exporters/elasticsearch/es_log_record_exporter.h" -# include "opentelemetry/exporters/elasticsearch/es_log_recordable.h" -# include "opentelemetry/sdk_config.h" +#include +#include +#include "opentelemetry/exporters/elasticsearch/es_log_record_exporter.h" +#include "opentelemetry/exporters/elasticsearch/es_log_recordable.h" +#include "opentelemetry/sdk_config.h" namespace nostd = opentelemetry::nostd; namespace sdklogs = opentelemetry::sdk::logs; @@ -182,7 +180,7 @@ class ResponseHandler : public http_client::EventHandler bool console_debug_ = false; }; -# ifdef ENABLE_ASYNC_EXPORT +#ifdef ENABLE_ASYNC_EXPORT /** * This class handles the async response message from the Elasticsearch request */ @@ -287,21 +285,21 @@ class AsyncResponseHandler : public http_client::EventHandler // Whether to print the results from the callback bool console_debug_ = false; }; -# endif +#endif ElasticsearchLogRecordExporter::ElasticsearchLogRecordExporter() : options_{ElasticsearchExporterOptions()}, http_client_ { ext::http::client::HttpClientFactory::Create() } -# ifdef ENABLE_ASYNC_EXPORT +#ifdef ENABLE_ASYNC_EXPORT , synchronization_data_(new SynchronizationData()) -# endif +#endif { -# ifdef ENABLE_ASYNC_EXPORT +#ifdef ENABLE_ASYNC_EXPORT synchronization_data_->finished_session_counter_.store(0); synchronization_data_->session_counter_.store(0); -# endif +#endif } ElasticsearchLogRecordExporter::ElasticsearchLogRecordExporter( @@ -351,7 +349,7 @@ sdk::common::ExportResult ElasticsearchLogRecordExporter::Export( std::vector body_vec(body.begin(), body.end()); request->SetBody(body_vec); -# ifdef ENABLE_ASYNC_EXPORT +#ifdef ENABLE_ASYNC_EXPORT // Send the request synchronization_data_->session_counter_.fetch_add(1, std::memory_order_release); std::size_t span_count = records.size(); @@ -378,7 +376,7 @@ sdk::common::ExportResult ElasticsearchLogRecordExporter::Export( options_.console_debug_); session->SendRequest(handler); return sdk::common::ExportResult::kSuccess; -# else +#else // Send the request auto handler = std::make_shared(options_.console_debug_); session->SendRequest(handler); @@ -413,13 +411,13 @@ sdk::common::ExportResult ElasticsearchLogRecordExporter::Export( } return sdk::common::ExportResult::kSuccess; -# endif +#endif } bool ElasticsearchLogRecordExporter::ForceFlush( std::chrono::microseconds timeout OPENTELEMETRY_MAYBE_UNUSED) noexcept { -# ifdef ENABLE_ASYNC_EXPORT +#ifdef ENABLE_ASYNC_EXPORT std::lock_guard lock_guard{synchronization_data_->force_flush_m}; std::size_t running_counter = synchronization_data_->session_counter_.load(std::memory_order_acquire); @@ -455,9 +453,9 @@ bool ElasticsearchLogRecordExporter::ForceFlush( } return timeout_steady > std::chrono::steady_clock::duration::zero(); -# else +#else return true; -# endif +#endif } bool ElasticsearchLogRecordExporter::Shutdown(std::chrono::microseconds /* timeout */) noexcept @@ -480,4 +478,3 @@ bool ElasticsearchLogRecordExporter::isShutdown() const noexcept } // namespace logs } // namespace exporter OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/exporters/elasticsearch/src/es_log_recordable.cc b/exporters/elasticsearch/src/es_log_recordable.cc index e3f60be0a9..139d22e863 100644 --- a/exporters/elasticsearch/src/es_log_recordable.cc +++ b/exporters/elasticsearch/src/es_log_recordable.cc @@ -1,15 +1,13 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifdef ENABLE_LOGS_PREVIEW - -# include "opentelemetry/exporters/elasticsearch/es_log_recordable.h" -# include "opentelemetry/logs/severity.h" -# include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h" -# include "opentelemetry/sdk/resource/resource.h" -# include "opentelemetry/trace/span_id.h" -# include "opentelemetry/trace/trace_flags.h" -# include "opentelemetry/trace/trace_id.h" +#include "opentelemetry/exporters/elasticsearch/es_log_recordable.h" +#include "opentelemetry/logs/severity.h" +#include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h" +#include "opentelemetry/sdk/resource/resource.h" +#include "opentelemetry/trace/span_id.h" +#include "opentelemetry/trace/trace_flags.h" +#include "opentelemetry/trace/trace_id.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace exporter @@ -299,4 +297,3 @@ void ElasticSearchRecordable::SetInstrumentationScope( } // namespace logs } // namespace exporter OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/exporters/elasticsearch/test/es_log_record_exporter_test.cc b/exporters/elasticsearch/test/es_log_record_exporter_test.cc index cc9af2ee2d..8a1c81da48 100644 --- a/exporters/elasticsearch/test/es_log_record_exporter_test.cc +++ b/exporters/elasticsearch/test/es_log_record_exporter_test.cc @@ -1,17 +1,15 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifdef ENABLE_LOGS_PREVIEW +#include "opentelemetry/exporters/elasticsearch/es_log_record_exporter.h" +#include "opentelemetry/ext/http/server/http_server.h" +#include "opentelemetry/logs/provider.h" +#include "opentelemetry/sdk/logs/exporter.h" +#include "opentelemetry/sdk/logs/logger_provider.h" +#include "opentelemetry/sdk/logs/simple_log_record_processor.h" -# include "opentelemetry/exporters/elasticsearch/es_log_record_exporter.h" -# include "opentelemetry/ext/http/server/http_server.h" -# include "opentelemetry/logs/provider.h" -# include "opentelemetry/sdk/logs/exporter.h" -# include "opentelemetry/sdk/logs/logger_provider.h" -# include "opentelemetry/sdk/logs/simple_log_record_processor.h" - -# include -# include +#include +#include namespace sdklogs = opentelemetry::sdk::logs; namespace logs_api = opentelemetry::logs; @@ -23,7 +21,7 @@ TEST(ElasticsearchLogsExporterTests, Dummy) // to enable linking } -# if 0 +#if 0 // Attempt to write a log to an invalid host/port, test that the Export() returns failure TEST(ElasticsearchLogsExporterTests, InvalidEndpoint) { @@ -81,5 +79,4 @@ TEST(ElasticsearchLogsExporterTests, RecordableCreation) exporter->Export(nostd::span>(&record, 1)); } -# endif #endif diff --git a/exporters/etw/CMakeLists.txt b/exporters/etw/CMakeLists.txt index b74a1b2cb5..947e390dd9 100644 --- a/exporters/etw/CMakeLists.txt +++ b/exporters/etw/CMakeLists.txt @@ -14,9 +14,7 @@ set_target_properties(opentelemetry_exporter_etw PROPERTIES EXPORT_NAME target_link_libraries( opentelemetry_exporter_etw INTERFACE opentelemetry_api opentelemetry_trace nlohmann_json::nlohmann_json) -if(WITH_LOGS_PREVIEW) - target_link_libraries(opentelemetry_exporter_etw INTERFACE opentelemetry_logs) -endif() +target_link_libraries(opentelemetry_exporter_etw INTERFACE opentelemetry_logs) if(nlohmann_json_clone) add_dependencies(opentelemetry_exporter_etw nlohmann_json::nlohmann_json) endif() diff --git a/exporters/etw/include/opentelemetry/exporters/etw/etw_logger.h b/exporters/etw/include/opentelemetry/exporters/etw/etw_logger.h index 8040032597..819caf7105 100644 --- a/exporters/etw/include/opentelemetry/exporters/etw/etw_logger.h +++ b/exporters/etw/include/opentelemetry/exporters/etw/etw_logger.h @@ -2,39 +2,40 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifdef ENABLE_LOGS_PREVIEW -# include +#include -# include -# include -# include -# include -# include -# include +#include +#include +#include +#include +#include +#include -# include +#include -# include -# include +#include +#include -# include "opentelemetry/nostd/shared_ptr.h" -# include "opentelemetry/nostd/string_view.h" -# include "opentelemetry/nostd/unique_ptr.h" -# include "opentelemetry/nostd/variant.h" +#include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/nostd/string_view.h" +#include "opentelemetry/nostd/unique_ptr.h" +#include "opentelemetry/nostd/variant.h" -# include "opentelemetry/common/key_value_iterable_view.h" +#include "opentelemetry/common/key_value_iterable_view.h" -# include "opentelemetry/logs/log_record.h" -# include "opentelemetry/logs/logger_provider.h" -# include "opentelemetry/trace/span_id.h" -# include "opentelemetry/trace/trace_id.h" +#include "opentelemetry/logs/log_record.h" +#include "opentelemetry/logs/logger.h" +#include "opentelemetry/logs/logger_provider.h" +#include "opentelemetry/logs/severity.h" +#include "opentelemetry/trace/span_id.h" +#include "opentelemetry/trace/trace_id.h" -# include "opentelemetry/exporters/etw/etw_config.h" -# include "opentelemetry/exporters/etw/etw_fields.h" -# include "opentelemetry/exporters/etw/etw_properties.h" -# include "opentelemetry/exporters/etw/etw_provider.h" -# include "opentelemetry/exporters/etw/utils.h" +#include "opentelemetry/exporters/etw/etw_config.h" +#include "opentelemetry/exporters/etw/etw_fields.h" +#include "opentelemetry/exporters/etw/etw_properties.h" +#include "opentelemetry/exporters/etw/etw_provider.h" +#include "opentelemetry/exporters/etw/utils.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace exporter @@ -86,6 +87,8 @@ class LogRecord : public opentelemetry::logs::LogRecord attributes_map_[static_cast(key)] = value; } + void SetEventId(int64_t /* id */, nostd::string_view /* name */) noexcept override {} + const std::unordered_map &GetAttributes() const noexcept { @@ -230,7 +233,7 @@ class Logger : public opentelemetry::logs::Logger { UNREFERENCED_PARAMETER(trace_flags); -# if defined(ENABLE_ENV_PROPERTIES) +#if defined(ENABLE_ENV_PROPERTIES) Properties env_properties_env = {}; bool has_customer_attribute = false; @@ -261,22 +264,22 @@ class Logger : public opentelemetry::logs::Logger Properties &evt = has_customer_attribute ? env_properties_env : input_evt; -# else +#else Properties &evt = input_evt; -# endif // defined(ENABLE_ENV_PROPERTIES) +#endif // defined(ENABLE_ENV_PROPERTIES) // Populate Etw.EventName attribute at envelope level evt[ETW_FIELD_NAME] = ETW_VALUE_LOG; -# ifdef HAVE_FIELD_TIME +#ifdef HAVE_FIELD_TIME { auto timeNow = std::chrono::system_clock::now().time_since_epoch(); auto nanos = std::chrono::duration_cast(timeNow).count(); evt[ETW_FIELD_TIME] = utils::formatUtcTimestampNsAsISO8601(nanos); } -# endif +#endif const auto &cfg = GetConfiguration(loggerProvider_); if (cfg.enableSpanId) { @@ -374,4 +377,3 @@ class LoggerProvider : public opentelemetry::logs::LoggerProvider } // namespace etw } // namespace exporter OPENTELEMETRY_END_NAMESPACE -#endif // ENABLE_LOGS_PREVIEW diff --git a/exporters/etw/include/opentelemetry/exporters/etw/etw_logger_exporter.h b/exporters/etw/include/opentelemetry/exporters/etw/etw_logger_exporter.h index 9b96cb27a5..d9f8ec2309 100644 --- a/exporters/etw/include/opentelemetry/exporters/etw/etw_logger_exporter.h +++ b/exporters/etw/include/opentelemetry/exporters/etw/etw_logger_exporter.h @@ -2,29 +2,26 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifdef ENABLE_LOGS_PREVIEW -# include -# include -# include +#include +#include +#include -# include +#include -# include "opentelemetry/nostd/shared_ptr.h" -# include "opentelemetry/nostd/string_view.h" -# include "opentelemetry/nostd/unique_ptr.h" +#include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/nostd/string_view.h" +#include "opentelemetry/nostd/unique_ptr.h" -# include "opentelemetry/common/key_value_iterable_view.h" +#include "opentelemetry/common/key_value_iterable_view.h" -# include "opentelemetry/logs/logger_provider.h" -# include "opentelemetry/trace/span_id.h" -# include "opentelemetry/trace/trace_id.h" +#include "opentelemetry/logs/logger_provider.h" +#include "opentelemetry/trace/span_id.h" +#include "opentelemetry/trace/trace_id.h" -# include "opentelemetry/sdk/logs/exporter.h" +#include "opentelemetry/sdk/logs/exporter.h" -# include "opentelemetry/exporters/etw/etw_config.h" -# include "opentelemetry/exporters/etw/etw_logger.h" -# include "opentelemetry/exporters/etw/etw_provider.h" +#include "opentelemetry/exporters/etw/etw_config.h" +#include "opentelemetry/exporters/etw/etw_logger.h" +#include "opentelemetry/exporters/etw/etw_provider.h" -# include "opentelemetry/exporters/etw/utils.h" - -#endif // ENABLE_LOGS_PREVIEW +#include "opentelemetry/exporters/etw/utils.h" diff --git a/exporters/etw/test/etw_logger_test.cc b/exporters/etw/test/etw_logger_test.cc index 2c17dc846e..f27d47880b 100644 --- a/exporters/etw/test/etw_logger_test.cc +++ b/exporters/etw/test/etw_logger_test.cc @@ -1,15 +1,14 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifdef ENABLE_LOGS_PREVIEW -# ifdef _WIN32 +#ifdef _WIN32 -# include -# include -# include +# include +# include +# include -# include "opentelemetry/exporters/etw/etw_logger_exporter.h" -# include "opentelemetry/sdk/trace/simple_processor.h" +# include "opentelemetry/exporters/etw/etw_logger_exporter.h" +# include "opentelemetry/sdk/trace/simple_processor.h" using namespace OPENTELEMETRY_NAMESPACE; @@ -99,5 +98,4 @@ TEST(ETWLogger, LoggerCheckWithAttributes) opentelemetry::common::MakeAttributes(attribs))); } -# endif // _WIN32 -#endif // ENABLE_LOGS_PREVIEW +#endif // _WIN32 diff --git a/exporters/ostream/CMakeLists.txt b/exporters/ostream/CMakeLists.txt index 478c6b7ec2..e08d6592a3 100644 --- a/exporters/ostream/CMakeLists.txt +++ b/exporters/ostream/CMakeLists.txt @@ -76,40 +76,38 @@ if(BUILD_TESTING) TEST_LIST ostream_metric_test) endif() -if(WITH_LOGS_PREVIEW) - add_library(opentelemetry_exporter_ostream_logs - src/log_record_exporter.cc src/log_record_exporter_factory.cc) - set_target_properties(opentelemetry_exporter_ostream_logs - PROPERTIES EXPORT_NAME ostream_log_record_exporter) - set_target_version(opentelemetry_exporter_ostream_logs) +add_library(opentelemetry_exporter_ostream_logs + src/log_record_exporter.cc src/log_record_exporter_factory.cc) +set_target_properties(opentelemetry_exporter_ostream_logs + PROPERTIES EXPORT_NAME ostream_log_record_exporter) +set_target_version(opentelemetry_exporter_ostream_logs) - target_include_directories( - opentelemetry_exporter_ostream_logs - PUBLIC "$") - target_link_libraries(opentelemetry_exporter_ostream_logs - PUBLIC opentelemetry_logs) +target_include_directories( + opentelemetry_exporter_ostream_logs + PUBLIC "$") +target_link_libraries(opentelemetry_exporter_ostream_logs + PUBLIC opentelemetry_logs) - if(OPENTELEMETRY_INSTALL) - install( - TARGETS opentelemetry_exporter_ostream_logs - EXPORT "${PROJECT_NAME}-target" - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) - install( - FILES - "include/opentelemetry/exporters/ostream/log_record_exporter.h" - "include/opentelemetry/exporters/ostream/log_record_exporter_factory.h" - DESTINATION include/opentelemetry/exporters/ostream) - endif() +if(OPENTELEMETRY_INSTALL) + install( + TARGETS opentelemetry_exporter_ostream_logs + EXPORT "${PROJECT_NAME}-target" + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + install( + FILES + "include/opentelemetry/exporters/ostream/log_record_exporter.h" + "include/opentelemetry/exporters/ostream/log_record_exporter_factory.h" + DESTINATION include/opentelemetry/exporters/ostream) +endif() - if(BUILD_TESTING) - add_executable(ostream_log_test test/ostream_log_test.cc) - target_link_libraries(ostream_log_test ${GTEST_BOTH_LIBRARIES} - opentelemetry_exporter_ostream_logs) - gtest_add_tests( - TARGET ostream_log_test - TEST_PREFIX exporter. - TEST_LIST ostream_log_test) - endif() +if(BUILD_TESTING) + add_executable(ostream_log_test test/ostream_log_test.cc) + target_link_libraries(ostream_log_test ${GTEST_BOTH_LIBRARIES} + opentelemetry_exporter_ostream_logs) + gtest_add_tests( + TARGET ostream_log_test + TEST_PREFIX exporter. + TEST_LIST ostream_log_test) endif() diff --git a/exporters/ostream/include/opentelemetry/exporters/ostream/log_record_exporter.h b/exporters/ostream/include/opentelemetry/exporters/ostream/log_record_exporter.h index 54dae898d2..7b196ec9e8 100644 --- a/exporters/ostream/include/opentelemetry/exporters/ostream/log_record_exporter.h +++ b/exporters/ostream/include/opentelemetry/exporters/ostream/log_record_exporter.h @@ -2,19 +2,18 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifdef ENABLE_LOGS_PREVIEW -# include "opentelemetry/common/attribute_value.h" -# include "opentelemetry/common/spin_lock_mutex.h" -# include "opentelemetry/nostd/type_traits.h" -# include "opentelemetry/sdk/common/attribute_utils.h" -# include "opentelemetry/sdk/logs/exporter.h" +#include "opentelemetry/common/attribute_value.h" +#include "opentelemetry/common/spin_lock_mutex.h" +#include "opentelemetry/nostd/type_traits.h" +#include "opentelemetry/sdk/common/attribute_utils.h" +#include "opentelemetry/sdk/logs/exporter.h" -# include "opentelemetry/version.h" +#include "opentelemetry/version.h" -# include -# include -# include +#include +#include +#include OPENTELEMETRY_BEGIN_NAMESPACE namespace exporter @@ -73,4 +72,3 @@ class OStreamLogRecordExporter final : public opentelemetry::sdk::logs::LogRecor } // namespace logs } // namespace exporter OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/exporters/ostream/include/opentelemetry/exporters/ostream/log_record_exporter_factory.h b/exporters/ostream/include/opentelemetry/exporters/ostream/log_record_exporter_factory.h index 4c7d403d41..143a481801 100644 --- a/exporters/ostream/include/opentelemetry/exporters/ostream/log_record_exporter_factory.h +++ b/exporters/ostream/include/opentelemetry/exporters/ostream/log_record_exporter_factory.h @@ -3,11 +3,10 @@ #pragma once -#ifdef ENABLE_LOGS_PREVIEW -# include -# include +#include +#include -# include "opentelemetry/sdk/version/version.h" +#include "opentelemetry/sdk/version/version.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -43,4 +42,3 @@ class OPENTELEMETRY_EXPORT OStreamLogRecordExporterFactory } // namespace logs } // namespace exporter OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/exporters/ostream/src/log_record_exporter.cc b/exporters/ostream/src/log_record_exporter.cc index 611a749184..7edae02b43 100644 --- a/exporters/ostream/src/log_record_exporter.cc +++ b/exporters/ostream/src/log_record_exporter.cc @@ -1,17 +1,16 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifdef ENABLE_LOGS_PREVIEW -# include "opentelemetry/exporters/ostream/log_record_exporter.h" -# include "opentelemetry/exporters/ostream/common_utils.h" -# include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h" -# include "opentelemetry/sdk/logs/read_write_log_record.h" -# include "opentelemetry/sdk/resource/resource.h" -# include "opentelemetry/sdk_config.h" - -# include -# include -# include +#include "opentelemetry/exporters/ostream/log_record_exporter.h" +#include "opentelemetry/exporters/ostream/common_utils.h" +#include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h" +#include "opentelemetry/sdk/logs/read_write_log_record.h" +#include "opentelemetry/sdk/resource/resource.h" +#include "opentelemetry/sdk_config.h" + +#include +#include +#include namespace nostd = opentelemetry::nostd; namespace sdklogs = opentelemetry::sdk::logs; @@ -163,4 +162,3 @@ void OStreamLogRecordExporter::printAttributes( } // namespace logs } // namespace exporter OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/exporters/ostream/src/log_record_exporter_factory.cc b/exporters/ostream/src/log_record_exporter_factory.cc index 884f59a9a1..66ea1a0232 100644 --- a/exporters/ostream/src/log_record_exporter_factory.cc +++ b/exporters/ostream/src/log_record_exporter_factory.cc @@ -1,9 +1,8 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifdef ENABLE_LOGS_PREVIEW -# include "opentelemetry/exporters/ostream/log_record_exporter_factory.h" -# include "opentelemetry/exporters/ostream/log_record_exporter.h" +#include "opentelemetry/exporters/ostream/log_record_exporter_factory.h" +#include "opentelemetry/exporters/ostream/log_record_exporter.h" namespace logs_sdk = opentelemetry::sdk::logs; @@ -28,4 +27,3 @@ std::unique_ptr OStreamLogRecordExporterFactory::Cr } // namespace logs } // namespace exporter OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/exporters/ostream/test/ostream_log_test.cc b/exporters/ostream/test/ostream_log_test.cc index c092ec01c3..064cd1103a 100644 --- a/exporters/ostream/test/ostream_log_test.cc +++ b/exporters/ostream/test/ostream_log_test.cc @@ -1,22 +1,29 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifdef ENABLE_LOGS_PREVIEW - -# include "opentelemetry/exporters/ostream/log_record_exporter.h" -# include "opentelemetry/exporters/ostream/log_record_exporter_factory.h" -# include "opentelemetry/logs/provider.h" -# include "opentelemetry/nostd/span.h" -# include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h" -# include "opentelemetry/sdk/logs/logger_provider.h" -# include "opentelemetry/sdk/logs/read_write_log_record.h" -# include "opentelemetry/sdk/logs/simple_log_record_processor.h" -# include "opentelemetry/sdk/version/version.h" - -# include - -# include -# include +#include "opentelemetry/exporters/ostream/log_record_exporter.h" +#include "opentelemetry/logs/provider.h" +#include "opentelemetry/nostd/span.h" +#include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h" +#include "opentelemetry/sdk/logs/logger_provider.h" +#include "opentelemetry/sdk/logs/read_write_log_record.h" +#include "opentelemetry/sdk/logs/simple_log_record_processor.h" +#include "opentelemetry/sdk/version/version.h" + +#include "opentelemetry/exporters/ostream/log_record_exporter.h" +#include "opentelemetry/exporters/ostream/log_record_exporter_factory.h" +#include "opentelemetry/logs/provider.h" +#include "opentelemetry/nostd/span.h" +#include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h" +#include "opentelemetry/sdk/logs/logger_provider.h" +#include "opentelemetry/sdk/logs/read_write_log_record.h" +#include "opentelemetry/sdk/logs/simple_log_record_processor.h" +#include "opentelemetry/sdk/version/version.h" + +#include +#include + +#include namespace sdklogs = opentelemetry::sdk::logs; namespace logs_api = opentelemetry::logs; @@ -518,4 +525,3 @@ TEST(OStreamLogRecordExporter, Factory) } // namespace logs } // namespace exporter OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/exporters/otlp/CMakeLists.txt b/exporters/otlp/CMakeLists.txt index e05b0e24f4..44715c1753 100644 --- a/exporters/otlp/CMakeLists.txt +++ b/exporters/otlp/CMakeLists.txt @@ -17,9 +17,7 @@ target_include_directories( set(OPENTELEMETRY_OTLP_TARGETS opentelemetry_otlp_recordable) -if(WITH_LOGS_PREVIEW) - target_link_libraries(opentelemetry_otlp_recordable PUBLIC opentelemetry_logs) -endif() +target_link_libraries(opentelemetry_otlp_recordable PUBLIC opentelemetry_logs) target_link_libraries(opentelemetry_otlp_recordable PUBLIC opentelemetry_metrics) @@ -142,24 +140,22 @@ if(WITH_OTLP_HTTP) list(APPEND OPENTELEMETRY_OTLP_TARGETS opentelemetry_exporter_otlp_http) - if(WITH_LOGS_PREVIEW) - add_library( - opentelemetry_exporter_otlp_http_log - src/otlp_http_log_record_exporter.cc - src/otlp_http_log_record_exporter_factory.cc) + add_library( + opentelemetry_exporter_otlp_http_log + src/otlp_http_log_record_exporter.cc + src/otlp_http_log_record_exporter_factory.cc) - set_target_properties(opentelemetry_exporter_otlp_http_log - PROPERTIES EXPORT_NAME otlp_http_log_record_exporter) - set_target_version(opentelemetry_exporter_otlp_http_log) + set_target_properties(opentelemetry_exporter_otlp_http_log + PROPERTIES EXPORT_NAME otlp_http_log_record_exporter) + set_target_version(opentelemetry_exporter_otlp_http_log) - target_link_libraries( - opentelemetry_exporter_otlp_http_log - PUBLIC opentelemetry_otlp_recordable - opentelemetry_exporter_otlp_http_client) + target_link_libraries( + opentelemetry_exporter_otlp_http_log + PUBLIC opentelemetry_otlp_recordable + opentelemetry_exporter_otlp_http_client) - list(APPEND OPENTELEMETRY_OTLP_TARGETS opentelemetry_exporter_otlp_http_log) + list(APPEND OPENTELEMETRY_OTLP_TARGETS opentelemetry_exporter_otlp_http_log) - endif() add_library( opentelemetry_exporter_otlp_http_metric src/otlp_http_metric_exporter.cc src/otlp_http_metric_exporter_factory.cc) @@ -206,16 +202,13 @@ if(BUILD_TESTING) TEST_PREFIX exporter.otlp. TEST_LIST otlp_recordable_test) - if(WITH_LOGS_PREVIEW) - add_executable(otlp_log_recordable_test test/otlp_log_recordable_test.cc) - target_link_libraries( - otlp_log_recordable_test ${GTEST_BOTH_LIBRARIES} - ${CMAKE_THREAD_LIBS_INIT} opentelemetry_otlp_recordable) - gtest_add_tests( - TARGET otlp_log_recordable_test - TEST_PREFIX exporter.otlp. - TEST_LIST otlp_log_recordable_test) - endif() + add_executable(otlp_log_recordable_test test/otlp_log_recordable_test.cc) + target_link_libraries(otlp_log_recordable_test ${GTEST_BOTH_LIBRARIES} + ${CMAKE_THREAD_LIBS_INIT} opentelemetry_otlp_recordable) + gtest_add_tests( + TARGET otlp_log_recordable_test + TEST_PREFIX exporter.otlp. + TEST_LIST otlp_log_recordable_test) add_executable(otlp_metrics_serialization_test test/otlp_metrics_serialization_test.cc) @@ -267,34 +260,32 @@ if(BUILD_TESTING) TEST_PREFIX exporter.otlp. TEST_LIST otlp_grpc_exporter_factory_test) - if(WITH_LOGS_PREVIEW) - add_executable(otlp_grpc_log_record_exporter_test - test/otlp_grpc_log_record_exporter_test.cc) - target_link_libraries( - otlp_grpc_log_record_exporter_test - ${GTEST_BOTH_LIBRARIES} - ${CMAKE_THREAD_LIBS_INIT} - ${GMOCK_LIB} - opentelemetry_exporter_otlp_grpc - opentelemetry_exporter_otlp_grpc_log - opentelemetry_trace - opentelemetry_logs) - gtest_add_tests( - TARGET otlp_grpc_log_record_exporter_test - TEST_PREFIX exporter.otlp. - TEST_LIST otlp_grpc_log_record_exporter_test) - - add_executable(otlp_grpc_log_record_exporter_factory_test - test/otlp_grpc_log_record_exporter_factory_test.cc) - target_link_libraries( - otlp_grpc_log_record_exporter_factory_test ${GTEST_BOTH_LIBRARIES} - ${CMAKE_THREAD_LIBS_INIT} ${GMOCK_LIB} - opentelemetry_exporter_otlp_grpc_log opentelemetry_logs) - gtest_add_tests( - TARGET otlp_grpc_log_record_exporter_factory_test - TEST_PREFIX exporter.otlp. - TEST_LIST otlp_grpc_log_record_exporter_factory_test) - endif() + add_executable(otlp_grpc_log_record_exporter_test + test/otlp_grpc_log_record_exporter_test.cc) + target_link_libraries( + otlp_grpc_log_record_exporter_test + ${GTEST_BOTH_LIBRARIES} + ${CMAKE_THREAD_LIBS_INIT} + ${GMOCK_LIB} + opentelemetry_exporter_otlp_grpc + opentelemetry_exporter_otlp_grpc_log + opentelemetry_trace + opentelemetry_logs) + gtest_add_tests( + TARGET otlp_grpc_log_record_exporter_test + TEST_PREFIX exporter.otlp. + TEST_LIST otlp_grpc_log_record_exporter_test) + + add_executable(otlp_grpc_log_record_exporter_factory_test + test/otlp_grpc_log_record_exporter_factory_test.cc) + target_link_libraries( + otlp_grpc_log_record_exporter_factory_test ${GTEST_BOTH_LIBRARIES} + ${CMAKE_THREAD_LIBS_INIT} ${GMOCK_LIB} + opentelemetry_exporter_otlp_grpc_log opentelemetry_logs) + gtest_add_tests( + TARGET otlp_grpc_log_record_exporter_factory_test + TEST_PREFIX exporter.otlp. + TEST_LIST otlp_grpc_log_record_exporter_factory_test) add_executable(otlp_grpc_metric_exporter_factory_test test/otlp_grpc_metric_exporter_factory_test.cc) @@ -334,33 +325,31 @@ if(BUILD_TESTING) TEST_PREFIX exporter.otlp. TEST_LIST otlp_http_exporter_factory_test) - if(WITH_LOGS_PREVIEW) - add_executable(otlp_http_log_record_exporter_test - test/otlp_http_log_record_exporter_test.cc) - target_link_libraries( - otlp_http_log_record_exporter_test - ${GTEST_BOTH_LIBRARIES} - ${CMAKE_THREAD_LIBS_INIT} - ${GMOCK_LIB} - opentelemetry_exporter_otlp_http_log - opentelemetry_logs - opentelemetry_http_client_nosend) - gtest_add_tests( - TARGET otlp_http_log_record_exporter_test - TEST_PREFIX exporter.otlp. - TEST_LIST otlp_http_log_record_exporter_test) - - add_executable(otlp_http_log_record_exporter_factory_test - test/otlp_http_log_record_exporter_factory_test.cc) - target_link_libraries( - otlp_http_log_record_exporter_factory_test ${GTEST_BOTH_LIBRARIES} - ${CMAKE_THREAD_LIBS_INIT} ${GMOCK_LIB} - opentelemetry_exporter_otlp_http_log opentelemetry_logs) - gtest_add_tests( - TARGET otlp_http_log_record_exporter_factory_test - TEST_PREFIX exporter.otlp. - TEST_LIST otlp_http_log_record_exporter_factory_test) - endif() + add_executable(otlp_http_log_record_exporter_test + test/otlp_http_log_record_exporter_test.cc) + target_link_libraries( + otlp_http_log_record_exporter_test + ${GTEST_BOTH_LIBRARIES} + ${CMAKE_THREAD_LIBS_INIT} + ${GMOCK_LIB} + opentelemetry_exporter_otlp_http_log + opentelemetry_logs + opentelemetry_http_client_nosend) + gtest_add_tests( + TARGET otlp_http_log_record_exporter_test + TEST_PREFIX exporter.otlp. + TEST_LIST otlp_http_log_record_exporter_test) + + add_executable(otlp_http_log_record_exporter_factory_test + test/otlp_http_log_record_exporter_factory_test.cc) + target_link_libraries( + otlp_http_log_record_exporter_factory_test ${GTEST_BOTH_LIBRARIES} + ${CMAKE_THREAD_LIBS_INIT} ${GMOCK_LIB} + opentelemetry_exporter_otlp_http_log opentelemetry_logs) + gtest_add_tests( + TARGET otlp_http_log_record_exporter_factory_test + TEST_PREFIX exporter.otlp. + TEST_LIST otlp_http_log_record_exporter_factory_test) add_executable(otlp_http_metric_exporter_test test/otlp_http_metric_exporter_test.cc) diff --git a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_client.h b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_client.h index 75defd6b42..7998bd2646 100644 --- a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_client.h +++ b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_client.h @@ -11,13 +11,10 @@ #include "opentelemetry/exporters/otlp/protobuf_include_prefix.h" +#include "opentelemetry/proto/collector/logs/v1/logs_service.grpc.pb.h" #include "opentelemetry/proto/collector/metrics/v1/metrics_service.grpc.pb.h" #include "opentelemetry/proto/collector/trace/v1/trace_service.grpc.pb.h" -#ifdef ENABLE_LOGS_PREVIEW -# include "opentelemetry/proto/collector/logs/v1/logs_service.grpc.pb.h" -#endif - #include "opentelemetry/exporters/otlp/protobuf_include_suffix.h" OPENTELEMETRY_BEGIN_NAMESPACE @@ -60,13 +57,11 @@ class OtlpGrpcClient static std::unique_ptr MakeMetricsServiceStub(const OtlpGrpcExporterOptions &options); -#ifdef ENABLE_LOGS_PREVIEW /** * Create logs service stub to communicate with the OpenTelemetry Collector. */ static std::unique_ptr MakeLogsServiceStub(const OtlpGrpcExporterOptions &options); -#endif static grpc::Status DelegateExport( proto::collector::trace::v1::TraceService::StubInterface *stub, @@ -80,13 +75,11 @@ class OtlpGrpcClient const proto::collector::metrics::v1::ExportMetricsServiceRequest &request, proto::collector::metrics::v1::ExportMetricsServiceResponse *response); -#ifdef ENABLE_LOGS_PREVIEW static grpc::Status DelegateExport( proto::collector::logs::v1::LogsService::StubInterface *stub, grpc::ClientContext *context, const proto::collector::logs::v1::ExportLogsServiceRequest &request, proto::collector::logs::v1::ExportLogsServiceResponse *response); -#endif }; } // namespace otlp } // namespace exporter diff --git a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter.h b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter.h index becb308ca2..33476297cb 100644 --- a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter.h +++ b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter.h @@ -2,20 +2,19 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifdef ENABLE_LOGS_PREVIEW // clang-format off -# include "opentelemetry/exporters/otlp/protobuf_include_prefix.h" -# include "opentelemetry/proto/collector/logs/v1/logs_service.grpc.pb.h" -# include "opentelemetry/common/spin_lock_mutex.h" -# include "opentelemetry/exporters/otlp/protobuf_include_suffix.h" +#include "opentelemetry/exporters/otlp/protobuf_include_prefix.h" +#include "opentelemetry/proto/collector/logs/v1/logs_service.grpc.pb.h" +#include "opentelemetry/common/spin_lock_mutex.h" +#include "opentelemetry/exporters/otlp/protobuf_include_suffix.h" // clang-format on -# include "opentelemetry/exporters/otlp/otlp_environment.h" -# include "opentelemetry/exporters/otlp/otlp_grpc_exporter_options.h" -# include "opentelemetry/sdk/logs/exporter.h" +#include "opentelemetry/exporters/otlp/otlp_environment.h" +#include "opentelemetry/exporters/otlp/otlp_grpc_exporter_options.h" +#include "opentelemetry/sdk/logs/exporter.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace exporter @@ -95,5 +94,3 @@ class OtlpGrpcLogRecordExporter : public opentelemetry::sdk::logs::LogRecordExpo } // namespace otlp } // namespace exporter OPENTELEMETRY_END_NAMESPACE - -#endif diff --git a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter_factory.h b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter_factory.h index a6fa8e50d6..5f81e60f2e 100644 --- a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter_factory.h +++ b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter_factory.h @@ -3,10 +3,8 @@ #pragma once -#ifdef ENABLE_LOGS_PREVIEW - -# include "opentelemetry/exporters/otlp/otlp_grpc_exporter_options.h" -# include "opentelemetry/sdk/logs/exporter.h" +#include "opentelemetry/exporters/otlp/otlp_grpc_exporter_options.h" +#include "opentelemetry/sdk/logs/exporter.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace exporter @@ -35,5 +33,3 @@ class OPENTELEMETRY_EXPORT OtlpGrpcLogRecordExporterFactory } // namespace otlp } // namespace exporter OPENTELEMETRY_END_NAMESPACE - -#endif /* ENABLE_LOGS_PREVIEW */ diff --git a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_exporter.h b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_exporter.h index 9188858fc1..1adbbc70b9 100644 --- a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_exporter.h +++ b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_exporter.h @@ -26,7 +26,7 @@ namespace otlp /** * The OTLP exporter exports span data in OpenTelemetry Protocol (OTLP) format. */ -class OtlpHttpExporter final : public opentelemetry::sdk::trace::SpanExporter +class OPENTELEMETRY_EXPORT OtlpHttpExporter final : public opentelemetry::sdk::trace::SpanExporter { public: /** diff --git a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_log_record_exporter.h b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_log_record_exporter.h index 035b046b72..4393345dfd 100644 --- a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_log_record_exporter.h +++ b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_log_record_exporter.h @@ -2,19 +2,18 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifdef ENABLE_LOGS_PREVIEW -# include "opentelemetry/sdk/logs/exporter.h" +#include "opentelemetry/sdk/logs/exporter.h" -# include "opentelemetry/exporters/otlp/otlp_http_client.h" +#include "opentelemetry/exporters/otlp/otlp_http_client.h" -# include "opentelemetry/exporters/otlp/otlp_environment.h" -# include "opentelemetry/exporters/otlp/otlp_http_log_record_exporter_options.h" +#include "opentelemetry/exporters/otlp/otlp_environment.h" +#include "opentelemetry/exporters/otlp/otlp_http_log_record_exporter_options.h" -# include -# include -# include -# include +#include +#include +#include +#include OPENTELEMETRY_BEGIN_NAMESPACE namespace exporter @@ -86,4 +85,3 @@ class OtlpHttpLogRecordExporter final : public opentelemetry::sdk::logs::LogReco } // namespace otlp } // namespace exporter OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_log_record_exporter_factory.h b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_log_record_exporter_factory.h index 152a394574..f4c90d5b0c 100644 --- a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_log_record_exporter_factory.h +++ b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_log_record_exporter_factory.h @@ -2,12 +2,11 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifdef ENABLE_LOGS_PREVIEW -# include "opentelemetry/exporters/otlp/otlp_http_log_record_exporter_options.h" -# include "opentelemetry/sdk/logs/exporter.h" +#include "opentelemetry/exporters/otlp/otlp_http_log_record_exporter_options.h" +#include "opentelemetry/sdk/logs/exporter.h" -# include +#include OPENTELEMETRY_BEGIN_NAMESPACE namespace exporter @@ -36,4 +35,3 @@ class OPENTELEMETRY_EXPORT OtlpHttpLogRecordExporterFactory } // namespace otlp } // namespace exporter OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_log_record_exporter_options.h b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_log_record_exporter_options.h index e785170329..65fd2b9b63 100644 --- a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_log_record_exporter_options.h +++ b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_log_record_exporter_options.h @@ -2,16 +2,15 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifdef ENABLE_LOGS_PREVIEW -# include "opentelemetry/exporters/otlp/otlp_environment.h" -# include "opentelemetry/exporters/otlp/otlp_http.h" -# include "opentelemetry/sdk/logs/exporter.h" +#include "opentelemetry/exporters/otlp/otlp_environment.h" +#include "opentelemetry/exporters/otlp/otlp_http.h" +#include "opentelemetry/sdk/logs/exporter.h" -# include -# include -# include -# include +#include +#include +#include +#include OPENTELEMETRY_BEGIN_NAMESPACE namespace exporter @@ -49,16 +48,16 @@ struct OtlpHttpLogRecordExporterOptions // Additional HTTP headers OtlpHeaders http_headers = GetOtlpDefaultLogsHeaders(); -# ifdef ENABLE_ASYNC_EXPORT +#ifdef ENABLE_ASYNC_EXPORT // Concurrent requests // https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/otlp.md#otlpgrpc-concurrent-requests std::size_t max_concurrent_requests = 64; // Requests per connections std::size_t max_requests_per_connection = 8; -# endif +#endif -# ifdef ENABLE_OTLP_HTTP_SSL_PREVIEW +#ifdef ENABLE_OTLP_HTTP_SSL_PREVIEW bool ssl_insecure_skip_verify{false}; std::string ssl_ca_cert_path = GetOtlpDefaultLogsSslCertificatePath(); @@ -69,9 +68,9 @@ struct OtlpHttpLogRecordExporterOptions std::string ssl_client_cert_path = GetOtlpDefaultLogsSslClientCertificatePath(); std::string ssl_client_cert_string = GetOtlpDefaultLogsSslClientCertificateString(); -# endif /* ENABLE_OTLP_HTTP_SSL_PREVIEW */ +#endif /* ENABLE_OTLP_HTTP_SSL_PREVIEW */ -# ifdef ENABLE_OTLP_HTTP_SSL_TLS_PREVIEW +#ifdef ENABLE_OTLP_HTTP_SSL_TLS_PREVIEW /** Minimum TLS version. */ std::string ssl_min_tls = GetOtlpDefaultLogsSslTlsMinVersion(); /** Maximum TLS version. */ @@ -80,10 +79,9 @@ struct OtlpHttpLogRecordExporterOptions std::string ssl_cipher = GetOtlpDefaultLogsSslTlsCipher(); /** TLS cipher suite. */ std::string ssl_cipher_suite = GetOtlpDefaultLogsSslTlsCipherSuite(); -# endif /* ENABLE_OTLP_HTTP_SSL_TLS_PREVIEW */ +#endif /* ENABLE_OTLP_HTTP_SSL_TLS_PREVIEW */ }; } // namespace otlp } // namespace exporter OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_log_recordable.h b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_log_recordable.h index 0648fe3308..1fa1dad096 100644 --- a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_log_recordable.h +++ b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_log_recordable.h @@ -2,22 +2,21 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifdef ENABLE_LOGS_PREVIEW // clang-format off -# include "opentelemetry/exporters/otlp/protobuf_include_prefix.h" +#include "opentelemetry/exporters/otlp/protobuf_include_prefix.h" -# include "opentelemetry/proto/logs/v1/logs.pb.h" -# include "opentelemetry/proto/resource/v1/resource.pb.h" -# include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h" +#include "opentelemetry/proto/logs/v1/logs.pb.h" +#include "opentelemetry/proto/resource/v1/resource.pb.h" +#include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h" -# include "opentelemetry/exporters/otlp/protobuf_include_suffix.h" +#include "opentelemetry/exporters/otlp/protobuf_include_suffix.h" // clang-format on -# include "opentelemetry/common/macros.h" -# include "opentelemetry/sdk/common/attribute_utils.h" -# include "opentelemetry/sdk/logs/read_write_log_record.h" -# include "opentelemetry/sdk/logs/recordable.h" +#include "opentelemetry/common/macros.h" +#include "opentelemetry/sdk/common/attribute_utils.h" +#include "opentelemetry/sdk/logs/read_write_log_record.h" +#include "opentelemetry/sdk/logs/recordable.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace exporter @@ -126,5 +125,3 @@ class OtlpLogRecordable final : public opentelemetry::sdk::logs::Recordable } // namespace otlp } // namespace exporter OPENTELEMETRY_END_NAMESPACE - -#endif diff --git a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_recordable_utils.h b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_recordable_utils.h index 1ad9514aa9..74a4cd9aeb 100644 --- a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_recordable_utils.h +++ b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_recordable_utils.h @@ -16,9 +16,7 @@ #include "opentelemetry/sdk/trace/recordable.h" -#ifdef ENABLE_LOGS_PREVIEW -# include "opentelemetry/sdk/logs/recordable.h" -#endif +#include "opentelemetry/sdk/logs/recordable.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace exporter @@ -35,11 +33,9 @@ class OtlpRecordableUtils const nostd::span> &spans, proto::collector::trace::v1::ExportTraceServiceRequest *request) noexcept; -#ifdef ENABLE_LOGS_PREVIEW static void PopulateRequest( const nostd::span> &logs, proto::collector::logs::v1::ExportLogsServiceRequest *request) noexcept; -#endif }; } // namespace otlp } // namespace exporter diff --git a/exporters/otlp/src/otlp_grpc_client.cc b/exporters/otlp/src/otlp_grpc_client.cc index 5a94c66b59..625781025e 100644 --- a/exporters/otlp/src/otlp_grpc_client.cc +++ b/exporters/otlp/src/otlp_grpc_client.cc @@ -132,13 +132,11 @@ OtlpGrpcClient::MakeMetricsServiceStub(const OtlpGrpcExporterOptions &options) return proto::collector::metrics::v1::MetricsService::NewStub(MakeChannel(options)); } -#ifdef ENABLE_LOGS_PREVIEW std::unique_ptr OtlpGrpcClient::MakeLogsServiceStub(const OtlpGrpcExporterOptions &options) { return proto::collector::logs::v1::LogsService::NewStub(MakeChannel(options)); } -#endif grpc::Status OtlpGrpcClient::DelegateExport( proto::collector::trace::v1::TraceService::StubInterface *stub, @@ -158,7 +156,6 @@ grpc::Status OtlpGrpcClient::DelegateExport( return stub->Export(context, request, response); } -#ifdef ENABLE_LOGS_PREVIEW grpc::Status OtlpGrpcClient::DelegateExport( proto::collector::logs::v1::LogsService::StubInterface *stub, grpc::ClientContext *context, @@ -167,7 +164,6 @@ grpc::Status OtlpGrpcClient::DelegateExport( { return stub->Export(context, request, response); } -#endif } // namespace otlp } // namespace exporter diff --git a/exporters/otlp/src/otlp_grpc_log_record_exporter.cc b/exporters/otlp/src/otlp_grpc_log_record_exporter.cc index 6cef1d07b6..01367da886 100644 --- a/exporters/otlp/src/otlp_grpc_log_record_exporter.cc +++ b/exporters/otlp/src/otlp_grpc_log_record_exporter.cc @@ -1,28 +1,26 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifdef ENABLE_LOGS_PREVIEW +#include +#include -# include -# include - -# include "opentelemetry/exporters/otlp/otlp_grpc_client.h" -# include "opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter.h" -# include "opentelemetry/exporters/otlp/otlp_log_recordable.h" -# include "opentelemetry/exporters/otlp/otlp_recordable_utils.h" +#include "opentelemetry/exporters/otlp/otlp_grpc_client.h" +#include "opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter.h" +#include "opentelemetry/exporters/otlp/otlp_log_recordable.h" +#include "opentelemetry/exporters/otlp/otlp_recordable_utils.h" // clang-format off -# include "opentelemetry/exporters/otlp/protobuf_include_prefix.h" +#include "opentelemetry/exporters/otlp/protobuf_include_prefix.h" -# include "opentelemetry/proto/collector/logs/v1/logs_service.pb.h" -# include "opentelemetry/proto/collector/logs/v1/logs_service.grpc.pb.h" +#include "opentelemetry/proto/collector/logs/v1/logs_service.pb.h" +#include "opentelemetry/proto/collector/logs/v1/logs_service.grpc.pb.h" -# include "opentelemetry/exporters/otlp/protobuf_include_suffix.h" +#include "opentelemetry/exporters/otlp/protobuf_include_suffix.h" // clang-format on -# include "opentelemetry/sdk/common/global_log_handler.h" +#include "opentelemetry/sdk/common/global_log_handler.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace exporter @@ -106,5 +104,3 @@ bool OtlpGrpcLogRecordExporter::isShutdown() const noexcept } // namespace otlp } // namespace exporter OPENTELEMETRY_END_NAMESPACE - -#endif diff --git a/exporters/otlp/src/otlp_grpc_log_record_exporter_factory.cc b/exporters/otlp/src/otlp_grpc_log_record_exporter_factory.cc index d52a6269ba..b36eefa6cb 100644 --- a/exporters/otlp/src/otlp_grpc_log_record_exporter_factory.cc +++ b/exporters/otlp/src/otlp_grpc_log_record_exporter_factory.cc @@ -1,13 +1,11 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifdef ENABLE_LOGS_PREVIEW - // MUST be first (absl) -# include "opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter.h" +#include "opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter.h" -# include "opentelemetry/exporters/otlp/otlp_grpc_exporter_options.h" -# include "opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter_factory.h" +#include "opentelemetry/exporters/otlp/otlp_grpc_exporter_options.h" +#include "opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter_factory.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace exporter @@ -33,5 +31,3 @@ OtlpGrpcLogRecordExporterFactory::Create(const OtlpGrpcExporterOptions &options) } // namespace otlp } // namespace exporter OPENTELEMETRY_END_NAMESPACE - -#endif diff --git a/exporters/otlp/src/otlp_http_log_record_exporter.cc b/exporters/otlp/src/otlp_http_log_record_exporter.cc index f0d410f6f2..9414e2fd76 100644 --- a/exporters/otlp/src/otlp_http_log_record_exporter.cc +++ b/exporters/otlp/src/otlp_http_log_record_exporter.cc @@ -1,19 +1,17 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifdef ENABLE_LOGS_PREVIEW +#include "opentelemetry/exporters/otlp/otlp_http_log_record_exporter.h" +#include "opentelemetry/exporters/otlp/otlp_log_recordable.h" +#include "opentelemetry/exporters/otlp/otlp_recordable_utils.h" -# include "opentelemetry/exporters/otlp/otlp_http_log_record_exporter.h" -# include "opentelemetry/exporters/otlp/otlp_log_recordable.h" -# include "opentelemetry/exporters/otlp/otlp_recordable_utils.h" +#include "opentelemetry/exporters/otlp/protobuf_include_prefix.h" -# include "opentelemetry/exporters/otlp/protobuf_include_prefix.h" +#include "opentelemetry/proto/collector/logs/v1/logs_service.pb.h" -# include "opentelemetry/proto/collector/logs/v1/logs_service.pb.h" +#include "opentelemetry/exporters/otlp/protobuf_include_suffix.h" -# include "opentelemetry/exporters/otlp/protobuf_include_suffix.h" - -# include "opentelemetry/sdk/common/global_log_handler.h" +#include "opentelemetry/sdk/common/global_log_handler.h" namespace nostd = opentelemetry::nostd; @@ -31,7 +29,7 @@ OtlpHttpLogRecordExporter::OtlpHttpLogRecordExporter( const OtlpHttpLogRecordExporterOptions &options) : options_(options), http_client_(new OtlpHttpClient(OtlpHttpClientOptions(options.url, -# ifdef ENABLE_OTLP_HTTP_SSL_PREVIEW +#ifdef ENABLE_OTLP_HTTP_SSL_PREVIEW options.ssl_insecure_skip_verify, options.ssl_ca_cert_path, options.ssl_ca_cert_string, @@ -39,24 +37,24 @@ OtlpHttpLogRecordExporter::OtlpHttpLogRecordExporter( options.ssl_client_key_string, options.ssl_client_cert_path, options.ssl_client_cert_string, -# endif /* ENABLE_OTLP_HTTP_SSL_PREVIEW */ -# ifdef ENABLE_OTLP_HTTP_SSL_TLS_PREVIEW +#endif /* ENABLE_OTLP_HTTP_SSL_PREVIEW */ +#ifdef ENABLE_OTLP_HTTP_SSL_TLS_PREVIEW options.ssl_min_tls, options.ssl_max_tls, options.ssl_cipher, options.ssl_cipher_suite, -# endif /* ENABLE_OTLP_HTTP_SSL_TLS_PREVIEW */ +#endif /* ENABLE_OTLP_HTTP_SSL_TLS_PREVIEW */ options.content_type, options.json_bytes_mapping, options.use_json_name, options.console_debug, options.timeout, options.http_headers -# ifdef ENABLE_ASYNC_EXPORT +#ifdef ENABLE_ASYNC_EXPORT , options.max_concurrent_requests, options.max_requests_per_connection -# endif +#endif ))) {} @@ -72,10 +70,10 @@ OtlpHttpLogRecordExporter::OtlpHttpLogRecordExporter(std::unique_ptrGetOptions().console_debug; options.timeout = http_client_->GetOptions().timeout; options.http_headers = http_client_->GetOptions().http_headers; -# ifdef ENABLE_ASYNC_EXPORT +#ifdef ENABLE_ASYNC_EXPORT options.max_concurrent_requests = http_client_->GetOptions().max_concurrent_requests; options.max_requests_per_connection = http_client_->GetOptions().max_requests_per_connection; -# endif +#endif } // ----------------------------- Exporter methods ------------------------------ @@ -103,7 +101,7 @@ opentelemetry::sdk::common::ExportResult OtlpHttpLogRecordExporter::Export( proto::collector::logs::v1::ExportLogsServiceRequest service_request; OtlpRecordableUtils::PopulateRequest(logs, &service_request); std::size_t log_count = logs.size(); -# ifdef ENABLE_ASYNC_EXPORT +#ifdef ENABLE_ASYNC_EXPORT http_client_->Export( service_request, [log_count](opentelemetry::sdk::common::ExportResult result) { if (result != opentelemetry::sdk::common::ExportResult::kSuccess) @@ -118,7 +116,7 @@ opentelemetry::sdk::common::ExportResult OtlpHttpLogRecordExporter::Export( return true; }); return opentelemetry::sdk::common::ExportResult::kSuccess; -# else +#else opentelemetry::sdk::common::ExportResult result = http_client_->Export(service_request); if (result != opentelemetry::sdk::common::ExportResult::kSuccess) { @@ -130,7 +128,7 @@ opentelemetry::sdk::common::ExportResult OtlpHttpLogRecordExporter::Export( OTEL_INTERNAL_LOG_DEBUG("[OTLP HTTP Client] Export " << log_count << " log(s) success"); } return opentelemetry::sdk::common::ExportResult::kSuccess; -# endif +#endif } bool OtlpHttpLogRecordExporter::ForceFlush(std::chrono::microseconds timeout) noexcept @@ -146,5 +144,3 @@ bool OtlpHttpLogRecordExporter::Shutdown(std::chrono::microseconds timeout) noex } // namespace otlp } // namespace exporter OPENTELEMETRY_END_NAMESPACE - -#endif diff --git a/exporters/otlp/src/otlp_http_log_record_exporter_factory.cc b/exporters/otlp/src/otlp_http_log_record_exporter_factory.cc index d05d68ce26..c224acc053 100644 --- a/exporters/otlp/src/otlp_http_log_record_exporter_factory.cc +++ b/exporters/otlp/src/otlp_http_log_record_exporter_factory.cc @@ -1,11 +1,9 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifdef ENABLE_LOGS_PREVIEW - -# include "opentelemetry/exporters/otlp/otlp_http_log_record_exporter_factory.h" -# include "opentelemetry/exporters/otlp/otlp_http_log_record_exporter.h" -# include "opentelemetry/exporters/otlp/otlp_http_log_record_exporter_options.h" +#include "opentelemetry/exporters/otlp/otlp_http_log_record_exporter_factory.h" +#include "opentelemetry/exporters/otlp/otlp_http_log_record_exporter.h" +#include "opentelemetry/exporters/otlp/otlp_http_log_record_exporter_options.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace exporter @@ -31,5 +29,3 @@ OtlpHttpLogRecordExporterFactory::Create(const OtlpHttpLogRecordExporterOptions } // namespace otlp } // namespace exporter OPENTELEMETRY_END_NAMESPACE - -#endif diff --git a/exporters/otlp/src/otlp_log_recordable.cc b/exporters/otlp/src/otlp_log_recordable.cc index cc4d712795..7b86839dff 100644 --- a/exporters/otlp/src/otlp_log_recordable.cc +++ b/exporters/otlp/src/otlp_log_recordable.cc @@ -1,14 +1,12 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifdef ENABLE_LOGS_PREVIEW +#include "opentelemetry/common/macros.h" -# include "opentelemetry/common/macros.h" - -# include "opentelemetry/exporters/otlp/otlp_log_recordable.h" -# include "opentelemetry/exporters/otlp/otlp_populate_attribute_utils.h" -# include "opentelemetry/exporters/otlp/otlp_recordable_utils.h" -# include "opentelemetry/sdk/logs/readable_log_record.h" +#include "opentelemetry/exporters/otlp/otlp_log_recordable.h" +#include "opentelemetry/exporters/otlp/otlp_populate_attribute_utils.h" +#include "opentelemetry/exporters/otlp/otlp_recordable_utils.h" +#include "opentelemetry/sdk/logs/readable_log_record.h" namespace nostd = opentelemetry::nostd; @@ -233,5 +231,3 @@ void OtlpLogRecordable::SetInstrumentationScope( } // namespace otlp } // namespace exporter OPENTELEMETRY_END_NAMESPACE - -#endif diff --git a/exporters/otlp/src/otlp_recordable_utils.cc b/exporters/otlp/src/otlp_recordable_utils.cc index 81859ba070..1b1da94e08 100644 --- a/exporters/otlp/src/otlp_recordable_utils.cc +++ b/exporters/otlp/src/otlp_recordable_utils.cc @@ -72,7 +72,6 @@ void OtlpRecordableUtils::PopulateRequest( } } -#ifdef ENABLE_LOGS_PREVIEW void OtlpRecordableUtils::PopulateRequest( const nostd::span> &logs, proto::collector::logs::v1::ExportLogsServiceRequest *request) noexcept @@ -137,7 +136,6 @@ void OtlpRecordableUtils::PopulateRequest( } } } -#endif } // namespace otlp } // namespace exporter OPENTELEMETRY_END_NAMESPACE diff --git a/exporters/otlp/test/otlp_grpc_log_record_exporter_factory_test.cc b/exporters/otlp/test/otlp_grpc_log_record_exporter_factory_test.cc index 5219d22d14..2cc534277d 100644 --- a/exporters/otlp/test/otlp_grpc_log_record_exporter_factory_test.cc +++ b/exporters/otlp/test/otlp_grpc_log_record_exporter_factory_test.cc @@ -1,20 +1,18 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifdef ENABLE_LOGS_PREVIEW +#include -# include - -# include "opentelemetry/exporters/otlp/otlp_grpc_exporter_options.h" -# include "opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter_factory.h" +#include "opentelemetry/exporters/otlp/otlp_grpc_exporter_options.h" +#include "opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter_factory.h" /* Make sure OtlpGrpcLogRecordExporterFactory does not require, even indirectly, protobuf headers. */ -# ifdef GOOGLE_PROTOBUF_VERSION -# error "protobuf should not be included" -# endif +#ifdef GOOGLE_PROTOBUF_VERSION +# error "protobuf should not be included" +#endif OPENTELEMETRY_BEGIN_NAMESPACE namespace exporter @@ -36,5 +34,3 @@ TEST(OtlpGrpcLogRecordExporterFactoryTest, BuildTest) } // namespace otlp } // namespace exporter OPENTELEMETRY_END_NAMESPACE - -#endif // ENABLE_LOGS_PREVIEW diff --git a/exporters/otlp/test/otlp_grpc_log_record_exporter_test.cc b/exporters/otlp/test/otlp_grpc_log_record_exporter_test.cc index 518caaba5e..547d21d056 100644 --- a/exporters/otlp/test/otlp_grpc_log_record_exporter_test.cc +++ b/exporters/otlp/test/otlp_grpc_log_record_exporter_test.cc @@ -1,39 +1,37 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifdef ENABLE_LOGS_PREVIEW +#include -# include +#include "opentelemetry/exporters/otlp/otlp_grpc_exporter.h" +#include "opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter.h" -# include "opentelemetry/exporters/otlp/otlp_grpc_exporter.h" -# include "opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter.h" +#include "opentelemetry/exporters/otlp/protobuf_include_prefix.h" -# include "opentelemetry/exporters/otlp/protobuf_include_prefix.h" +#include "opentelemetry/proto/collector/logs/v1/logs_service_mock.grpc.pb.h" +#include "opentelemetry/proto/collector/trace/v1/trace_service_mock.grpc.pb.h" -# include "opentelemetry/proto/collector/logs/v1/logs_service_mock.grpc.pb.h" -# include "opentelemetry/proto/collector/trace/v1/trace_service_mock.grpc.pb.h" +#include "opentelemetry/exporters/otlp/protobuf_include_suffix.h" -# include "opentelemetry/exporters/otlp/protobuf_include_suffix.h" +#include "opentelemetry/logs/provider.h" +#include "opentelemetry/sdk/logs/batch_log_record_processor.h" +#include "opentelemetry/sdk/logs/exporter.h" +#include "opentelemetry/sdk/logs/logger_provider.h" +#include "opentelemetry/sdk/logs/recordable.h" +#include "opentelemetry/sdk/resource/resource.h" +#include "opentelemetry/sdk/trace/exporter.h" +#include "opentelemetry/sdk/trace/processor.h" +#include "opentelemetry/sdk/trace/simple_processor_factory.h" +#include "opentelemetry/sdk/trace/tracer_provider_factory.h" +#include "opentelemetry/trace/provider.h" -# include "opentelemetry/logs/provider.h" -# include "opentelemetry/sdk/logs/batch_log_record_processor.h" -# include "opentelemetry/sdk/logs/exporter.h" -# include "opentelemetry/sdk/logs/logger_provider.h" -# include "opentelemetry/sdk/logs/recordable.h" -# include "opentelemetry/sdk/resource/resource.h" -# include "opentelemetry/sdk/trace/exporter.h" -# include "opentelemetry/sdk/trace/processor.h" -# include "opentelemetry/sdk/trace/simple_processor_factory.h" -# include "opentelemetry/sdk/trace/tracer_provider_factory.h" -# include "opentelemetry/trace/provider.h" +#include -# include - -# if defined(_MSC_VER) -# include "opentelemetry/sdk/common/env_variables.h" +#if defined(_MSC_VER) +# include "opentelemetry/sdk/common/env_variables.h" using opentelemetry::sdk::common::setenv; using opentelemetry::sdk::common::unsetenv; -# endif +#endif using namespace testing; @@ -203,5 +201,3 @@ TEST_F(OtlpGrpcLogRecordExporterTestPeer, ExportIntegrationTest) } // namespace otlp } // namespace exporter OPENTELEMETRY_END_NAMESPACE - -#endif // ENABLE_LOGS_PREVIEW diff --git a/exporters/otlp/test/otlp_http_log_record_exporter_factory_test.cc b/exporters/otlp/test/otlp_http_log_record_exporter_factory_test.cc index 34b408d8a2..1f3275e1c3 100644 --- a/exporters/otlp/test/otlp_http_log_record_exporter_factory_test.cc +++ b/exporters/otlp/test/otlp_http_log_record_exporter_factory_test.cc @@ -1,28 +1,26 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifdef ENABLE_LOGS_PREVIEW +#include -# include - -# include "opentelemetry/exporters/otlp/otlp_http_log_record_exporter_factory.h" -# include "opentelemetry/exporters/otlp/otlp_http_log_record_exporter_options.h" +#include "opentelemetry/exporters/otlp/otlp_http_log_record_exporter_factory.h" +#include "opentelemetry/exporters/otlp/otlp_http_log_record_exporter_options.h" /* Make sure OtlpHttpExporterFactory does not require, even indirectly, nlohmann/json headers. */ -# ifdef NLOHMANN_JSON_VERSION_MAJOR -# error "nlohmann/json should not be included" -# endif /* NLOHMANN_JSON_VERSION_MAJOR */ +#ifdef NLOHMANN_JSON_VERSION_MAJOR +# error "nlohmann/json should not be included" +#endif /* NLOHMANN_JSON_VERSION_MAJOR */ /* Make sure OtlpHttpExporterFactory does not require, even indirectly, protobuf headers. */ -# ifdef GOOGLE_PROTOBUF_VERSION -# error "protobuf should not be included" -# endif +#ifdef GOOGLE_PROTOBUF_VERSION +# error "protobuf should not be included" +#endif OPENTELEMETRY_BEGIN_NAMESPACE namespace exporter @@ -44,5 +42,3 @@ TEST(OtlpHttpLogRecordExporterFactoryTest, BuildTest) } // namespace otlp } // namespace exporter OPENTELEMETRY_END_NAMESPACE - -#endif // ENABLE_LOGS_PREVIEW diff --git a/exporters/otlp/test/otlp_http_log_record_exporter_test.cc b/exporters/otlp/test/otlp_http_log_record_exporter_test.cc index 7720b6e5d8..4dc3b5829d 100644 --- a/exporters/otlp/test/otlp_http_log_record_exporter_test.cc +++ b/exporters/otlp/test/otlp_http_log_record_exporter_test.cc @@ -2,40 +2,39 @@ // SPDX-License-Identifier: Apache-2.0 #ifndef HAVE_CPP_STDLIB -# ifdef ENABLE_LOGS_PREVIEW -# include -# include +# include +# include -# include "opentelemetry/exporters/otlp/otlp_http_log_record_exporter.h" +# include "opentelemetry/exporters/otlp/otlp_http_log_record_exporter.h" -# include "opentelemetry/exporters/otlp/protobuf_include_prefix.h" +# include "opentelemetry/exporters/otlp/protobuf_include_prefix.h" -# include "opentelemetry/proto/collector/logs/v1/logs_service.pb.h" +# include "opentelemetry/proto/collector/logs/v1/logs_service.pb.h" -# include "opentelemetry/exporters/otlp/protobuf_include_suffix.h" +# include "opentelemetry/exporters/otlp/protobuf_include_suffix.h" -# include "opentelemetry/common/key_value_iterable_view.h" -# include "opentelemetry/ext/http/client/http_client_factory.h" -# include "opentelemetry/ext/http/server/http_server.h" -# include "opentelemetry/logs/provider.h" -# include "opentelemetry/sdk/logs/batch_log_record_processor.h" -# include "opentelemetry/sdk/logs/exporter.h" -# include "opentelemetry/sdk/logs/logger_provider.h" -# include "opentelemetry/sdk/resource/resource.h" -# include "opentelemetry/test_common/ext/http/client/nosend/http_client_nosend.h" +# include "opentelemetry/common/key_value_iterable_view.h" +# include "opentelemetry/ext/http/client/http_client_factory.h" +# include "opentelemetry/ext/http/server/http_server.h" +# include "opentelemetry/logs/provider.h" +# include "opentelemetry/sdk/logs/batch_log_record_processor.h" +# include "opentelemetry/sdk/logs/exporter.h" +# include "opentelemetry/sdk/logs/logger_provider.h" +# include "opentelemetry/sdk/resource/resource.h" +# include "opentelemetry/test_common/ext/http/client/nosend/http_client_nosend.h" -# include -# include -# include "gmock/gmock.h" +# include +# include +# include "gmock/gmock.h" -# include "nlohmann/json.hpp" +# include "nlohmann/json.hpp" -# if defined(_MSC_VER) -# include "opentelemetry/sdk/common/env_variables.h" +# if defined(_MSC_VER) +# include "opentelemetry/sdk/common/env_variables.h" using opentelemetry::sdk::common::setenv; using opentelemetry::sdk::common::unsetenv; -# endif +# endif using namespace testing; @@ -61,19 +60,19 @@ OtlpHttpClientOptions MakeOtlpHttpClientOptions(HttpRequestContentType content_t std::make_pair("Custom-Header-Key", "Custom-Header-Value")); OtlpHttpClientOptions otlp_http_client_options( options.url, -# ifdef ENABLE_OTLP_HTTP_SSL_PREVIEW +# ifdef ENABLE_OTLP_HTTP_SSL_PREVIEW false, /* ssl_insecure_skip_verify */ "", /* ssl_ca_cert_path */ "", /* ssl_ca_cert_string */ "", /* ssl_client_key_path */ "", /* ssl_client_key_string */ "", /* ssl_client_cert_path */ "", /* ssl_client_cert_string */ -# endif /* ENABLE_OTLP_HTTP_SSL_PREVIEW */ -# ifdef ENABLE_OTLP_HTTP_SSL_TLS_PREVIEW - "", /* ssl_min_tls */ - "", /* ssl_max_tls */ - "", /* ssl_cipher */ - "", /* ssl_cipher_suite */ -# endif /* ENABLE_OTLP_HTTP_SSL_TLS_PREVIEW */ +# endif /* ENABLE_OTLP_HTTP_SSL_PREVIEW */ +# ifdef ENABLE_OTLP_HTTP_SSL_TLS_PREVIEW + "", /* ssl_min_tls */ + "", /* ssl_max_tls */ + "", /* ssl_cipher */ + "", /* ssl_cipher_suite */ +# endif /* ENABLE_OTLP_HTTP_SSL_TLS_PREVIEW */ options.content_type, options.json_bytes_mapping, options.use_json_name, options.console_debug, options.timeout, options.http_headers); if (!async_mode) @@ -222,7 +221,7 @@ class OtlpHttpLogRecordExporterTestPeer : public ::testing::Test provider->ForceFlush(); } -# ifdef ENABLE_ASYNC_EXPORT +# ifdef ENABLE_ASYNC_EXPORT void ExportJsonIntegrationTestAsync() { auto mock_otlp_client = OtlpHttpLogRecordExporterTestPeer::GetMockOtlpHttpClient( @@ -349,7 +348,7 @@ class OtlpHttpLogRecordExporterTestPeer : public ::testing::Test provider->ForceFlush(); } -# endif +# endif void ExportBinaryIntegrationTest() { @@ -462,7 +461,7 @@ class OtlpHttpLogRecordExporterTestPeer : public ::testing::Test provider->ForceFlush(); } -# ifdef ENABLE_ASYNC_EXPORT +# ifdef ENABLE_ASYNC_EXPORT void ExportBinaryIntegrationTestAsync() { auto mock_otlp_client = OtlpHttpLogRecordExporterTestPeer::GetMockOtlpHttpClient( @@ -578,7 +577,7 @@ class OtlpHttpLogRecordExporterTestPeer : public ::testing::Test provider->ForceFlush(); } -# endif +# endif }; TEST(OtlpHttpLogRecordExporterTest, Shutdown) @@ -599,13 +598,13 @@ TEST_F(OtlpHttpLogRecordExporterTestPeer, ExportJsonIntegrationTestSync) ExportJsonIntegrationTest(); } -# ifdef ENABLE_ASYNC_EXPORT +# ifdef ENABLE_ASYNC_EXPORT TEST_F(OtlpHttpLogRecordExporterTestPeer, ExportJsonIntegrationTestAsync) { ExportJsonIntegrationTestAsync(); google::protobuf::ShutdownProtobufLibrary(); } -# endif +# endif // Create log records, let processor call Export() TEST_F(OtlpHttpLogRecordExporterTestPeer, ExportBinaryIntegrationTestSync) @@ -613,12 +612,12 @@ TEST_F(OtlpHttpLogRecordExporterTestPeer, ExportBinaryIntegrationTestSync) ExportBinaryIntegrationTest(); } -# ifdef ENABLE_ASYNC_EXPORT +# ifdef ENABLE_ASYNC_EXPORT TEST_F(OtlpHttpLogRecordExporterTestPeer, ExportBinaryIntegrationTestAsync) { ExportBinaryIntegrationTestAsync(); } -# endif +# endif // Test exporter configuration options TEST_F(OtlpHttpLogRecordExporterTestPeer, ConfigTest) @@ -647,7 +646,7 @@ TEST_F(OtlpHttpLogRecordExporterTestPeer, ConfigJsonBytesMappingTest) EXPECT_EQ(GetOptions(exporter).json_bytes_mapping, JsonBytesMappingKind::kHex); } -# ifndef NO_GETENV +# ifndef NO_GETENV // Test exporter configuration options with use_ssl_credentials TEST_F(OtlpHttpLogRecordExporterTestPeer, ConfigFromEnv) { @@ -736,10 +735,9 @@ TEST_F(OtlpHttpLogRecordExporterTestPeer, DefaultEndpoint) EXPECT_EQ("http://localhost:4317", GetOtlpDefaultGrpcEndpoint()); } -# endif +# endif } // namespace otlp } // namespace exporter OPENTELEMETRY_END_NAMESPACE -# endif #endif diff --git a/exporters/otlp/test/otlp_log_recordable_test.cc b/exporters/otlp/test/otlp_log_recordable_test.cc index 96c5c66b09..bcecbb8d8f 100644 --- a/exporters/otlp/test/otlp_log_recordable_test.cc +++ b/exporters/otlp/test/otlp_log_recordable_test.cc @@ -1,16 +1,14 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifdef ENABLE_LOGS_PREVIEW +#include -# include +#include -# include - -# include "opentelemetry/exporters/otlp/otlp_log_recordable.h" -# include "opentelemetry/sdk/logs/read_write_log_record.h" -# include "opentelemetry/sdk/resource/resource.h" -# include "opentelemetry/sdk/resource/semantic_conventions.h" +#include "opentelemetry/exporters/otlp/otlp_log_recordable.h" +#include "opentelemetry/sdk/logs/read_write_log_record.h" +#include "opentelemetry/sdk/resource/resource.h" +#include "opentelemetry/sdk/resource/semantic_conventions.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace exporter @@ -134,30 +132,14 @@ TEST(OtlpLogRecordable, SetArrayAttribute) nostd::span str_span(str_arr); rec.SetAttribute("str_arr_attr", str_span); - const opentelemetry::proto::common::v1::ArrayValue *bool_values = nullptr; - const opentelemetry::proto::common::v1::ArrayValue *double_values = nullptr; - const opentelemetry::proto::common::v1::ArrayValue *string_values = nullptr; - for (int i = 0; i < rec.log_record().attributes_size(); i++) - { - if (rec.log_record().attributes(i).value().array_value().values(0).has_bool_value()) - { - bool_values = &rec.log_record().attributes(i).value().array_value(); - } - else if (rec.log_record().attributes(i).value().array_value().values(0).has_double_value()) - { - double_values = &rec.log_record().attributes(i).value().array_value(); - } - else if (rec.log_record().attributes(i).value().array_value().values(0).has_string_value()) - { - string_values = &rec.log_record().attributes(i).value().array_value(); - } - } - for (int i = 0; i < kArraySize; i++) { - EXPECT_EQ(bool_values->values(i).bool_value(), bool_span[i]); - EXPECT_EQ(double_values->values(i).double_value(), double_span[i]); - EXPECT_EQ(string_values->values(i).string_value(), str_span[i]); + EXPECT_EQ(rec.log_record().attributes(0).value().array_value().values(i).bool_value(), + bool_span[i]); + EXPECT_EQ(rec.log_record().attributes(1).value().array_value().values(i).double_value(), + double_span[i]); + EXPECT_EQ(rec.log_record().attributes(2).value().array_value().values(i).string_value(), + str_span[i]); } } @@ -220,5 +202,3 @@ TYPED_TEST(OtlpLogRecordableIntAttributeTest, SetIntArrayAttribute) } // namespace otlp } // namespace exporter OPENTELEMETRY_END_NAMESPACE - -#endif diff --git a/ext/src/dll/CMakeLists.txt b/ext/src/dll/CMakeLists.txt index d9156a5f8c..c0b6b91745 100644 --- a/ext/src/dll/CMakeLists.txt +++ b/ext/src/dll/CMakeLists.txt @@ -22,18 +22,18 @@ if(WITH_OTLP_HTTP) PRIVATE opentelemetry_exporter_otlp_http) endif() -if(WITH_LOGS_PREVIEW) - target_link_libraries(opentelemetry_cpp PRIVATE opentelemetry_logs) - - if(WITH_OTLP_GRPC) - target_link_libraries(opentelemetry_cpp - PRIVATE opentelemetry_exporter_otlp_grpc_log) - endif() - - if(WITH_OTLP_HTTP) - target_link_libraries(opentelemetry_cpp - PRIVATE opentelemetry_exporter_otlp_http_log) - endif() +target_link_libraries( + opentelemetry_cpp PRIVATE opentelemetry_logs + opentelemetry_exporter_ostream_logs) + +if(WITH_OTLP_GRPC) + target_link_libraries(opentelemetry_cpp + PRIVATE opentelemetry_exporter_otlp_grpc_log) +endif() + +if(WITH_OTLP_HTTP) + target_link_libraries(opentelemetry_cpp + PRIVATE opentelemetry_exporter_otlp_http_log) endif() add_custom_command( diff --git a/ext/src/dll/dllmain.cc b/ext/src/dll/dllmain.cc index 3dc5bc5c11..1812377374 100644 --- a/ext/src/dll/dllmain.cc +++ b/ext/src/dll/dllmain.cc @@ -6,9 +6,8 @@ // Include API header files here for exporting #include -#if defined(ENABLE_LOGS_PREVIEW) -# include -#endif // ENABLE_LOGS_PREVIEW +#include +#include extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) { diff --git a/ext/src/dll/opentelemetry_cpp.src b/ext/src/dll/opentelemetry_cpp.src index 043b6a96d6..1afa635df4 100644 --- a/ext/src/dll/opentelemetry_cpp.src +++ b/ext/src/dll/opentelemetry_cpp.src @@ -22,7 +22,6 @@ EXPORTS // public: static class std::unique_ptr > __cdecl opentelemetry::v1::exporter::otlp::OtlpHttpExporterFactory::Create(struct opentelemetry::v1::exporter::otlp::OtlpHttpExporterOptions const & __ptr64) ?Create@OtlpHttpExporterFactory@otlp@exporter@v1@opentelemetry@@SA?AV?$unique_ptr@VSpanExporter@trace@sdk@v1@opentelemetry@@U?$default_delete@VSpanExporter@trace@sdk@v1@opentelemetry@@@std@@@std@@AEBUOtlpHttpExporterOptions@2345@@Z #endif // defined(WITH_OTLP_HTTP) -#if defined(ENABLE_LOGS_PREVIEW) // public: static class std::unique_ptr > __cdecl opentelemetry::v1::sdk::logs::LoggerProviderFactory::Create(class std::unique_ptr > && __ptr64) #if defined(_WIN64) ?Create@LoggerProviderFactory@logs@sdk@v1@opentelemetry@@SA?AV?$unique_ptr@VLoggerProvider@logs@v1@opentelemetry@@U?$default_delete@VLoggerProvider@logs@v1@opentelemetry@@@std@@@std@@$$QEAV?$unique_ptr@VLogRecordProcessor@logs@sdk@v1@opentelemetry@@U?$default_delete@VLogRecordProcessor@logs@sdk@v1@opentelemetry@@@std@@@7@@Z @@ -45,15 +44,29 @@ EXPORTS #if defined(WIN32) ?Create@MultiLogRecordProcessorFactory@logs@sdk@v1@opentelemetry@@SA?AV?$unique_ptr@VLogRecordProcessor@logs@sdk@v1@opentelemetry@@U?$default_delete@VLogRecordProcessor@logs@sdk@v1@opentelemetry@@@std@@@std@@$$QEAV?$vector@V?$unique_ptr@VLogRecordProcessor@logs@sdk@v1@opentelemetry@@U?$default_delete@VLogRecordProcessor@logs@sdk@v1@opentelemetry@@@std@@@std@@V?$allocator@V?$unique_ptr@VLogRecordProcessor@logs@sdk@v1@opentelemetry@@U?$default_delete@VLogRecordProcessor@logs@sdk@v1@opentelemetry@@@std@@@std@@@2@@7@@Z #else - ?Create@MultiLogRecordProcessorFactory@logs@sdk@v1@opentelemetry@@SA?AV?$unique_ptr@VLogRecordProcessor@logs@sdk@v1@opentelemetry@@U?$default_delete@VLogRecordProcessor@logs@sdk@v1@opentelemetry@@@std@@@std@@$$QAV?$vector@V?$unique_ptr@VLogRecordProcessor@logs@sdk@v1@opentelemetry@@U?$default_delete@VLogRecordProcessor@logs@sdk@v1@opentelemetry@@@std@@@std@@V?$allocator@V?$unique_ptr@VLogRecordProcessor@logs@sdk@v1@opentelemetry@@U?$default_delete@VLogRecordProcessor@logs@sdk@v1@opentelemetry@@@std@@@std@@@2@@7@@Z + ?Create@MultiLogRecordProcessorFactory@logs@sdk@v1@opentelemetry@@SA?AV?$unique_ptr@VLogRecordProcessor@logs@sdk@v1@opentelemetry@@U?$default_delete@VLogRecordProcessor@logs@sdk@v1@opentelemetry@@@std@@@std@@$$QEAV?$vector@V?$unique_ptr@VLogRecordProcessor@logs@sdk@v1@opentelemetry@@U?$default_delete@VLogRecordProcessor@logs@sdk@v1@opentelemetry@@@std@@@std@@V?$allocator@V?$unique_ptr@VLogRecordProcessor@logs@sdk@v1@opentelemetry@@U?$default_delete@VLogRecordProcessor@logs@sdk@v1@opentelemetry@@@std@@@std@@@2@@7@@Z #endif + ?ForceFlush@TracerProvider@trace@sdk@v1@opentelemetry@@QEAA_NV?$duration@_JU?$ratio@$00$0PECEA@@std@@@chrono@std@@@Z + ?ForceFlush@LoggerProvider@logs@sdk@v1@opentelemetry@@QEAA_NV?$duration@_JU?$ratio@$00$0PECEA@@std@@@chrono@std@@@Z + ??0OStreamLogRecordExporter@logs@exporter@v1@opentelemetry@@QEAA@AEAV?$basic_ostream@DU?$char_traits@D@std@@@std@@@Z +#if defined(WITH_OTLP_GRPC) || defined(WITH_OTLP_HTTP) + ?GetOtlpDefaultTracesTimeout@otlp@exporter@v1@opentelemetry@@YA?AV?$duration@_JU?$ratio@$00$0JIJGIA@@std@@@chrono@std@@XZ + ?GetOtlpDefaultTracesHeaders@otlp@exporter@v1@opentelemetry@@YA?AV?$multimap@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@Ucmp_ic@otlp@exporter@v1@opentelemetry@@V?$allocator@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@@std@@@2@@std@@XZ + ?GetOtlpDefaultLogsTimeout@otlp@exporter@v1@opentelemetry@@YA?AV?$duration@_JU?$ratio@$00$0JIJGIA@@std@@@chrono@std@@XZ + ?GetOtlpDefaultLogsHeaders@otlp@exporter@v1@opentelemetry@@YA?AV?$multimap@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@Ucmp_ic@otlp@exporter@v1@opentelemetry@@V?$allocator@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@@std@@@2@@std@@XZ +#endif // defined(WITH_OTLP_GRPC) || defined(WITH_OTLP_HTTP) #if defined(WITH_OTLP_GRPC) // public: static class std::unique_ptr > __cdecl opentelemetry::v1::exporter::otlp::OtlpGrpcLogRecordExporterFactory::Create(struct opentelemetry::v1::exporter::otlp::OtlpGrpcExporterOptions const & __ptr64) ?Create@OtlpGrpcLogRecordExporterFactory@otlp@exporter@v1@opentelemetry@@SA?AV?$unique_ptr@VLogRecordExporter@logs@sdk@v1@opentelemetry@@U?$default_delete@VLogRecordExporter@logs@sdk@v1@opentelemetry@@@std@@@std@@AEBUOtlpGrpcExporterOptions@2345@@Z + ?GetOtlpDefaultGrpcTracesEndpoint@otlp@exporter@v1@opentelemetry@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ + ?GetOtlpDefaultGrpcTracesIsInsecure@otlp@exporter@v1@opentelemetry@@YA_NXZ + ?GetOtlpDefaultTracesSslCertificatePath@otlp@exporter@v1@opentelemetry@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ + ?GetOtlpDefaultTracesSslCertificateString@otlp@exporter@v1@opentelemetry@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ #endif // defined(WITH_OTLP_GRPC) #if defined(WITH_OTLP_HTTP) // public: static class std::unique_ptr > __cdecl opentelemetry::v1::exporter::otlp::OtlpHttpLogRecordExporterFactory::Create(struct opentelemetry::v1::exporter::otlp::OtlpHttpLogRecordExporterOptions const & __ptr64) ?Create@OtlpHttpLogRecordExporterFactory@otlp@exporter@v1@opentelemetry@@SA?AV?$unique_ptr@VLogRecordExporter@logs@sdk@v1@opentelemetry@@U?$default_delete@VLogRecordExporter@logs@sdk@v1@opentelemetry@@@std@@@std@@AEBUOtlpHttpLogRecordExporterOptions@2345@@Z -#endif // defined(WITH_OTLP_HTTP) -#endif // defined(ENABLE_LOGS_PREVIEW) + ?GetOtlpDefaultHttpTracesEndpoint@otlp@exporter@v1@opentelemetry@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ + ?GetOtlpDefaultHttpLogsEndpoint@otlp@exporter@v1@opentelemetry@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ +#endif // defined(WITH_OTLP_HTTP) // clang-format on diff --git a/sdk/CMakeLists.txt b/sdk/CMakeLists.txt index 2e8f3bb61d..90d07a984a 100644 --- a/sdk/CMakeLists.txt +++ b/sdk/CMakeLists.txt @@ -23,17 +23,11 @@ if(OPENTELEMETRY_INSTALL) FILES_MATCHING PATTERN "*config.h") - set(LOGS_EXCLUDE_PATTERN "") - if(NOT WITH_LOGS_PREVIEW) - set(LOGS_EXCLUDE_PATTERN "logs") - endif() - install( DIRECTORY include/opentelemetry/sdk DESTINATION include/opentelemetry FILES_MATCHING - PATTERN "*.h" - PATTERN "${LOGS_EXCLUDE_PATTERN}" EXCLUDE) + PATTERN "*.h") endif() add_subdirectory(src) diff --git a/sdk/include/opentelemetry/sdk/common/empty_attributes.h b/sdk/include/opentelemetry/sdk/common/empty_attributes.h index 664f907d23..1e0a6393bd 100644 --- a/sdk/include/opentelemetry/sdk/common/empty_attributes.h +++ b/sdk/include/opentelemetry/sdk/common/empty_attributes.h @@ -14,13 +14,13 @@ OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk { + /** * Maintain a static empty array of pairs that represents empty (default) attributes. * This helps to avoid constructing a new empty container every time a call is made * with default attributes. */ -OPENTELEMETRY_MAYBE_UNUSED static const opentelemetry::common::KeyValueIterableView< - std::array, 0>> +static const opentelemetry::common::KeyValueIterableView, 0>> &GetEmptyAttributes() noexcept { static const std::array, 0> array{}; @@ -30,5 +30,6 @@ OPENTELEMETRY_MAYBE_UNUSED static const opentelemetry::common::KeyValueIterableV return kEmptyAttributes; } + } // namespace sdk OPENTELEMETRY_END_NAMESPACE diff --git a/sdk/include/opentelemetry/sdk/logs/batch_log_record_processor.h b/sdk/include/opentelemetry/sdk/logs/batch_log_record_processor.h index d1cd045a58..d0b3577491 100644 --- a/sdk/include/opentelemetry/sdk/logs/batch_log_record_processor.h +++ b/sdk/include/opentelemetry/sdk/logs/batch_log_record_processor.h @@ -2,19 +2,18 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifdef ENABLE_LOGS_PREVIEW -# include "opentelemetry/sdk/common/circular_buffer.h" -# include "opentelemetry/sdk/logs/batch_log_record_processor_options.h" -# include "opentelemetry/sdk/logs/exporter.h" -# include "opentelemetry/sdk/logs/processor.h" -# include "opentelemetry/version.h" +#include "opentelemetry/sdk/common/circular_buffer.h" +#include "opentelemetry/sdk/logs/batch_log_record_processor_options.h" +#include "opentelemetry/sdk/logs/exporter.h" +#include "opentelemetry/sdk/logs/processor.h" +#include "opentelemetry/version.h" -# include -# include -# include -# include -# include +#include +#include +#include +#include +#include OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -155,4 +154,3 @@ class BatchLogRecordProcessor : public LogRecordProcessor } // namespace logs } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/logs/batch_log_record_processor_factory.h b/sdk/include/opentelemetry/sdk/logs/batch_log_record_processor_factory.h index 83740542cb..74e0efbb59 100644 --- a/sdk/include/opentelemetry/sdk/logs/batch_log_record_processor_factory.h +++ b/sdk/include/opentelemetry/sdk/logs/batch_log_record_processor_factory.h @@ -3,11 +3,9 @@ #pragma once -#ifdef ENABLE_LOGS_PREVIEW +#include -# include - -# include "opentelemetry/version.h" +#include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -36,4 +34,3 @@ class OPENTELEMETRY_EXPORT BatchLogRecordProcessorFactory } // namespace logs } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/logs/batch_log_record_processor_options.h b/sdk/include/opentelemetry/sdk/logs/batch_log_record_processor_options.h index 05a2c48c3c..b130f947af 100644 --- a/sdk/include/opentelemetry/sdk/logs/batch_log_record_processor_options.h +++ b/sdk/include/opentelemetry/sdk/logs/batch_log_record_processor_options.h @@ -3,12 +3,10 @@ #pragma once -#ifdef ENABLE_LOGS_PREVIEW +#include +#include -# include -# include - -# include "opentelemetry/version.h" +#include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -41,4 +39,3 @@ struct BatchLogRecordProcessorOptions } // namespace logs } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/logs/event_logger.h b/sdk/include/opentelemetry/sdk/logs/event_logger.h index b15754940a..8230beeb32 100644 --- a/sdk/include/opentelemetry/sdk/logs/event_logger.h +++ b/sdk/include/opentelemetry/sdk/logs/event_logger.h @@ -2,15 +2,14 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifdef ENABLE_LOGS_PREVIEW -# include +#include -# include "opentelemetry/logs/event_logger.h" -# include "opentelemetry/nostd/shared_ptr.h" -# include "opentelemetry/nostd/string_view.h" -# include "opentelemetry/nostd/unique_ptr.h" -# include "opentelemetry/version.h" +#include "opentelemetry/logs/event_logger.h" +#include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/nostd/string_view.h" +#include "opentelemetry/nostd/unique_ptr.h" +#include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -51,4 +50,3 @@ class EventLogger final : public opentelemetry::logs::EventLogger } // namespace logs } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/logs/event_logger_provider.h b/sdk/include/opentelemetry/sdk/logs/event_logger_provider.h index 0eb9435f45..2f3d2a0afd 100644 --- a/sdk/include/opentelemetry/sdk/logs/event_logger_provider.h +++ b/sdk/include/opentelemetry/sdk/logs/event_logger_provider.h @@ -2,16 +2,15 @@ // SPDX-License-Identifier: Apache-2.0/ #pragma once -#ifdef ENABLE_LOGS_PREVIEW -# include "opentelemetry/logs/event_logger_provider.h" -# include "opentelemetry/nostd/shared_ptr.h" -# include "opentelemetry/nostd/string_view.h" -# include "opentelemetry/version.h" +#include "opentelemetry/logs/event_logger_provider.h" +#include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/nostd/string_view.h" +#include "opentelemetry/version.h" // Define the maximum number of loggers that are allowed to be registered to the loggerprovider. // TODO: Add link to logging spec once this is added to it -# define MAX_LOGGER_COUNT 100 +#define MAX_LOGGER_COUNT 100 OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -35,4 +34,3 @@ class EventLoggerProvider final : public opentelemetry::logs::EventLoggerProvide } // namespace logs } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/logs/event_logger_provider_factory.h b/sdk/include/opentelemetry/sdk/logs/event_logger_provider_factory.h index ecc78d1b80..0b8c066fc6 100644 --- a/sdk/include/opentelemetry/sdk/logs/event_logger_provider_factory.h +++ b/sdk/include/opentelemetry/sdk/logs/event_logger_provider_factory.h @@ -3,10 +3,8 @@ #pragma once -#ifdef ENABLE_LOGS_PREVIEW - -# include -# include "opentelemetry/version.h" +#include +#include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace logs @@ -34,4 +32,3 @@ class EventLoggerProviderFactory } // namespace logs } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif /* ENABLE_LOGS_PREVIEW */ diff --git a/sdk/include/opentelemetry/sdk/logs/exporter.h b/sdk/include/opentelemetry/sdk/logs/exporter.h index fc0e68564c..bdddc4209c 100644 --- a/sdk/include/opentelemetry/sdk/logs/exporter.h +++ b/sdk/include/opentelemetry/sdk/logs/exporter.h @@ -2,14 +2,13 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifdef ENABLE_LOGS_PREVIEW -# include -# include +#include +#include -# include "opentelemetry/nostd/span.h" -# include "opentelemetry/sdk/common/exporter_utils.h" -# include "opentelemetry/version.h" +#include "opentelemetry/nostd/span.h" +#include "opentelemetry/sdk/common/exporter_utils.h" +#include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -68,4 +67,3 @@ class OPENTELEMETRY_EXPORT LogRecordExporter } // namespace logs } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/logs/logger.h b/sdk/include/opentelemetry/sdk/logs/logger.h index 67eafe84bc..fbbf4f28a5 100644 --- a/sdk/include/opentelemetry/sdk/logs/logger.h +++ b/sdk/include/opentelemetry/sdk/logs/logger.h @@ -2,18 +2,17 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifdef ENABLE_LOGS_PREVIEW -# include -# include +#include +#include -# include "opentelemetry/common/macros.h" -# include "opentelemetry/logs/logger.h" -# include "opentelemetry/nostd/string_view.h" -# include "opentelemetry/nostd/unique_ptr.h" -# include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h" -# include "opentelemetry/sdk/logs/logger_context.h" -# include "opentelemetry/version.h" +#include "opentelemetry/common/macros.h" +#include "opentelemetry/logs/logger.h" +#include "opentelemetry/nostd/string_view.h" +#include "opentelemetry/nostd/unique_ptr.h" +#include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h" +#include "opentelemetry/sdk/logs/logger_context.h" +#include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -72,4 +71,3 @@ class Logger final : public opentelemetry::logs::Logger } // namespace logs } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/logs/logger_context.h b/sdk/include/opentelemetry/sdk/logs/logger_context.h index 196ecd545f..ee47c56a7f 100644 --- a/sdk/include/opentelemetry/sdk/logs/logger_context.h +++ b/sdk/include/opentelemetry/sdk/logs/logger_context.h @@ -3,15 +3,13 @@ #pragma once -#ifdef ENABLE_LOGS_PREVIEW +#include +#include +#include -# include -# include -# include - -# include "opentelemetry/sdk/logs/processor.h" -# include "opentelemetry/sdk/resource/resource.h" -# include "opentelemetry/version.h" +#include "opentelemetry/sdk/logs/processor.h" +#include "opentelemetry/sdk/resource/resource.h" +#include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -83,4 +81,3 @@ class LoggerContext } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/logs/logger_context_factory.h b/sdk/include/opentelemetry/sdk/logs/logger_context_factory.h index 0e3502c10c..9f8a8a54ba 100644 --- a/sdk/include/opentelemetry/sdk/logs/logger_context_factory.h +++ b/sdk/include/opentelemetry/sdk/logs/logger_context_factory.h @@ -3,12 +3,10 @@ #pragma once -#ifdef ENABLE_LOGS_PREVIEW +#include +#include -# include -# include - -# include "opentelemetry/version.h" +#include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -47,4 +45,3 @@ class LoggerContextFactory } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/logs/logger_provider.h b/sdk/include/opentelemetry/sdk/logs/logger_provider.h index 01dc241470..0ab5683d3e 100644 --- a/sdk/include/opentelemetry/sdk/logs/logger_provider.h +++ b/sdk/include/opentelemetry/sdk/logs/logger_provider.h @@ -2,21 +2,20 @@ // SPDX-License-Identifier: Apache-2.0/ #pragma once -#ifdef ENABLE_LOGS_PREVIEW -# include -# include -# include +#include +#include +#include -# include "opentelemetry/logs/logger_provider.h" -# include "opentelemetry/nostd/shared_ptr.h" -# include "opentelemetry/nostd/string_view.h" -# include "opentelemetry/sdk/resource/resource.h" -# include "opentelemetry/version.h" +#include "opentelemetry/logs/logger_provider.h" +#include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/nostd/string_view.h" +#include "opentelemetry/sdk/resource/resource.h" +#include "opentelemetry/version.h" // Define the maximum number of loggers that are allowed to be registered to the loggerprovider. // TODO: Add link to logging spec once this is added to it -# define MAX_LOGGER_COUNT 100 +#define MAX_LOGGER_COUNT 100 OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -112,4 +111,3 @@ class LoggerProvider final : public opentelemetry::logs::LoggerProvider } // namespace logs } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/logs/logger_provider_factory.h b/sdk/include/opentelemetry/sdk/logs/logger_provider_factory.h index 5d74d7918d..987a09fe16 100644 --- a/sdk/include/opentelemetry/sdk/logs/logger_provider_factory.h +++ b/sdk/include/opentelemetry/sdk/logs/logger_provider_factory.h @@ -3,12 +3,10 @@ #pragma once -#ifdef ENABLE_LOGS_PREVIEW +#include +#include -# include -# include - -# include "opentelemetry/version.h" +#include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace logs @@ -70,4 +68,3 @@ class OPENTELEMETRY_EXPORT LoggerProviderFactory } // namespace logs } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif /* ENABLE_LOGS_PREVIEW */ diff --git a/sdk/include/opentelemetry/sdk/logs/multi_log_record_processor.h b/sdk/include/opentelemetry/sdk/logs/multi_log_record_processor.h index 91995aa6a3..335da7f668 100644 --- a/sdk/include/opentelemetry/sdk/logs/multi_log_record_processor.h +++ b/sdk/include/opentelemetry/sdk/logs/multi_log_record_processor.h @@ -3,14 +3,12 @@ #pragma once -#ifdef ENABLE_LOGS_PREVIEW +#include +#include +#include -# include -# include -# include - -# include "opentelemetry/sdk/logs/processor.h" -# include "opentelemetry/version.h" +#include "opentelemetry/sdk/logs/processor.h" +#include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -66,4 +64,3 @@ class MultiLogRecordProcessor : public LogRecordProcessor } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/logs/multi_log_record_processor_factory.h b/sdk/include/opentelemetry/sdk/logs/multi_log_record_processor_factory.h index c3e87c12db..26bd9152ce 100644 --- a/sdk/include/opentelemetry/sdk/logs/multi_log_record_processor_factory.h +++ b/sdk/include/opentelemetry/sdk/logs/multi_log_record_processor_factory.h @@ -3,12 +3,10 @@ #pragma once -#ifdef ENABLE_LOGS_PREVIEW +#include +#include -# include -# include - -# include "opentelemetry/version.h" +#include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -31,4 +29,3 @@ class OPENTELEMETRY_EXPORT MultiLogRecordProcessorFactory } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/logs/multi_recordable.h b/sdk/include/opentelemetry/sdk/logs/multi_recordable.h index 97ae1451fc..1eb4b1a221 100644 --- a/sdk/include/opentelemetry/sdk/logs/multi_recordable.h +++ b/sdk/include/opentelemetry/sdk/logs/multi_recordable.h @@ -3,16 +3,14 @@ #pragma once -#ifdef ENABLE_LOGS_PREVIEW +#include +#include +#include -# include -# include -# include - -# include "opentelemetry/common/macros.h" -# include "opentelemetry/sdk/logs/recordable.h" -# include "opentelemetry/sdk/resource/resource.h" -# include "opentelemetry/version.h" +#include "opentelemetry/common/macros.h" +#include "opentelemetry/sdk/logs/recordable.h" +#include "opentelemetry/sdk/resource/resource.h" +#include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -109,5 +107,3 @@ class MultiRecordable final : public Recordable } // namespace sdk OPENTELEMETRY_END_NAMESPACE - -#endif diff --git a/sdk/include/opentelemetry/sdk/logs/processor.h b/sdk/include/opentelemetry/sdk/logs/processor.h index 8a409e0020..79a25ff260 100644 --- a/sdk/include/opentelemetry/sdk/logs/processor.h +++ b/sdk/include/opentelemetry/sdk/logs/processor.h @@ -2,12 +2,11 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifdef ENABLE_LOGS_PREVIEW -# include -# include +#include +#include -# include "opentelemetry/version.h" +#include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -62,4 +61,3 @@ class LogRecordProcessor } // namespace logs } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/logs/read_write_log_record.h b/sdk/include/opentelemetry/sdk/logs/read_write_log_record.h index 915c8852e9..9831eaa1c9 100644 --- a/sdk/include/opentelemetry/sdk/logs/read_write_log_record.h +++ b/sdk/include/opentelemetry/sdk/logs/read_write_log_record.h @@ -2,25 +2,23 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifdef ENABLE_LOGS_PREVIEW - -# include -# include -# include - -# include "opentelemetry/common/attribute_value.h" -# include "opentelemetry/common/key_value_iterable.h" -# include "opentelemetry/common/timestamp.h" -# include "opentelemetry/logs/log_record.h" -# include "opentelemetry/logs/severity.h" -# include "opentelemetry/nostd/string_view.h" -# include "opentelemetry/sdk/common/attribute_utils.h" -# include "opentelemetry/sdk/common/empty_attributes.h" -# include "opentelemetry/sdk/logs/readable_log_record.h" -# include "opentelemetry/trace/span_id.h" -# include "opentelemetry/trace/trace_flags.h" -# include "opentelemetry/trace/trace_id.h" -# include "opentelemetry/version.h" + +#include +#include +#include + +#include "opentelemetry/common/attribute_value.h" +#include "opentelemetry/common/key_value_iterable.h" +#include "opentelemetry/common/timestamp.h" +#include "opentelemetry/logs/log_record.h" +#include "opentelemetry/logs/severity.h" +#include "opentelemetry/nostd/string_view.h" +#include "opentelemetry/sdk/common/attribute_utils.h" +#include "opentelemetry/sdk/logs/readable_log_record.h" +#include "opentelemetry/trace/span_id.h" +#include "opentelemetry/trace/trace_flags.h" +#include "opentelemetry/trace/trace_id.h" +#include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -209,4 +207,3 @@ class ReadWriteLogRecord final : public ReadableLogRecord } // namespace logs } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/logs/readable_log_record.h b/sdk/include/opentelemetry/sdk/logs/readable_log_record.h index ba20ca7949..acec5b88f9 100644 --- a/sdk/include/opentelemetry/sdk/logs/readable_log_record.h +++ b/sdk/include/opentelemetry/sdk/logs/readable_log_record.h @@ -2,17 +2,16 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifdef ENABLE_LOGS_PREVIEW -# include -# include +#include +#include -# include "opentelemetry/common/attribute_value.h" -# include "opentelemetry/common/timestamp.h" -# include "opentelemetry/logs/severity.h" -# include "opentelemetry/nostd/string_view.h" -# include "opentelemetry/sdk/logs/recordable.h" -# include "opentelemetry/version.h" +#include "opentelemetry/common/attribute_value.h" +#include "opentelemetry/common/timestamp.h" +#include "opentelemetry/logs/severity.h" +#include "opentelemetry/nostd/string_view.h" +#include "opentelemetry/sdk/logs/recordable.h" +#include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace trace @@ -140,4 +139,3 @@ class ReadableLogRecord : public Recordable } // namespace logs } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/logs/recordable.h b/sdk/include/opentelemetry/sdk/logs/recordable.h index ff0099af56..65f5f6ae94 100644 --- a/sdk/include/opentelemetry/sdk/logs/recordable.h +++ b/sdk/include/opentelemetry/sdk/logs/recordable.h @@ -2,10 +2,9 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifdef ENABLE_LOGS_PREVIEW -# include "opentelemetry/logs/log_record.h" -# include "opentelemetry/version.h" +#include "opentelemetry/logs/log_record.h" +#include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -49,4 +48,3 @@ class Recordable : public opentelemetry::logs::LogRecord } // namespace logs } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/logs/simple_log_record_processor.h b/sdk/include/opentelemetry/sdk/logs/simple_log_record_processor.h index de9cecdd84..e195f89c10 100644 --- a/sdk/include/opentelemetry/sdk/logs/simple_log_record_processor.h +++ b/sdk/include/opentelemetry/sdk/logs/simple_log_record_processor.h @@ -2,15 +2,14 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifdef ENABLE_LOGS_PREVIEW -# include -# include -# include +#include +#include +#include -# include "opentelemetry/common/spin_lock_mutex.h" -# include "opentelemetry/sdk/logs/processor.h" -# include "opentelemetry/version.h" +#include "opentelemetry/common/spin_lock_mutex.h" +#include "opentelemetry/sdk/logs/processor.h" +#include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -58,4 +57,3 @@ class SimpleLogRecordProcessor : public LogRecordProcessor } // namespace logs } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/logs/simple_log_record_processor_factory.h b/sdk/include/opentelemetry/sdk/logs/simple_log_record_processor_factory.h index cd022aadd6..295addce11 100644 --- a/sdk/include/opentelemetry/sdk/logs/simple_log_record_processor_factory.h +++ b/sdk/include/opentelemetry/sdk/logs/simple_log_record_processor_factory.h @@ -3,11 +3,9 @@ #pragma once -#ifdef ENABLE_LOGS_PREVIEW +#include -# include - -# include "opentelemetry/version.h" +#include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -32,4 +30,3 @@ class OPENTELEMETRY_EXPORT SimpleLogRecordProcessorFactory } // namespace logs } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif /* ENABLE_LOGS_PREVIEW */ diff --git a/sdk/src/CMakeLists.txt b/sdk/src/CMakeLists.txt index 9525b3f249..377d305627 100644 --- a/sdk/src/CMakeLists.txt +++ b/sdk/src/CMakeLists.txt @@ -4,8 +4,6 @@ add_subdirectory(common) add_subdirectory(trace) add_subdirectory(metrics) -if(WITH_LOGS_PREVIEW) - add_subdirectory(logs) -endif() +add_subdirectory(logs) add_subdirectory(version) add_subdirectory(resource) diff --git a/sdk/src/logs/batch_log_record_processor.cc b/sdk/src/logs/batch_log_record_processor.cc index c4cede1a53..92536d1c00 100644 --- a/sdk/src/logs/batch_log_record_processor.cc +++ b/sdk/src/logs/batch_log_record_processor.cc @@ -1,14 +1,12 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifdef ENABLE_LOGS_PREVIEW +#include "opentelemetry/sdk/logs/batch_log_record_processor.h" +#include "opentelemetry/common/spin_lock_mutex.h" +#include "opentelemetry/common/timestamp.h" +#include "opentelemetry/sdk/logs/recordable.h" -# include "opentelemetry/sdk/logs/batch_log_record_processor.h" -# include "opentelemetry/common/spin_lock_mutex.h" -# include "opentelemetry/common/timestamp.h" -# include "opentelemetry/sdk/logs/recordable.h" - -# include +#include using opentelemetry::sdk::common::AtomicUniquePtr; using opentelemetry::sdk::common::CircularBufferRange; @@ -312,4 +310,3 @@ BatchLogRecordProcessor::~BatchLogRecordProcessor() } // namespace logs } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/src/logs/batch_log_record_processor_factory.cc b/sdk/src/logs/batch_log_record_processor_factory.cc index 67d0a677ab..dabd0f4ff8 100644 --- a/sdk/src/logs/batch_log_record_processor_factory.cc +++ b/sdk/src/logs/batch_log_record_processor_factory.cc @@ -1,10 +1,8 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifdef ENABLE_LOGS_PREVIEW - -# include "opentelemetry/sdk/logs/batch_log_record_processor_factory.h" -# include "opentelemetry/sdk/logs/batch_log_record_processor.h" +#include "opentelemetry/sdk/logs/batch_log_record_processor_factory.h" +#include "opentelemetry/sdk/logs/batch_log_record_processor.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -24,4 +22,3 @@ std::unique_ptr BatchLogRecordProcessorFactory::Create( } // namespace logs } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/src/logs/event_logger.cc b/sdk/src/logs/event_logger.cc index 2106ecb233..c9dd5c35b5 100644 --- a/sdk/src/logs/event_logger.cc +++ b/sdk/src/logs/event_logger.cc @@ -1,10 +1,9 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifdef ENABLE_LOGS_PREVIEW -# include "opentelemetry/sdk/logs/event_logger.h" -# include "opentelemetry/sdk_config.h" -# include "opentelemetry/trace/provider.h" +#include "opentelemetry/sdk/logs/event_logger.h" +#include "opentelemetry/sdk_config.h" +#include "opentelemetry/trace/provider.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -53,4 +52,3 @@ void EventLogger::EmitEvent(nostd::string_view event_name, } // namespace logs } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/src/logs/event_logger_provider.cc b/sdk/src/logs/event_logger_provider.cc index 2352fca59b..28a88d82e2 100644 --- a/sdk/src/logs/event_logger_provider.cc +++ b/sdk/src/logs/event_logger_provider.cc @@ -1,17 +1,15 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifdef ENABLE_LOGS_PREVIEW +#include "opentelemetry/sdk/logs/event_logger_provider.h" +#include "opentelemetry/sdk/common/global_log_handler.h" +#include "opentelemetry/sdk/logs/event_logger.h" -# include "opentelemetry/sdk/logs/event_logger_provider.h" -# include "opentelemetry/sdk/common/global_log_handler.h" -# include "opentelemetry/sdk/logs/event_logger.h" - -# include -# include -# include -# include -# include +#include +#include +#include +#include +#include OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -38,4 +36,3 @@ nostd::shared_ptr EventLoggerProvider::CreateE } // namespace logs } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/src/logs/event_logger_provider_factory.cc b/sdk/src/logs/event_logger_provider_factory.cc index 966f33228a..0c9eff4570 100644 --- a/sdk/src/logs/event_logger_provider_factory.cc +++ b/sdk/src/logs/event_logger_provider_factory.cc @@ -1,11 +1,9 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifdef ENABLE_LOGS_PREVIEW - -# include "opentelemetry/sdk/logs/event_logger_provider_factory.h" -# include "opentelemetry/sdk/logs/event_logger_provider.h" -# include "opentelemetry/sdk/resource/resource.h" +#include "opentelemetry/sdk/logs/event_logger_provider_factory.h" +#include "opentelemetry/sdk/logs/event_logger_provider.h" +#include "opentelemetry/sdk/resource/resource.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -21,4 +19,3 @@ std::unique_ptr EventLoggerProviderFac } // namespace logs } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/src/logs/exporter.cc b/sdk/src/logs/exporter.cc index 20fdb6b25c..e57363ff25 100644 --- a/sdk/src/logs/exporter.cc +++ b/sdk/src/logs/exporter.cc @@ -1,9 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifdef ENABLE_LOGS_PREVIEW - -# include "opentelemetry/sdk/logs/exporter.h" +#include "opentelemetry/sdk/logs/exporter.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -24,4 +22,3 @@ OPENTELEMETRY_EXPORT bool LogRecordExporter::ForceFlush( } // namespace logs } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/src/logs/logger.cc b/sdk/src/logs/logger.cc index e9ebb8bdc4..7f85ddd6a3 100644 --- a/sdk/src/logs/logger.cc +++ b/sdk/src/logs/logger.cc @@ -1,14 +1,12 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifdef ENABLE_LOGS_PREVIEW - -# include "opentelemetry/sdk/logs/logger.h" -# include "opentelemetry/context/runtime_context.h" -# include "opentelemetry/sdk/logs/processor.h" -# include "opentelemetry/sdk/logs/recordable.h" -# include "opentelemetry/sdk_config.h" -# include "opentelemetry/trace/provider.h" +#include "opentelemetry/sdk/logs/logger.h" +#include "opentelemetry/context/runtime_context.h" +#include "opentelemetry/sdk/logs/processor.h" +#include "opentelemetry/sdk/logs/recordable.h" +#include "opentelemetry/sdk_config.h" +#include "opentelemetry/trace/provider.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -106,4 +104,3 @@ Logger::GetInstrumentationScope() const noexcept } // namespace logs } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/src/logs/logger_context.cc b/sdk/src/logs/logger_context.cc index 3421ad9999..357d13193d 100644 --- a/sdk/src/logs/logger_context.cc +++ b/sdk/src/logs/logger_context.cc @@ -1,13 +1,11 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifdef ENABLE_LOGS_PREVIEW +#include "opentelemetry/sdk/logs/logger_context.h" +#include "opentelemetry/sdk/logs/multi_log_record_processor.h" -# include "opentelemetry/sdk/logs/logger_context.h" -# include "opentelemetry/sdk/logs/multi_log_record_processor.h" - -# include -# include +#include +#include OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -52,4 +50,3 @@ bool LoggerContext::Shutdown(std::chrono::microseconds timeout) noexcept } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/src/logs/logger_context_factory.cc b/sdk/src/logs/logger_context_factory.cc index 1fc07f53e5..ff57747f80 100644 --- a/sdk/src/logs/logger_context_factory.cc +++ b/sdk/src/logs/logger_context_factory.cc @@ -1,15 +1,13 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifdef ENABLE_LOGS_PREVIEW +#include "opentelemetry/sdk/logs/logger_context_factory.h" +#include "opentelemetry/sdk/logs/logger_context.h" +#include "opentelemetry/sdk/logs/processor.h" +#include "opentelemetry/sdk/resource/resource.h" -# include "opentelemetry/sdk/logs/logger_context_factory.h" -# include "opentelemetry/sdk/logs/logger_context.h" -# include "opentelemetry/sdk/logs/processor.h" -# include "opentelemetry/sdk/resource/resource.h" - -# include -# include +#include +#include OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -36,4 +34,3 @@ std::unique_ptr LoggerContextFactory::Create( } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/src/logs/logger_provider.cc b/sdk/src/logs/logger_provider.cc index 638ece3802..d64863ed73 100644 --- a/sdk/src/logs/logger_provider.cc +++ b/sdk/src/logs/logger_provider.cc @@ -1,14 +1,12 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifdef ENABLE_LOGS_PREVIEW - -# include "opentelemetry/sdk/logs/logger_provider.h" -# include "opentelemetry/sdk/common/global_log_handler.h" -# include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h" -# include "opentelemetry/sdk/logs/logger.h" -# include "opentelemetry/sdk/logs/logger_context.h" -# include "opentelemetry/sdk/logs/processor.h" +#include "opentelemetry/sdk/logs/logger_provider.h" +#include "opentelemetry/sdk/common/global_log_handler.h" +#include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h" +#include "opentelemetry/sdk/logs/logger.h" +#include "opentelemetry/sdk/logs/logger_context.h" +#include "opentelemetry/sdk/logs/processor.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -127,4 +125,3 @@ bool LoggerProvider::ForceFlush(std::chrono::microseconds timeout) noexcept } // namespace logs } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/src/logs/logger_provider_factory.cc b/sdk/src/logs/logger_provider_factory.cc index 167d6cbf65..76e662a909 100644 --- a/sdk/src/logs/logger_provider_factory.cc +++ b/sdk/src/logs/logger_provider_factory.cc @@ -1,12 +1,10 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifdef ENABLE_LOGS_PREVIEW - -# include "opentelemetry/sdk/logs/logger_provider_factory.h" -# include "opentelemetry/sdk/logs/logger_context.h" -# include "opentelemetry/sdk/logs/logger_provider.h" -# include "opentelemetry/sdk/resource/resource.h" +#include "opentelemetry/sdk/logs/logger_provider_factory.h" +#include "opentelemetry/sdk/logs/logger_context.h" +#include "opentelemetry/sdk/logs/logger_provider.h" +#include "opentelemetry/sdk/resource/resource.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -57,4 +55,3 @@ std::unique_ptr LoggerProviderFactory::Crea } // namespace logs } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/src/logs/multi_log_record_processor.cc b/sdk/src/logs/multi_log_record_processor.cc index f6e6c2e176..c0b3eb1ec6 100644 --- a/sdk/src/logs/multi_log_record_processor.cc +++ b/sdk/src/logs/multi_log_record_processor.cc @@ -1,11 +1,9 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifdef ENABLE_LOGS_PREVIEW - -# include "opentelemetry/sdk/logs/multi_log_record_processor.h" -# include "opentelemetry/sdk/logs/multi_recordable.h" -# include "opentelemetry/sdk/logs/recordable.h" +#include "opentelemetry/sdk/logs/multi_log_record_processor.h" +#include "opentelemetry/sdk/logs/multi_recordable.h" +#include "opentelemetry/sdk/logs/recordable.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -147,4 +145,3 @@ bool MultiLogRecordProcessor::Shutdown(std::chrono::microseconds timeout) noexce } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/src/logs/multi_log_record_processor_factory.cc b/sdk/src/logs/multi_log_record_processor_factory.cc index 3e0de46c32..ab49689ca0 100644 --- a/sdk/src/logs/multi_log_record_processor_factory.cc +++ b/sdk/src/logs/multi_log_record_processor_factory.cc @@ -1,14 +1,12 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifdef ENABLE_LOGS_PREVIEW +#include "opentelemetry/sdk/logs/multi_log_record_processor_factory.h" +#include "opentelemetry/sdk/logs/multi_log_record_processor.h" -# include "opentelemetry/sdk/logs/multi_log_record_processor_factory.h" -# include "opentelemetry/sdk/logs/multi_log_record_processor.h" - -# include -# include -# include +#include +#include +#include OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -27,4 +25,3 @@ std::unique_ptr MultiLogRecordProcessorFactory::Create( } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/src/logs/multi_recordable.cc b/sdk/src/logs/multi_recordable.cc index c1e335ead2..7d80259f27 100644 --- a/sdk/src/logs/multi_recordable.cc +++ b/sdk/src/logs/multi_recordable.cc @@ -1,13 +1,11 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifdef ENABLE_LOGS_PREVIEW +#include "opentelemetry/sdk/logs/multi_recordable.h" -# include "opentelemetry/sdk/logs/multi_recordable.h" - -# include -# include -# include +#include +#include +#include OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -185,4 +183,3 @@ void MultiRecordable::SetInstrumentationScope( } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/src/logs/read_write_log_record.cc b/sdk/src/logs/read_write_log_record.cc index f45c20adff..e6dea3d9e4 100644 --- a/sdk/src/logs/read_write_log_record.cc +++ b/sdk/src/logs/read_write_log_record.cc @@ -1,12 +1,10 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifdef ENABLE_LOGS_PREVIEW +#include +#include -# include -# include - -# include "opentelemetry/sdk/logs/read_write_log_record.h" +#include "opentelemetry/sdk/logs/read_write_log_record.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -189,4 +187,3 @@ void ReadWriteLogRecord::SetInstrumentationScope( } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/src/logs/readable_log_record.cc b/sdk/src/logs/readable_log_record.cc index f02d475d47..80493354e3 100644 --- a/sdk/src/logs/readable_log_record.cc +++ b/sdk/src/logs/readable_log_record.cc @@ -1,15 +1,13 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifdef ENABLE_LOGS_PREVIEW +#include "opentelemetry/sdk/logs/readable_log_record.h" +#include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h" +#include "opentelemetry/sdk/resource/resource.h" +#include "opentelemetry/sdk/version/version.h" -# include "opentelemetry/sdk/logs/readable_log_record.h" -# include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h" -# include "opentelemetry/sdk/resource/resource.h" -# include "opentelemetry/sdk/version/version.h" - -# include -# include +#include +#include OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -51,4 +49,3 @@ const opentelemetry::sdk::resource::Resource &ReadableLogRecord::GetDefaultResou } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/src/logs/simple_log_record_processor.cc b/sdk/src/logs/simple_log_record_processor.cc index 2c33739bef..68f90e83ab 100644 --- a/sdk/src/logs/simple_log_record_processor.cc +++ b/sdk/src/logs/simple_log_record_processor.cc @@ -1,14 +1,12 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifdef ENABLE_LOGS_PREVIEW +#include "opentelemetry/sdk/logs/simple_log_record_processor.h" +#include "opentelemetry/nostd/span.h" +#include "opentelemetry/sdk/logs/exporter.h" +#include "opentelemetry/sdk/logs/recordable.h" -# include "opentelemetry/sdk/logs/simple_log_record_processor.h" -# include "opentelemetry/nostd/span.h" -# include "opentelemetry/sdk/logs/exporter.h" -# include "opentelemetry/sdk/logs/recordable.h" - -# include +#include OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -76,4 +74,3 @@ bool SimpleLogRecordProcessor::IsShutdown() const noexcept } // namespace logs } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/src/logs/simple_log_record_processor_factory.cc b/sdk/src/logs/simple_log_record_processor_factory.cc index 213f61e16c..6146efc174 100644 --- a/sdk/src/logs/simple_log_record_processor_factory.cc +++ b/sdk/src/logs/simple_log_record_processor_factory.cc @@ -1,10 +1,8 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifdef ENABLE_LOGS_PREVIEW - -# include "opentelemetry/sdk/logs/simple_log_record_processor_factory.h" -# include "opentelemetry/sdk/logs/simple_log_record_processor.h" +#include "opentelemetry/sdk/logs/simple_log_record_processor_factory.h" +#include "opentelemetry/sdk/logs/simple_log_record_processor.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -22,4 +20,3 @@ std::unique_ptr SimpleLogRecordProcessorFactory::Create( } // namespace logs } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/test/CMakeLists.txt b/sdk/test/CMakeLists.txt index 5c2ce0d288..33dd07f81a 100644 --- a/sdk/test/CMakeLists.txt +++ b/sdk/test/CMakeLists.txt @@ -4,8 +4,6 @@ add_subdirectory(common) add_subdirectory(trace) add_subdirectory(metrics) -if(WITH_LOGS_PREVIEW) - add_subdirectory(logs) -endif() +add_subdirectory(logs) add_subdirectory(resource) add_subdirectory(instrumentationscope) diff --git a/sdk/test/logs/batch_log_record_processor_test.cc b/sdk/test/logs/batch_log_record_processor_test.cc index 41ae2c5123..33db0da479 100644 --- a/sdk/test/logs/batch_log_record_processor_test.cc +++ b/sdk/test/logs/batch_log_record_processor_test.cc @@ -1,16 +1,14 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifdef ENABLE_LOGS_PREVIEW +#include "opentelemetry/sdk/logs/batch_log_record_processor.h" +#include "opentelemetry/sdk/logs/exporter.h" +#include "opentelemetry/sdk/logs/recordable.h" -# include "opentelemetry/sdk/logs/batch_log_record_processor.h" -# include "opentelemetry/sdk/logs/exporter.h" -# include "opentelemetry/sdk/logs/recordable.h" - -# include -# include -# include -# include +#include +#include +#include +#include using namespace opentelemetry::sdk::logs; using namespace opentelemetry::sdk::common; @@ -341,4 +339,3 @@ TEST_F(BatchLogRecordProcessorTest, TestScheduledDelayMillis) EXPECT_EQ("Log" + std::to_string(i), logs_received->at(i)->GetBody()); } } -#endif diff --git a/sdk/test/logs/log_record_test.cc b/sdk/test/logs/log_record_test.cc index 4f7deb06d0..689ca7f8ed 100644 --- a/sdk/test/logs/log_record_test.cc +++ b/sdk/test/logs/log_record_test.cc @@ -1,22 +1,20 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifdef ENABLE_LOGS_PREVIEW +#include +#include +#include +#include -# include -# include -# include -# include +#include "opentelemetry/logs/logger.h" +#include "opentelemetry/logs/provider.h" +#include "opentelemetry/nostd/variant.h" +#include "opentelemetry/sdk/logs/read_write_log_record.h" +#include "opentelemetry/sdk/resource/resource.h" +#include "opentelemetry/trace/span_id.h" +#include "opentelemetry/trace/trace_id.h" -# include "opentelemetry/logs/logger.h" -# include "opentelemetry/logs/provider.h" -# include "opentelemetry/nostd/variant.h" -# include "opentelemetry/sdk/logs/read_write_log_record.h" -# include "opentelemetry/sdk/resource/resource.h" -# include "opentelemetry/trace/span_id.h" -# include "opentelemetry/trace/trace_id.h" - -# include +#include using opentelemetry::sdk::logs::ReadWriteLogRecord; namespace trace_api = opentelemetry::trace; @@ -322,5 +320,3 @@ TEST(LogBody, BodyConversation) } } } - -#endif diff --git a/sdk/test/logs/logger_provider_sdk_test.cc b/sdk/test/logs/logger_provider_sdk_test.cc index c6b8dec372..51f40178ba 100644 --- a/sdk/test/logs/logger_provider_sdk_test.cc +++ b/sdk/test/logs/logger_provider_sdk_test.cc @@ -1,22 +1,20 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifdef ENABLE_LOGS_PREVIEW +#include +#include -# include -# include +#include "opentelemetry/logs/provider.h" +#include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/nostd/string_view.h" +#include "opentelemetry/sdk/logs/event_logger_provider_factory.h" +#include "opentelemetry/sdk/logs/exporter.h" +#include "opentelemetry/sdk/logs/logger.h" +#include "opentelemetry/sdk/logs/logger_provider.h" +#include "opentelemetry/sdk/logs/recordable.h" +#include "opentelemetry/sdk/logs/simple_log_record_processor.h" -# include "opentelemetry/logs/provider.h" -# include "opentelemetry/nostd/shared_ptr.h" -# include "opentelemetry/nostd/string_view.h" -# include "opentelemetry/sdk/logs/event_logger_provider_factory.h" -# include "opentelemetry/sdk/logs/exporter.h" -# include "opentelemetry/sdk/logs/logger.h" -# include "opentelemetry/sdk/logs/logger_provider.h" -# include "opentelemetry/sdk/logs/recordable.h" -# include "opentelemetry/sdk/logs/simple_log_record_processor.h" - -# include +#include using namespace opentelemetry::sdk::logs; namespace logs_api = opentelemetry::logs; @@ -191,5 +189,3 @@ TEST(LoggerProviderSDK, ForceFlush) EXPECT_TRUE(lp.ForceFlush()); } - -#endif diff --git a/sdk/test/logs/logger_sdk_test.cc b/sdk/test/logs/logger_sdk_test.cc index 66f9edb8c5..62d523b92a 100644 --- a/sdk/test/logs/logger_sdk_test.cc +++ b/sdk/test/logs/logger_sdk_test.cc @@ -1,26 +1,24 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifdef ENABLE_LOGS_PREVIEW - -# include -# include - -# include "opentelemetry/logs/logger_provider.h" -# include "opentelemetry/nostd/string_view.h" -# include "opentelemetry/sdk/logs/event_logger.h" -# include "opentelemetry/sdk/logs/event_logger_provider.h" -# include "opentelemetry/sdk/logs/logger.h" -# include "opentelemetry/sdk/logs/logger_provider.h" -# include "opentelemetry/sdk/logs/processor.h" -# include "opentelemetry/sdk/logs/recordable.h" -# include "opentelemetry/sdk/trace/processor.h" -# include "opentelemetry/sdk/trace/tracer_provider.h" -# include "opentelemetry/sdk/trace/tracer_provider_factory.h" -# include "opentelemetry/trace/scope.h" -# include "opentelemetry/trace/tracer.h" - -# include +#include +#include + +#include "opentelemetry/logs/logger_provider.h" +#include "opentelemetry/nostd/string_view.h" +#include "opentelemetry/sdk/logs/event_logger.h" +#include "opentelemetry/sdk/logs/event_logger_provider.h" +#include "opentelemetry/sdk/logs/logger.h" +#include "opentelemetry/sdk/logs/logger_provider.h" +#include "opentelemetry/sdk/logs/processor.h" +#include "opentelemetry/sdk/logs/recordable.h" +#include "opentelemetry/sdk/trace/processor.h" +#include "opentelemetry/sdk/trace/tracer_provider.h" +#include "opentelemetry/sdk/trace/tracer_provider_factory.h" +#include "opentelemetry/trace/scope.h" +#include "opentelemetry/trace/tracer.h" + +#include using namespace opentelemetry::sdk::logs; namespace logs_api = opentelemetry::logs; @@ -288,5 +286,3 @@ TEST(LoggerSDK, EventLog) ASSERT_EQ(shared_recordable->GetEventName(), "otel-cpp.event_name"); ASSERT_EQ(shared_recordable->GetEventDomain(), "otel-cpp.event_domain"); } - -#endif diff --git a/sdk/test/logs/simple_log_record_processor_test.cc b/sdk/test/logs/simple_log_record_processor_test.cc index 7d45cc85c2..484cc63e71 100644 --- a/sdk/test/logs/simple_log_record_processor_test.cc +++ b/sdk/test/logs/simple_log_record_processor_test.cc @@ -1,17 +1,15 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifdef ENABLE_LOGS_PREVIEW +#include "opentelemetry/sdk/logs/simple_log_record_processor.h" +#include "opentelemetry/nostd/span.h" +#include "opentelemetry/sdk/logs/exporter.h" +#include "opentelemetry/sdk/logs/recordable.h" -# include "opentelemetry/sdk/logs/simple_log_record_processor.h" -# include "opentelemetry/nostd/span.h" -# include "opentelemetry/sdk/logs/exporter.h" -# include "opentelemetry/sdk/logs/recordable.h" +#include -# include - -# include -# include +#include +#include using namespace opentelemetry::sdk::logs; using namespace opentelemetry::sdk::common; @@ -243,5 +241,3 @@ TEST(SimpleLogRecordProcessorTest, ForceFlushFail) // Expect failure result when exporter fails to force flush EXPECT_EQ(false, processor.ForceFlush()); } - -#endif