diff --git a/CMakeLists.txt b/CMakeLists.txt index e7597fc87a..874d027bfc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -189,7 +189,6 @@ option( OFF) option(WITH_EXAMPLES "Whether to build examples" ON) -option(WITH_METRICS_PREVIEW "Whether to build metrics preview" OFF) option(WITH_LOGS_PREVIEW "Whether to build logs preview" OFF) option(WITH_ASYNC_EXPORT_PREVIEW "Whether enable async export" OFF) # Exemplar specs status is experimental, so behind feature flag by default diff --git a/api/CMakeLists.txt b/api/CMakeLists.txt index b7ed2d7f69..826f7f8bca 100644 --- a/api/CMakeLists.txt +++ b/api/CMakeLists.txt @@ -18,17 +18,12 @@ if(NOT WITH_LOGS_PREVIEW) set(LOGS_EXCLUDE_PATTERN "logs") endif() -set(METRICS_EXCLUDE_PATTERN "") -if(NOT WITH_METRICS_PREVIEW) - set(METRICS_EXCLUDE_PATTERN "metrics") -endif() - install( DIRECTORY include/opentelemetry DESTINATION include FILES_MATCHING PATTERN "*.h" - PATTERN "${METRICS_EXCLUDE_PATTERN}" EXCLUDE) + PATTERN "metrics" EXCLUDE) install( DIRECTORY include/opentelemetry @@ -74,10 +69,6 @@ if(WITH_GSL) endif() endif() -if(WITH_METRICS_PREVIEW) - target_compile_definitions(opentelemetry_api INTERFACE ENABLE_METRICS_PREVIEW) -endif() - if(WITH_LOGS_PREVIEW) target_compile_definitions(opentelemetry_api INTERFACE ENABLE_LOGS_PREVIEW) endif() diff --git a/api/include/opentelemetry/metrics/async_instruments.h b/api/include/opentelemetry/metrics/async_instruments.h index 7d3720b1d8..6e6d5012c4 100644 --- a/api/include/opentelemetry/metrics/async_instruments.h +++ b/api/include/opentelemetry/metrics/async_instruments.h @@ -2,9 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/metrics/observer_result.h" +#include "opentelemetry/metrics/observer_result.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace metrics @@ -31,4 +30,3 @@ class ObservableInstrument } // namespace metrics OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/api/include/opentelemetry/metrics/meter.h b/api/include/opentelemetry/metrics/meter.h index 96fcb4724b..17cc0db338 100644 --- a/api/include/opentelemetry/metrics/meter.h +++ b/api/include/opentelemetry/metrics/meter.h @@ -2,15 +2,14 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/metrics/async_instruments.h" -# include "opentelemetry/metrics/sync_instruments.h" -# include "opentelemetry/nostd/shared_ptr.h" -# include "opentelemetry/nostd/span.h" -# include "opentelemetry/nostd/string_view.h" -# include "opentelemetry/nostd/unique_ptr.h" -# include "opentelemetry/version.h" +#include "opentelemetry/metrics/async_instruments.h" +#include "opentelemetry/metrics/sync_instruments.h" +#include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/nostd/span.h" +#include "opentelemetry/nostd/string_view.h" +#include "opentelemetry/nostd/unique_ptr.h" +#include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace metrics @@ -140,4 +139,3 @@ class Meter }; } // namespace metrics OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/api/include/opentelemetry/metrics/meter_provider.h b/api/include/opentelemetry/metrics/meter_provider.h index 1892c7d8f9..4c3306ebf6 100644 --- a/api/include/opentelemetry/metrics/meter_provider.h +++ b/api/include/opentelemetry/metrics/meter_provider.h @@ -2,11 +2,10 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/metrics/meter.h" -# include "opentelemetry/nostd/shared_ptr.h" -# include "opentelemetry/nostd/string_view.h" +#include "opentelemetry/metrics/meter.h" +#include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/nostd/string_view.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace metrics @@ -30,4 +29,3 @@ class MeterProvider }; } // namespace metrics OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/api/include/opentelemetry/metrics/noop.h b/api/include/opentelemetry/metrics/noop.h index 1200c5c6f1..0d2eacde97 100644 --- a/api/include/opentelemetry/metrics/noop.h +++ b/api/include/opentelemetry/metrics/noop.h @@ -2,14 +2,13 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/metrics/async_instruments.h" -# include "opentelemetry/metrics/meter.h" -# include "opentelemetry/metrics/meter_provider.h" -# include "opentelemetry/metrics/observer_result.h" -# include "opentelemetry/metrics/sync_instruments.h" -# include "opentelemetry/version.h" +#include "opentelemetry/metrics/async_instruments.h" +#include "opentelemetry/metrics/meter.h" +#include "opentelemetry/metrics/meter_provider.h" +#include "opentelemetry/metrics/observer_result.h" +#include "opentelemetry/metrics/sync_instruments.h" +#include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace metrics @@ -213,4 +212,3 @@ class NoopMeterProvider final : public MeterProvider }; } // namespace metrics OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/api/include/opentelemetry/metrics/observer_result.h b/api/include/opentelemetry/metrics/observer_result.h index ab41bbf025..88cae28618 100644 --- a/api/include/opentelemetry/metrics/observer_result.h +++ b/api/include/opentelemetry/metrics/observer_result.h @@ -2,14 +2,13 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/common/attribute_value.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/common/attribute_value.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" OPENTELEMETRY_BEGIN_NAMESPACE namespace metrics @@ -51,4 +50,3 @@ using ObserverResult = nostd::variant } // namespace metrics OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/api/include/opentelemetry/metrics/provider.h b/api/include/opentelemetry/metrics/provider.h index 0eddc61142..ea710a4820 100644 --- a/api/include/opentelemetry/metrics/provider.h +++ b/api/include/opentelemetry/metrics/provider.h @@ -2,15 +2,14 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include +#include -# include "opentelemetry/common/macros.h" -# include "opentelemetry/common/spin_lock_mutex.h" -# include "opentelemetry/metrics/meter_provider.h" -# include "opentelemetry/metrics/noop.h" -# include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/common/macros.h" +#include "opentelemetry/common/spin_lock_mutex.h" +#include "opentelemetry/metrics/meter_provider.h" +#include "opentelemetry/metrics/noop.h" +#include "opentelemetry/nostd/shared_ptr.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace metrics @@ -58,4 +57,3 @@ class Provider } // namespace metrics OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/api/include/opentelemetry/metrics/sync_instruments.h b/api/include/opentelemetry/metrics/sync_instruments.h index f8d7c96672..8db77daae5 100644 --- a/api/include/opentelemetry/metrics/sync_instruments.h +++ b/api/include/opentelemetry/metrics/sync_instruments.h @@ -2,14 +2,13 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/common/attribute_value.h" -# include "opentelemetry/common/key_value_iterable_view.h" -# include "opentelemetry/context/context.h" -# include "opentelemetry/nostd/span.h" -# include "opentelemetry/nostd/string_view.h" -# include "opentelemetry/nostd/type_traits.h" +#include "opentelemetry/common/attribute_value.h" +#include "opentelemetry/common/key_value_iterable_view.h" +#include "opentelemetry/context/context.h" +#include "opentelemetry/nostd/span.h" +#include "opentelemetry/nostd/string_view.h" +#include "opentelemetry/nostd/type_traits.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace metrics @@ -196,4 +195,3 @@ class UpDownCounter : public SynchronousInstrument } // namespace metrics OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/api/test/metrics/meter_provider_test.cc b/api/test/metrics/meter_provider_test.cc index 161d852f09..878c5e9a3b 100644 --- a/api/test/metrics/meter_provider_test.cc +++ b/api/test/metrics/meter_provider_test.cc @@ -1,12 +1,10 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW - -# include -# include "opentelemetry/metrics/noop.h" -# include "opentelemetry/metrics/provider.h" -# include "opentelemetry/nostd/shared_ptr.h" +#include +#include "opentelemetry/metrics/noop.h" +#include "opentelemetry/metrics/provider.h" +#include "opentelemetry/nostd/shared_ptr.h" using opentelemetry::metrics::Meter; using opentelemetry::metrics::MeterProvider; @@ -35,4 +33,3 @@ TEST(Provider, MultipleMeterProviders) ASSERT_NE(Provider::GetMeterProvider(), tf); } -#endif diff --git a/api/test/metrics/noop_sync_instrument_test.cc b/api/test/metrics/noop_sync_instrument_test.cc index 3cd5d408e6..6411e0e820 100644 --- a/api/test/metrics/noop_sync_instrument_test.cc +++ b/api/test/metrics/noop_sync_instrument_test.cc @@ -1,11 +1,9 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW - -# include -# include -# include "opentelemetry/metrics/noop.h" +#include +#include +#include "opentelemetry/metrics/noop.h" TEST(Counter, Add) { @@ -46,5 +44,3 @@ TEST(UpDownCountr, Record) counter->Add(10, {{"k1", "1"}, {"k2", 2}}); counter->Add(10, {{"k1", "1"}, {"k2", 2}}, opentelemetry::context::Context{}); } - -#endif diff --git a/ci/do_ci.sh b/ci/do_ci.sh index bf0e688c62..d457495032 100755 --- a/ci/do_ci.sh +++ b/ci/do_ci.sh @@ -82,7 +82,6 @@ if [[ "$1" == "cmake.test" ]]; then -DWITH_ZIPKIN=ON \ -DWITH_JAEGER=ON \ -DWITH_ELASTICSEARCH=ON \ - -DWITH_METRICS_PREVIEW=OFF \ -DWITH_METRICS_EXEMPLAR_PREVIEW=ON \ -DWITH_LOGS_PREVIEW=ON \ -DCMAKE_CXX_FLAGS="-Werror" \ @@ -99,7 +98,6 @@ elif [[ "$1" == "cmake.maintainer.test" ]]; then -DWITH_JAEGER=ON \ -DWITH_ELASTICSEARCH=ON \ -DWITH_LOGS_PREVIEW=ON \ - -DWITH_METRICS_PREVIEW=OFF \ -DWITH_METRICS_EXEMPLAR_PREVIEW=ON \ -DWITH_ASYNC_EXPORT_PREVIEW=ON \ -DOTELCPP_MAINTAINER_MODE=ON \ @@ -115,7 +113,6 @@ elif [[ "$1" == "cmake.with_async_export.test" ]]; then -DWITH_ZIPKIN=ON \ -DWITH_JAEGER=ON \ -DWITH_ELASTICSEARCH=ON \ - -DWITH_METRICS_PREVIEW=OFF \ -DWITH_METRICS_EXEMPLAR_PREVIEW=ON \ -DWITH_LOGS_PREVIEW=ON \ -DCMAKE_CXX_FLAGS="-Werror" \ @@ -128,7 +125,6 @@ elif [[ "$1" == "cmake.abseil.test" ]]; then cd "${BUILD_DIR}" rm -rf * cmake -DCMAKE_BUILD_TYPE=Debug \ - -DWITH_METRICS_PREVIEW=OFF \ -DWITH_METRICS_EXEMPLAR_PREVIEW=ON \ -DWITH_LOGS_PREVIEW=ON \ -DCMAKE_CXX_FLAGS="-Werror" \ @@ -153,7 +149,6 @@ elif [[ "$1" == "cmake.c++20.stl.test" ]]; then cd "${BUILD_DIR}" rm -rf * cmake -DCMAKE_BUILD_TYPE=Debug \ - -DWITH_METRICS_PREVIEW=OFF \ -DWITH_METRICS_EXEMPLAR_PREVIEW=ON \ -DWITH_LOGS_PREVIEW=ON \ -DCMAKE_CXX_FLAGS="-Werror" \ diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 2367918c7e..1f891f412d 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -15,7 +15,7 @@ endif() if(WITH_ZIPKIN) add_subdirectory(zipkin) endif() -if(WITH_PROMETHEUS AND NOT WITH_METRICS_PREVIEW) +if(WITH_PROMETHEUS) add_subdirectory(prometheus) endif() add_subdirectory(plugin) diff --git a/examples/common/metrics_foo_library/foo_library.cc b/examples/common/metrics_foo_library/foo_library.cc index 4b4ea98fd2..fea86e7a41 100644 --- a/examples/common/metrics_foo_library/foo_library.cc +++ b/examples/common/metrics_foo_library/foo_library.cc @@ -1,16 +1,15 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW -# include "foo_library.h" -# include -# include -# include -# include -# include -# include "opentelemetry/context/context.h" -# include "opentelemetry/metrics/provider.h" -# include "opentelemetry/nostd/shared_ptr.h" +#include "foo_library.h" +#include +#include +#include +#include +#include +#include "opentelemetry/context/context.h" +#include "opentelemetry/metrics/provider.h" +#include "opentelemetry/nostd/shared_ptr.h" namespace nostd = opentelemetry::nostd; namespace metrics_api = opentelemetry::metrics; @@ -95,5 +94,3 @@ void foo_library::histogram_example(const std::string &name) std::this_thread::sleep_for(std::chrono::milliseconds(250)); } } - -#endif diff --git a/examples/common/metrics_foo_library/foo_library.h b/examples/common/metrics_foo_library/foo_library.h index 2f84bcc34f..217f91671b 100644 --- a/examples/common/metrics_foo_library/foo_library.h +++ b/examples/common/metrics_foo_library/foo_library.h @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include + +#include class foo_library { @@ -12,4 +12,3 @@ class foo_library static void histogram_example(const std::string &name); static void observable_counter_example(const std::string &name); }; -#endif diff --git a/examples/metrics_simple/CMakeLists.txt b/examples/metrics_simple/CMakeLists.txt index a2088fd510..a3caf9b9e6 100644 --- a/examples/metrics_simple/CMakeLists.txt +++ b/examples/metrics_simple/CMakeLists.txt @@ -1,13 +1,6 @@ include_directories(${CMAKE_SOURCE_DIR}/exporters/ostream/include) -if(WITH_METRICS_PREVIEW) - add_executable(simple_metrics main.cc) - target_link_libraries( - simple_metrics ${CMAKE_THREAD_LIBS_INIT} opentelemetry_metrics_deprecated - opentelemetry_exporter_ostream_metrics_deprecated) -else() - add_executable(metrics_ostream_example metrics_ostream.cc) - target_link_libraries( - metrics_ostream_example ${CMAKE_THREAD_LIBS_INIT} opentelemetry_metrics - opentelemetry_exporter_ostream_metrics opentelemetry_resources - common_metrics_foo_library) -endif() +add_executable(metrics_ostream_example metrics_ostream.cc) +target_link_libraries( + metrics_ostream_example ${CMAKE_THREAD_LIBS_INIT} opentelemetry_metrics + opentelemetry_exporter_ostream_metrics opentelemetry_resources + common_metrics_foo_library) diff --git a/examples/metrics_simple/metrics_ostream.cc b/examples/metrics_simple/metrics_ostream.cc index 627e06856e..a0403d53ba 100644 --- a/examples/metrics_simple/metrics_ostream.cc +++ b/examples/metrics_simple/metrics_ostream.cc @@ -1,22 +1,21 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW -# include -# include -# include "opentelemetry/exporters/ostream/metric_exporter.h" -# include "opentelemetry/metrics/provider.h" -# include "opentelemetry/sdk/metrics/aggregation/default_aggregation.h" -# include "opentelemetry/sdk/metrics/aggregation/histogram_aggregation.h" -# include "opentelemetry/sdk/metrics/export/periodic_exporting_metric_reader.h" -# include "opentelemetry/sdk/metrics/meter.h" -# include "opentelemetry/sdk/metrics/meter_provider.h" +#include +#include +#include "opentelemetry/exporters/ostream/metric_exporter.h" +#include "opentelemetry/metrics/provider.h" +#include "opentelemetry/sdk/metrics/aggregation/default_aggregation.h" +#include "opentelemetry/sdk/metrics/aggregation/histogram_aggregation.h" +#include "opentelemetry/sdk/metrics/export/periodic_exporting_metric_reader.h" +#include "opentelemetry/sdk/metrics/meter.h" +#include "opentelemetry/sdk/metrics/meter_provider.h" -# ifdef BAZEL_BUILD -# include "examples/common/metrics_foo_library/foo_library.h" -# else -# include "metrics_foo_library/foo_library.h" -# endif +#ifdef BAZEL_BUILD +# include "examples/common/metrics_foo_library/foo_library.h" +#else +# include "metrics_foo_library/foo_library.h" +#endif namespace metric_sdk = opentelemetry::sdk::metrics; namespace nostd = opentelemetry::nostd; @@ -120,6 +119,3 @@ int main(int argc, char **argv) histogram_example.join(); } } -#else -int main() {} -#endif diff --git a/examples/otlp/CMakeLists.txt b/examples/otlp/CMakeLists.txt index f6bf25f932..30ce3cab48 100644 --- a/examples/otlp/CMakeLists.txt +++ b/examples/otlp/CMakeLists.txt @@ -38,7 +38,7 @@ if(WITH_OTLP_HTTP) endif() endif() -if(WITH_OTLP_GRPC AND NOT WITH_METRICS_PREVIEW) +if(WITH_OTLP_GRPC) add_executable(example_otlp_metric_grpc grpc_metric_main.cc) target_link_libraries( example_otlp_metric_grpc ${CMAKE_THREAD_LIBS_INIT} diff --git a/examples/otlp/grpc_metric_main.cc b/examples/otlp/grpc_metric_main.cc index 6f2d143c70..6f82c07890 100644 --- a/examples/otlp/grpc_metric_main.cc +++ b/examples/otlp/grpc_metric_main.cc @@ -1,23 +1,21 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW +#include "opentelemetry/exporters/otlp/otlp_grpc_metric_exporter_factory.h" +#include "opentelemetry/metrics/provider.h" +#include "opentelemetry/sdk/metrics/aggregation/default_aggregation.h" +#include "opentelemetry/sdk/metrics/export/periodic_exporting_metric_reader.h" +#include "opentelemetry/sdk/metrics/meter.h" +#include "opentelemetry/sdk/metrics/meter_provider.h" -# include "opentelemetry/exporters/otlp/otlp_grpc_metric_exporter_factory.h" -# include "opentelemetry/metrics/provider.h" -# include "opentelemetry/sdk/metrics/aggregation/default_aggregation.h" -# include "opentelemetry/sdk/metrics/export/periodic_exporting_metric_reader.h" -# include "opentelemetry/sdk/metrics/meter.h" -# include "opentelemetry/sdk/metrics/meter_provider.h" +#include +#include -# include -# include - -# ifdef BAZEL_BUILD -# include "examples/common/metrics_foo_library/foo_library.h" -# else -# include "metrics_foo_library/foo_library.h" -# endif +#ifdef BAZEL_BUILD +# include "examples/common/metrics_foo_library/foo_library.h" +#else +# include "metrics_foo_library/foo_library.h" +#endif namespace metric_sdk = opentelemetry::sdk::metrics; namespace nostd = opentelemetry::nostd; @@ -94,6 +92,3 @@ int main(int argc, char *argv[]) histogram_example.join(); } } -#else -int main() {} -#endif diff --git a/examples/prometheus/main.cc b/examples/prometheus/main.cc index 0bf0fb5427..7742344931 100644 --- a/examples/prometheus/main.cc +++ b/examples/prometheus/main.cc @@ -1,22 +1,21 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW -# include -# include -# include "opentelemetry/exporters/prometheus/exporter.h" -# include "opentelemetry/metrics/provider.h" -# include "opentelemetry/sdk/metrics/aggregation/default_aggregation.h" -# include "opentelemetry/sdk/metrics/aggregation/histogram_aggregation.h" -# include "opentelemetry/sdk/metrics/export/periodic_exporting_metric_reader.h" -# include "opentelemetry/sdk/metrics/meter.h" -# include "opentelemetry/sdk/metrics/meter_provider.h" +#include +#include +#include "opentelemetry/exporters/prometheus/exporter.h" +#include "opentelemetry/metrics/provider.h" +#include "opentelemetry/sdk/metrics/aggregation/default_aggregation.h" +#include "opentelemetry/sdk/metrics/aggregation/histogram_aggregation.h" +#include "opentelemetry/sdk/metrics/export/periodic_exporting_metric_reader.h" +#include "opentelemetry/sdk/metrics/meter.h" +#include "opentelemetry/sdk/metrics/meter_provider.h" -# ifdef BAZEL_BUILD -# include "examples/common/metrics_foo_library/foo_library.h" -# else -# include "metrics_foo_library/foo_library.h" -# endif +#ifdef BAZEL_BUILD +# include "examples/common/metrics_foo_library/foo_library.h" +#else +# include "metrics_foo_library/foo_library.h" +#endif namespace metrics_sdk = opentelemetry::sdk::metrics; namespace nostd = opentelemetry::nostd; @@ -113,6 +112,3 @@ int main(int argc, char **argv) histogram_example.join(); } } -#else -int main() {} -#endif diff --git a/exporters/ostream/CMakeLists.txt b/exporters/ostream/CMakeLists.txt index d7b791cc73..43d5f4b7c1 100644 --- a/exporters/ostream/CMakeLists.txt +++ b/exporters/ostream/CMakeLists.txt @@ -35,64 +35,33 @@ if(BUILD_TESTING) TEST_LIST ostream_span_test) endif() # BUILD_TESTING -if(WITH_METRICS_PREVIEW) - add_library(opentelemetry_exporter_ostream_metrics_deprecated - src/metrics_exporter.cc) - set_target_properties(opentelemetry_exporter_ostream_metrics_deprecated - PROPERTIES EXPORT_NAME ostream_metrics_exporter) - target_include_directories( - opentelemetry_exporter_ostream_metrics_deprecated - PUBLIC "$") - target_link_libraries(opentelemetry_exporter_ostream_metrics_deprecated - PUBLIC opentelemetry_metrics_deprecated) - install( - TARGETS opentelemetry_exporter_ostream_metrics_deprecated - EXPORT "${PROJECT_NAME}-target" - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) - install( - DIRECTORY include/opentelemetry/exporters/ostream - DESTINATION include/opentelemetry/exporters - PATTERN "metrics_exporter.h") - if(BUILD_TESTING) - add_executable(ostream_metrics_test test/ostream_metrics_test.cc) - target_link_libraries(ostream_metrics_test ${GTEST_BOTH_LIBRARIES} - opentelemetry_exporter_ostream_metrics_deprecated) - gtest_add_tests( - TARGET ostream_metrics_test - TEST_PREFIX exporter. - TEST_LIST ostream_metrics_test) - endif() -else() - add_library(opentelemetry_exporter_ostream_metrics src/metric_exporter.cc) - set_target_properties(opentelemetry_exporter_ostream_metrics - PROPERTIES EXPORT_NAME ostream_metrics_exporter) - target_include_directories( - opentelemetry_exporter_ostream_metrics - PUBLIC "$") - target_link_libraries(opentelemetry_exporter_ostream_metrics - PUBLIC opentelemetry_metrics) - install( - TARGETS opentelemetry_exporter_ostream_metrics - EXPORT "${PROJECT_NAME}-target" - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) - install( - DIRECTORY include/opentelemetry/exporters/ostream - DESTINATION include/opentelemetry/exporters - PATTERN "metric_exporter.h") - if(BUILD_TESTING) - add_executable(ostream_metric_test test/ostream_metric_test.cc) - target_link_libraries( - ostream_metric_test ${GTEST_BOTH_LIBRARIES} - opentelemetry_exporter_ostream_metrics opentelemetry_resources) - gtest_add_tests( - TARGET ostream_metric_test - TEST_PREFIX exporter. - TEST_LIST ostream_metric_test) - endif() +add_library(opentelemetry_exporter_ostream_metrics src/metric_exporter.cc) +set_target_properties(opentelemetry_exporter_ostream_metrics + PROPERTIES EXPORT_NAME ostream_metrics_exporter) +target_include_directories( + opentelemetry_exporter_ostream_metrics + PUBLIC "$") +target_link_libraries(opentelemetry_exporter_ostream_metrics + PUBLIC opentelemetry_metrics) +install( + TARGETS opentelemetry_exporter_ostream_metrics + EXPORT "${PROJECT_NAME}-target" + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) +install( + DIRECTORY include/opentelemetry/exporters/ostream + DESTINATION include/opentelemetry/exporters + PATTERN "metric_exporter.h") +if(BUILD_TESTING) + add_executable(ostream_metric_test test/ostream_metric_test.cc) + target_link_libraries( + ostream_metric_test ${GTEST_BOTH_LIBRARIES} + opentelemetry_exporter_ostream_metrics opentelemetry_resources) + gtest_add_tests( + TARGET ostream_metric_test + TEST_PREFIX exporter. + TEST_LIST ostream_metric_test) endif() if(WITH_LOGS_PREVIEW) diff --git a/exporters/ostream/include/opentelemetry/exporters/ostream/metric_exporter.h b/exporters/ostream/include/opentelemetry/exporters/ostream/metric_exporter.h index 9c45d011cf..36e5917457 100644 --- a/exporters/ostream/include/opentelemetry/exporters/ostream/metric_exporter.h +++ b/exporters/ostream/include/opentelemetry/exporters/ostream/metric_exporter.h @@ -2,15 +2,14 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include -# include -# include "opentelemetry/common/spin_lock_mutex.h" -# include "opentelemetry/sdk/metrics/data/metric_data.h" -# include "opentelemetry/sdk/metrics/instruments.h" -# include "opentelemetry/sdk/metrics/push_metric_exporter.h" -# include "opentelemetry/version.h" +#include +#include +#include "opentelemetry/common/spin_lock_mutex.h" +#include "opentelemetry/sdk/metrics/data/metric_data.h" +#include "opentelemetry/sdk/metrics/instruments.h" +#include "opentelemetry/sdk/metrics/push_metric_exporter.h" +#include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace exporter @@ -78,4 +77,3 @@ class OStreamMetricExporter final : public opentelemetry::sdk::metrics::PushMetr } // namespace metrics } // namespace exporter OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/exporters/ostream/src/metric_exporter.cc b/exporters/ostream/src/metric_exporter.cc index c75a177036..21ecd0109a 100644 --- a/exporters/ostream/src/metric_exporter.cc +++ b/exporters/ostream/src/metric_exporter.cc @@ -1,15 +1,14 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 +#include "opentelemetry/exporters/ostream/metric_exporter.h" +#include #include -#ifndef ENABLE_METRICS_PREVIEW -# include -# include -# include "opentelemetry/exporters/ostream/common_utils.h" -# include "opentelemetry/exporters/ostream/metric_exporter.h" -# include "opentelemetry/sdk/metrics/aggregation/default_aggregation.h" -# include "opentelemetry/sdk/metrics/aggregation/histogram_aggregation.h" -# include "opentelemetry/sdk_config.h" +#include +#include "opentelemetry/exporters/ostream/common_utils.h" +#include "opentelemetry/sdk/metrics/aggregation/default_aggregation.h" +#include "opentelemetry/sdk/metrics/aggregation/histogram_aggregation.h" +#include "opentelemetry/sdk_config.h" namespace { @@ -18,15 +17,15 @@ std::string timeToString(opentelemetry::common::SystemTimestamp time_stamp) std::time_t epoch_time = std::chrono::system_clock::to_time_t(time_stamp); struct tm *tm_ptr = nullptr; -# if defined(_MSC_VER) +#if defined(_MSC_VER) struct tm buf_tm; if (!gmtime_s(&buf_tm, &epoch_time)) { tm_ptr = &buf_tm; } -# else +#else tm_ptr = std::gmtime(&epoch_time); -# endif +#endif char buf[100]; char *date_str = nullptr; @@ -262,4 +261,3 @@ bool OStreamMetricExporter::isShutdown() const noexcept } // namespace metrics } // namespace exporter OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/exporters/ostream/test/ostream_metric_test.cc b/exporters/ostream/test/ostream_metric_test.cc index c7ecba6659..9aca741d67 100644 --- a/exporters/ostream/test/ostream_metric_test.cc +++ b/exporters/ostream/test/ostream_metric_test.cc @@ -1,20 +1,19 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW -# include -# include -# include -# include "opentelemetry/sdk/metrics/instruments.h" -# include "opentelemetry/sdk/resource/resource_detector.h" -# include "opentelemetry/sdk/version/version.h" +#include +#include +#include +#include "opentelemetry/sdk/metrics/instruments.h" +#include "opentelemetry/sdk/resource/resource_detector.h" +#include "opentelemetry/sdk/version/version.h" -# include -# include "opentelemetry/exporters/ostream/metric_exporter.h" -# include "opentelemetry/sdk/metrics/aggregation/default_aggregation.h" -# include "opentelemetry/sdk/metrics/aggregation/histogram_aggregation.h" -# include "opentelemetry/sdk/metrics/data/metric_data.h" -# include "opentelemetry/sdk/resource/resource.h" +#include +#include "opentelemetry/exporters/ostream/metric_exporter.h" +#include "opentelemetry/sdk/metrics/aggregation/default_aggregation.h" +#include "opentelemetry/sdk/metrics/aggregation/histogram_aggregation.h" +#include "opentelemetry/sdk/metrics/data/metric_data.h" +#include "opentelemetry/sdk/resource/resource.h" namespace metric_sdk = opentelemetry::sdk::metrics; namespace nostd = opentelemetry::nostd; @@ -296,5 +295,3 @@ TEST(OStreamMetricsExporter, ExportDropPointData) ASSERT_EQ(stdoutOutput.str(), expected_output); } - -#endif diff --git a/exporters/otlp/CMakeLists.txt b/exporters/otlp/CMakeLists.txt index 8fba905293..bb8e602f77 100644 --- a/exporters/otlp/CMakeLists.txt +++ b/exporters/otlp/CMakeLists.txt @@ -19,10 +19,8 @@ target_link_libraries( if(WITH_LOGS_PREVIEW) target_link_libraries(opentelemetry_otlp_recordable PUBLIC opentelemetry_logs) endif() -if(NOT WITH_METRICS_PREVIEW) - target_link_libraries(opentelemetry_otlp_recordable - PUBLIC opentelemetry_metrics) -endif() +target_link_libraries(opentelemetry_otlp_recordable + PUBLIC opentelemetry_metrics) if(WITH_OTLP_GRPC) find_package(gRPC REQUIRED) @@ -78,22 +76,20 @@ if(WITH_OTLP_GRPC) list(APPEND OPENTELEMETRY_OTLP_TARGETS opentelemetry_exporter_otlp_grpc_log) - if(NOT WITH_METRICS_PREVIEW) - add_library( - opentelemetry_exporter_otlp_grpc_metrics - src/otlp_grpc_metric_exporter.cc src/otlp_grpc_metric_exporter_factory.cc) + add_library( + opentelemetry_exporter_otlp_grpc_metrics + src/otlp_grpc_metric_exporter.cc src/otlp_grpc_metric_exporter_factory.cc) - set_target_properties(opentelemetry_exporter_otlp_grpc_metrics - PROPERTIES EXPORT_NAME otlp_grpc_metrics_exporter) + set_target_properties(opentelemetry_exporter_otlp_grpc_metrics + PROPERTIES EXPORT_NAME otlp_grpc_metrics_exporter) - target_link_libraries( - opentelemetry_exporter_otlp_grpc_metrics - PUBLIC opentelemetry_otlp_recordable - opentelemetry_exporter_otlp_grpc_client) + target_link_libraries( + opentelemetry_exporter_otlp_grpc_metrics + PUBLIC opentelemetry_otlp_recordable + opentelemetry_exporter_otlp_grpc_client) - list(APPEND OPENTELEMETRY_OTLP_TARGETS - opentelemetry_exporter_otlp_grpc_metrics) - endif() + list(APPEND OPENTELEMETRY_OTLP_TARGETS + opentelemetry_exporter_otlp_grpc_metrics) endif() if(WITH_OTLP_HTTP) @@ -147,22 +143,20 @@ if(WITH_OTLP_HTTP) list(APPEND OPENTELEMETRY_OTLP_TARGETS opentelemetry_exporter_otlp_http_log) endif() - if(NOT WITH_METRICS_PREVIEW) - add_library( - opentelemetry_exporter_otlp_http_metric - src/otlp_http_metric_exporter.cc src/otlp_http_metric_exporter_factory.cc) + add_library( + opentelemetry_exporter_otlp_http_metric + src/otlp_http_metric_exporter.cc src/otlp_http_metric_exporter_factory.cc) - set_target_properties(opentelemetry_exporter_otlp_http_metric - PROPERTIES EXPORT_NAME otlp_http_metric_exporter) + set_target_properties(opentelemetry_exporter_otlp_http_metric + PROPERTIES EXPORT_NAME otlp_http_metric_exporter) - target_link_libraries( - opentelemetry_exporter_otlp_http_metric - PUBLIC opentelemetry_otlp_recordable - opentelemetry_exporter_otlp_http_client) + target_link_libraries( + opentelemetry_exporter_otlp_http_metric + PUBLIC opentelemetry_otlp_recordable + opentelemetry_exporter_otlp_http_client) - list(APPEND OPENTELEMETRY_OTLP_TARGETS - opentelemetry_exporter_otlp_http_metric) - endif() + list(APPEND OPENTELEMETRY_OTLP_TARGETS + opentelemetry_exporter_otlp_http_metric) endif() install( @@ -198,17 +192,14 @@ if(BUILD_TESTING) TEST_LIST otlp_log_recordable_test) endif() - if(NOT WITH_METRICS_PREVIEW) - add_executable(otlp_metrics_serialization_test - test/otlp_metrics_serialization_test.cc) - target_link_libraries( - otlp_metrics_serialization_test ${GTEST_BOTH_LIBRARIES} - ${CMAKE_THREAD_LIBS_INIT} opentelemetry_otlp_recordable) - gtest_add_tests( - TARGET otlp_metrics_serialization_test - TEST_PREFIX exporter.otlp. - TEST_LIST otlp_metrics_serialization_test) - endif() + add_executable(otlp_metrics_serialization_test + test/otlp_metrics_serialization_test.cc) + target_link_libraries(otlp_metrics_serialization_test ${GTEST_BOTH_LIBRARIES} + ${CMAKE_THREAD_LIBS_INIT} opentelemetry_otlp_recordable) + gtest_add_tests( + TARGET otlp_metrics_serialization_test + TEST_PREFIX exporter.otlp. + TEST_LIST otlp_metrics_serialization_test) if(MSVC) # Explicitly specify that we consume GTest from shared library. The rest of @@ -273,18 +264,16 @@ if(BUILD_TESTING) TEST_LIST otlp_grpc_log_record_exporter_factory_test) endif() - if(NOT WITH_METRICS_PREVIEW) - add_executable(otlp_grpc_metric_exporter_factory_test - test/otlp_grpc_metric_exporter_factory_test.cc) - target_link_libraries( - otlp_grpc_metric_exporter_factory_test ${GTEST_BOTH_LIBRARIES} - ${CMAKE_THREAD_LIBS_INIT} ${GMOCK_LIB} - opentelemetry_exporter_otlp_grpc_metrics opentelemetry_metrics) - gtest_add_tests( - TARGET otlp_grpc_metric_exporter_factory_test - TEST_PREFIX exporter.otlp. - TEST_LIST otlp_grpc_metric_exporter_factory_test) - endif() + add_executable(otlp_grpc_metric_exporter_factory_test + test/otlp_grpc_metric_exporter_factory_test.cc) + target_link_libraries( + otlp_grpc_metric_exporter_factory_test ${GTEST_BOTH_LIBRARIES} + ${CMAKE_THREAD_LIBS_INIT} ${GMOCK_LIB} + opentelemetry_exporter_otlp_grpc_metrics opentelemetry_metrics) + gtest_add_tests( + TARGET otlp_grpc_metric_exporter_factory_test + TEST_PREFIX exporter.otlp. + TEST_LIST otlp_grpc_metric_exporter_factory_test) endif() if(WITH_OTLP_HTTP) @@ -335,32 +324,30 @@ if(BUILD_TESTING) TEST_LIST otlp_http_log_record_exporter_factory_test) endif() - if(NOT WITH_METRICS_PREVIEW) - add_executable(otlp_http_metric_exporter_test - test/otlp_http_metric_exporter_test.cc) - target_link_libraries( - otlp_http_metric_exporter_test - ${GTEST_BOTH_LIBRARIES} - ${CMAKE_THREAD_LIBS_INIT} - ${GMOCK_LIB} - opentelemetry_exporter_otlp_http_metric - opentelemetry_metrics - http_client_nosend) - gtest_add_tests( - TARGET otlp_http_metric_exporter_test - TEST_PREFIX exporter.otlp. - TEST_LIST otlp_http_metric_exporter_test) + add_executable(otlp_http_metric_exporter_test + test/otlp_http_metric_exporter_test.cc) + target_link_libraries( + otlp_http_metric_exporter_test + ${GTEST_BOTH_LIBRARIES} + ${CMAKE_THREAD_LIBS_INIT} + ${GMOCK_LIB} + opentelemetry_exporter_otlp_http_metric + opentelemetry_metrics + http_client_nosend) + gtest_add_tests( + TARGET otlp_http_metric_exporter_test + TEST_PREFIX exporter.otlp. + TEST_LIST otlp_http_metric_exporter_test) - add_executable(otlp_http_metric_exporter_factory_test - test/otlp_http_metric_exporter_factory_test.cc) - target_link_libraries( - otlp_http_metric_exporter_factory_test ${GTEST_BOTH_LIBRARIES} - ${CMAKE_THREAD_LIBS_INIT} ${GMOCK_LIB} - opentelemetry_exporter_otlp_http_metric opentelemetry_metrics) - gtest_add_tests( - TARGET otlp_http_metric_exporter_factory_test - TEST_PREFIX exporter.otlp. - TEST_LIST otlp_http_metric_exporter_factory_test) - endif() + add_executable(otlp_http_metric_exporter_factory_test + test/otlp_http_metric_exporter_factory_test.cc) + target_link_libraries( + otlp_http_metric_exporter_factory_test ${GTEST_BOTH_LIBRARIES} + ${CMAKE_THREAD_LIBS_INIT} ${GMOCK_LIB} + opentelemetry_exporter_otlp_http_metric opentelemetry_metrics) + gtest_add_tests( + TARGET otlp_http_metric_exporter_factory_test + TEST_PREFIX exporter.otlp. + TEST_LIST otlp_http_metric_exporter_factory_test) endif() endif() # BUILD_TESTING diff --git a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_metric_exporter.h b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_metric_exporter.h index ef6477d67f..69bc8ca78d 100644 --- a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_metric_exporter.h +++ b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_metric_exporter.h @@ -2,7 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW // clang-format off @@ -13,9 +12,9 @@ // clang-format on -# include "opentelemetry/exporters/otlp/otlp_environment.h" -# include "opentelemetry/exporters/otlp/otlp_grpc_metric_exporter_options.h" -# include "opentelemetry/sdk/metrics/push_metric_exporter.h" +#include "opentelemetry/exporters/otlp/otlp_environment.h" +#include "opentelemetry/exporters/otlp/otlp_grpc_metric_exporter_options.h" +#include "opentelemetry/sdk/metrics/push_metric_exporter.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace exporter @@ -84,4 +83,3 @@ class OtlpGrpcMetricExporter : public opentelemetry::sdk::metrics::PushMetricExp } // namespace otlp } // namespace exporter OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_metric_exporter_factory.h b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_metric_exporter_factory.h index 0fb4f46077..d605100ae6 100644 --- a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_metric_exporter_factory.h +++ b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_metric_exporter_factory.h @@ -3,10 +3,8 @@ #pragma once -#ifndef ENABLE_METRICS_PREVIEW - -# include "opentelemetry/exporters/otlp/otlp_grpc_metric_exporter_options.h" -# include "opentelemetry/sdk/metrics/push_metric_exporter.h" +#include "opentelemetry/exporters/otlp/otlp_grpc_metric_exporter_options.h" +#include "opentelemetry/sdk/metrics/push_metric_exporter.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace exporter @@ -35,5 +33,3 @@ class OtlpGrpcMetricExporterFactory } // namespace otlp } // namespace exporter OPENTELEMETRY_END_NAMESPACE - -#endif /* ENABLE_METRICS_PREVIEW */ diff --git a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_metric_exporter.h b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_metric_exporter.h index ff47452a07..d09d7f525c 100644 --- a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_metric_exporter.h +++ b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_metric_exporter.h @@ -2,19 +2,18 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/sdk/metrics/push_metric_exporter.h" +#include "opentelemetry/sdk/metrics/push_metric_exporter.h" -# include "opentelemetry/exporters/otlp/otlp_environment.h" -# include "opentelemetry/exporters/otlp/otlp_http_client.h" -# include "opentelemetry/exporters/otlp/otlp_http_metric_exporter_options.h" -# include "opentelemetry/exporters/otlp/otlp_metric_utils.h" +#include "opentelemetry/exporters/otlp/otlp_environment.h" +#include "opentelemetry/exporters/otlp/otlp_http_client.h" +#include "opentelemetry/exporters/otlp/otlp_http_metric_exporter_options.h" +#include "opentelemetry/exporters/otlp/otlp_metric_utils.h" -# include -# include -# include -# include +#include +#include +#include +#include OPENTELEMETRY_BEGIN_NAMESPACE namespace exporter @@ -80,4 +79,3 @@ class OtlpHttpMetricExporter final : public opentelemetry::sdk::metrics::PushMet } // namespace otlp } // namespace exporter OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_metric_exporter_factory.h b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_metric_exporter_factory.h index b0e6fa1678..2fe0476575 100644 --- a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_metric_exporter_factory.h +++ b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_metric_exporter_factory.h @@ -2,12 +2,11 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/exporters/otlp/otlp_http_metric_exporter_options.h" -# include "opentelemetry/sdk/metrics/push_metric_exporter.h" +#include "opentelemetry/exporters/otlp/otlp_http_metric_exporter_options.h" +#include "opentelemetry/sdk/metrics/push_metric_exporter.h" -# include +#include OPENTELEMETRY_BEGIN_NAMESPACE namespace exporter @@ -36,4 +35,3 @@ class OtlpHttpMetricExporterFactory } // namespace otlp } // namespace exporter OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_metric_exporter_options.h b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_metric_exporter_options.h index bb8d9c956c..7fbb000a34 100644 --- a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_metric_exporter_options.h +++ b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_metric_exporter_options.h @@ -2,16 +2,15 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/exporters/otlp/otlp_environment.h" -# include "opentelemetry/exporters/otlp/otlp_http.h" -# include "opentelemetry/sdk/metrics/instruments.h" +#include "opentelemetry/exporters/otlp/otlp_environment.h" +#include "opentelemetry/exporters/otlp/otlp_http.h" +#include "opentelemetry/sdk/metrics/instruments.h" -# include -# include -# include -# include +#include +#include +#include +#include OPENTELEMETRY_BEGIN_NAMESPACE namespace exporter @@ -54,17 +53,16 @@ struct OtlpHttpMetricExporterOptions sdk::metrics::AggregationTemporality aggregation_temporality = sdk::metrics::AggregationTemporality::kDelta; -# 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 }; } // namespace otlp } // namespace exporter OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_metric_utils.h b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_metric_utils.h index c7597638c1..8efbad2453 100644 --- a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_metric_utils.h +++ b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_metric_utils.h @@ -13,8 +13,6 @@ #include "opentelemetry/sdk/metrics/export/metric_producer.h" -#ifndef ENABLE_METRICS_PREVIEW - OPENTELEMETRY_BEGIN_NAMESPACE namespace exporter { @@ -64,5 +62,3 @@ class OtlpMetricUtils } // namespace otlp } // namespace exporter OPENTELEMETRY_END_NAMESPACE - -#endif diff --git a/exporters/otlp/src/otlp_grpc_metric_exporter.cc b/exporters/otlp/src/otlp_grpc_metric_exporter.cc index 74bcbd64a8..3fd50e421b 100644 --- a/exporters/otlp/src/otlp_grpc_metric_exporter.cc +++ b/exporters/otlp/src/otlp_grpc_metric_exporter.cc @@ -1,16 +1,14 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW +#include +#include -# include -# include +#include "opentelemetry/exporters/otlp/otlp_grpc_client.h" +#include "opentelemetry/exporters/otlp/otlp_grpc_metric_exporter.h" +#include "opentelemetry/exporters/otlp/otlp_metric_utils.h" -# include "opentelemetry/exporters/otlp/otlp_grpc_client.h" -# include "opentelemetry/exporters/otlp/otlp_grpc_metric_exporter.h" -# include "opentelemetry/exporters/otlp/otlp_metric_utils.h" - -# include "opentelemetry/sdk_config.h" +#include "opentelemetry/sdk_config.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace exporter @@ -102,4 +100,3 @@ bool OtlpGrpcMetricExporter::isShutdown() const noexcept } // namespace otlp } // namespace exporter OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/exporters/otlp/src/otlp_grpc_metric_exporter_factory.cc b/exporters/otlp/src/otlp_grpc_metric_exporter_factory.cc index fc7952474e..c26035a8df 100644 --- a/exporters/otlp/src/otlp_grpc_metric_exporter_factory.cc +++ b/exporters/otlp/src/otlp_grpc_metric_exporter_factory.cc @@ -1,13 +1,11 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW - // MUST be first (absl) -# include "opentelemetry/exporters/otlp/otlp_grpc_metric_exporter.h" +#include "opentelemetry/exporters/otlp/otlp_grpc_metric_exporter.h" -# include "opentelemetry/exporters/otlp/otlp_grpc_metric_exporter_factory.h" -# include "opentelemetry/exporters/otlp/otlp_grpc_metric_exporter_options.h" +#include "opentelemetry/exporters/otlp/otlp_grpc_metric_exporter_factory.h" +#include "opentelemetry/exporters/otlp/otlp_grpc_metric_exporter_options.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace exporter @@ -33,5 +31,3 @@ OtlpGrpcMetricExporterFactory::Create(const OtlpGrpcMetricExporterOptions &optio } // namespace otlp } // namespace exporter OPENTELEMETRY_END_NAMESPACE - -#endif diff --git a/exporters/otlp/src/otlp_http_metric_exporter.cc b/exporters/otlp/src/otlp_http_metric_exporter.cc index 62c16724f4..1ac89b3238 100644 --- a/exporters/otlp/src/otlp_http_metric_exporter.cc +++ b/exporters/otlp/src/otlp_http_metric_exporter.cc @@ -1,18 +1,16 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW +#include "opentelemetry/exporters/otlp/otlp_http_metric_exporter.h" +#include "opentelemetry/exporters/otlp/otlp_metric_utils.h" -# include "opentelemetry/exporters/otlp/otlp_http_metric_exporter.h" -# include "opentelemetry/exporters/otlp/otlp_metric_utils.h" +#include "opentelemetry/exporters/otlp/protobuf_include_prefix.h" -# include "opentelemetry/exporters/otlp/protobuf_include_prefix.h" +#include "opentelemetry/proto/collector/metrics/v1/metrics_service.pb.h" -# include "opentelemetry/proto/collector/metrics/v1/metrics_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; @@ -37,11 +35,11 @@ OtlpHttpMetricExporter::OtlpHttpMetricExporter(const OtlpHttpMetricExporterOptio 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 ))) {} @@ -59,10 +57,10 @@ OtlpHttpMetricExporter::OtlpHttpMetricExporter(std::unique_ptr h options.console_debug = http_client_->GetOptions().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 ------------------------------ @@ -91,7 +89,7 @@ opentelemetry::sdk::common::ExportResult OtlpHttpMetricExporter::Export( proto::collector::metrics::v1::ExportMetricsServiceRequest service_request; OtlpMetricUtils::PopulateRequest(data, &service_request); std::size_t metric_count = data.scope_metric_data_.size(); -# ifdef ENABLE_ASYNC_EXPORT +#ifdef ENABLE_ASYNC_EXPORT http_client_->Export(service_request, [metric_count]( opentelemetry::sdk::common::ExportResult result) { if (result != opentelemetry::sdk::common::ExportResult::kSuccess) @@ -107,7 +105,7 @@ opentelemetry::sdk::common::ExportResult OtlpHttpMetricExporter::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) { @@ -120,7 +118,7 @@ opentelemetry::sdk::common::ExportResult OtlpHttpMetricExporter::Export( << " metric(s) success"); } return opentelemetry::sdk::common::ExportResult::kSuccess; -# endif +#endif } bool OtlpHttpMetricExporter::ForceFlush(std::chrono::microseconds timeout) noexcept @@ -136,5 +134,3 @@ bool OtlpHttpMetricExporter::Shutdown(std::chrono::microseconds timeout) noexcep } // namespace otlp } // namespace exporter OPENTELEMETRY_END_NAMESPACE - -#endif diff --git a/exporters/otlp/src/otlp_http_metric_exporter_factory.cc b/exporters/otlp/src/otlp_http_metric_exporter_factory.cc index 9abc30d25c..883ce2c503 100644 --- a/exporters/otlp/src/otlp_http_metric_exporter_factory.cc +++ b/exporters/otlp/src/otlp_http_metric_exporter_factory.cc @@ -1,11 +1,9 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW - -# include "opentelemetry/exporters/otlp/otlp_http_metric_exporter_factory.h" -# include "opentelemetry/exporters/otlp/otlp_http_metric_exporter.h" -# include "opentelemetry/exporters/otlp/otlp_http_metric_exporter_options.h" +#include "opentelemetry/exporters/otlp/otlp_http_metric_exporter_factory.h" +#include "opentelemetry/exporters/otlp/otlp_http_metric_exporter.h" +#include "opentelemetry/exporters/otlp/otlp_http_metric_exporter_options.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace exporter @@ -31,5 +29,3 @@ OtlpHttpMetricExporterFactory::Create(const OtlpHttpMetricExporterOptions &optio } // namespace otlp } // namespace exporter OPENTELEMETRY_END_NAMESPACE - -#endif diff --git a/exporters/otlp/src/otlp_metric_utils.cc b/exporters/otlp/src/otlp_metric_utils.cc index 39d133f4cf..9cf34dc550 100644 --- a/exporters/otlp/src/otlp_metric_utils.cc +++ b/exporters/otlp/src/otlp_metric_utils.cc @@ -4,8 +4,6 @@ #include "opentelemetry/exporters/otlp/otlp_metric_utils.h" #include "opentelemetry/exporters/otlp/otlp_populate_attribute_utils.h" -#ifndef ENABLE_METRICS_PREVIEW - OPENTELEMETRY_BEGIN_NAMESPACE namespace exporter @@ -276,5 +274,3 @@ sdk::metrics::AggregationTemporality OtlpMetricUtils::CumulativeTemporalitySelec } // namespace otlp } // namespace exporter OPENTELEMETRY_END_NAMESPACE - -#endif diff --git a/exporters/otlp/test/otlp_grpc_metric_exporter_factory_test.cc b/exporters/otlp/test/otlp_grpc_metric_exporter_factory_test.cc index 41bdf2dac2..b1d473e8da 100644 --- a/exporters/otlp/test/otlp_grpc_metric_exporter_factory_test.cc +++ b/exporters/otlp/test/otlp_grpc_metric_exporter_factory_test.cc @@ -1,20 +1,18 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW +#include -# include - -# include "opentelemetry/exporters/otlp/otlp_grpc_metric_exporter_factory.h" -# include "opentelemetry/exporters/otlp/otlp_grpc_metric_exporter_options.h" +#include "opentelemetry/exporters/otlp/otlp_grpc_metric_exporter_factory.h" +#include "opentelemetry/exporters/otlp/otlp_grpc_metric_exporter_options.h" /* Make sure OtlpGrpcMetricExporterFactory 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(OtlpGrpcMetricExporterFactory, BuildTest) } // namespace otlp } // namespace exporter OPENTELEMETRY_END_NAMESPACE - -#endif // ENABLE_METRICS_PREVIEW diff --git a/exporters/otlp/test/otlp_http_metric_exporter_factory_test.cc b/exporters/otlp/test/otlp_http_metric_exporter_factory_test.cc index 3cc77394ae..3158300548 100644 --- a/exporters/otlp/test/otlp_http_metric_exporter_factory_test.cc +++ b/exporters/otlp/test/otlp_http_metric_exporter_factory_test.cc @@ -1,28 +1,26 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW +#include -# include - -# include "opentelemetry/exporters/otlp/otlp_http_metric_exporter_factory.h" -# include "opentelemetry/exporters/otlp/otlp_http_metric_exporter_options.h" +#include "opentelemetry/exporters/otlp/otlp_http_metric_exporter_factory.h" +#include "opentelemetry/exporters/otlp/otlp_http_metric_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(OtlpHttpMetricExporterFactory, BuildTest) } // namespace otlp } // namespace exporter OPENTELEMETRY_END_NAMESPACE - -#endif // ENABLE_METRICS_PREVIEW diff --git a/exporters/otlp/test/otlp_http_metric_exporter_test.cc b/exporters/otlp/test/otlp_http_metric_exporter_test.cc index 1029df6145..c8ccb8cc8f 100644 --- a/exporters/otlp/test/otlp_http_metric_exporter_test.cc +++ b/exporters/otlp/test/otlp_http_metric_exporter_test.cc @@ -1,40 +1,38 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW +#include +#include +#include -# include -# include -# include +#include "opentelemetry/exporters/otlp/otlp_http_metric_exporter.h" -# include "opentelemetry/exporters/otlp/otlp_http_metric_exporter.h" +#include "opentelemetry/exporters/otlp/protobuf_include_prefix.h" -# include "opentelemetry/exporters/otlp/protobuf_include_prefix.h" +#include "opentelemetry/proto/collector/metrics/v1/metrics_service.pb.h" -# include "opentelemetry/proto/collector/metrics/v1/metrics_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/client/nosend/http_client_nosend.h" +#include "opentelemetry/ext/http/server/http_server.h" +#include "opentelemetry/sdk/metrics/aggregation/default_aggregation.h" +#include "opentelemetry/sdk/metrics/aggregation/histogram_aggregation.h" +#include "opentelemetry/sdk/metrics/data/metric_data.h" +#include "opentelemetry/sdk/metrics/instruments.h" +#include "opentelemetry/sdk/resource/resource.h" -# include "opentelemetry/common/key_value_iterable_view.h" -# include "opentelemetry/ext/http/client/http_client_factory.h" -# include "opentelemetry/ext/http/client/nosend/http_client_nosend.h" -# include "opentelemetry/ext/http/server/http_server.h" -# include "opentelemetry/sdk/metrics/aggregation/default_aggregation.h" -# include "opentelemetry/sdk/metrics/aggregation/histogram_aggregation.h" -# include "opentelemetry/sdk/metrics/data/metric_data.h" -# include "opentelemetry/sdk/metrics/instruments.h" -# include "opentelemetry/sdk/resource/resource.h" +#include +#include "gmock/gmock.h" -# 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; @@ -99,17 +97,17 @@ class OtlpHttpMetricExporterTestPeer : public ::testing::Test } void ExportJsonIntegrationTestExportSumPointData( -# ifdef ENABLE_ASYNC_EXPORT +#ifdef ENABLE_ASYNC_EXPORT bool async_mode -# endif +#endif ) { auto mock_otlp_client = OtlpHttpMetricExporterTestPeer::GetMockOtlpHttpClient(HttpRequestContentType::kJson -# ifdef ENABLE_ASYNC_EXPORT +#ifdef ENABLE_ASYNC_EXPORT , async_mode -# endif +#endif ); auto mock_otlp_http_client = mock_otlp_client.first; auto client = mock_otlp_client.second; @@ -180,17 +178,17 @@ class OtlpHttpMetricExporterTestPeer : public ::testing::Test } void ExportBinaryIntegrationTestExportSumPointData( -# ifdef ENABLE_ASYNC_EXPORT +#ifdef ENABLE_ASYNC_EXPORT bool async_mode -# endif +#endif ) { auto mock_otlp_client = OtlpHttpMetricExporterTestPeer::GetMockOtlpHttpClient(HttpRequestContentType::kBinary -# ifdef ENABLE_ASYNC_EXPORT +#ifdef ENABLE_ASYNC_EXPORT , async_mode -# endif +#endif ); auto mock_otlp_http_client = mock_otlp_client.first; auto client = mock_otlp_client.second; @@ -275,17 +273,17 @@ class OtlpHttpMetricExporterTestPeer : public ::testing::Test } void ExportJsonIntegrationTestExportLastValuePointData( -# ifdef ENABLE_ASYNC_EXPORT +#ifdef ENABLE_ASYNC_EXPORT bool async_mode -# endif +#endif ) { auto mock_otlp_client = OtlpHttpMetricExporterTestPeer::GetMockOtlpHttpClient(HttpRequestContentType::kJson -# ifdef ENABLE_ASYNC_EXPORT +#ifdef ENABLE_ASYNC_EXPORT , async_mode -# endif +#endif ); auto mock_otlp_http_client = mock_otlp_client.first; auto client = mock_otlp_client.second; @@ -361,17 +359,17 @@ class OtlpHttpMetricExporterTestPeer : public ::testing::Test } void ExportBinaryIntegrationTestExportLastValuePointData( -# ifdef ENABLE_ASYNC_EXPORT +#ifdef ENABLE_ASYNC_EXPORT bool async_mode -# endif +#endif ) { auto mock_otlp_client = OtlpHttpMetricExporterTestPeer::GetMockOtlpHttpClient(HttpRequestContentType::kBinary -# ifdef ENABLE_ASYNC_EXPORT +#ifdef ENABLE_ASYNC_EXPORT , async_mode -# endif +#endif ); auto mock_otlp_http_client = mock_otlp_client.first; auto client = mock_otlp_client.second; @@ -465,17 +463,17 @@ class OtlpHttpMetricExporterTestPeer : public ::testing::Test } void ExportJsonIntegrationTestExportHistogramPointData( -# ifdef ENABLE_ASYNC_EXPORT +#ifdef ENABLE_ASYNC_EXPORT bool async_mode -# endif +#endif ) { auto mock_otlp_client = OtlpHttpMetricExporterTestPeer::GetMockOtlpHttpClient(HttpRequestContentType::kJson -# ifdef ENABLE_ASYNC_EXPORT +#ifdef ENABLE_ASYNC_EXPORT , async_mode -# endif +#endif ); auto mock_otlp_http_client = mock_otlp_client.first; auto client = mock_otlp_client.second; @@ -591,17 +589,17 @@ class OtlpHttpMetricExporterTestPeer : public ::testing::Test } void ExportBinaryIntegrationTestExportHistogramPointData( -# ifdef ENABLE_ASYNC_EXPORT +#ifdef ENABLE_ASYNC_EXPORT bool async_mode -# endif +#endif ) { auto mock_otlp_client = OtlpHttpMetricExporterTestPeer::GetMockOtlpHttpClient(HttpRequestContentType::kBinary -# ifdef ENABLE_ASYNC_EXPORT +#ifdef ENABLE_ASYNC_EXPORT , async_mode -# endif +#endif ); auto mock_otlp_http_client = mock_otlp_client.first; auto client = mock_otlp_client.second; @@ -741,7 +739,7 @@ TEST(OtlpHttpMetricExporterTest, Shutdown) EXPECT_EQ(result, opentelemetry::sdk::common::ExportResult::kFailure); } -# ifdef ENABLE_ASYNC_EXPORT +#ifdef ENABLE_ASYNC_EXPORT TEST_F(OtlpHttpMetricExporterTestPeer, ExportJsonIntegrationTestSumPointDataAsync) { ExportJsonIntegrationTestExportSumPointData(true); @@ -793,7 +791,7 @@ TEST_F(OtlpHttpMetricExporterTestPeer, ExportBinaryIntegrationTestHistogramPoint ExportBinaryIntegrationTestExportHistogramPointData(false); } -# else +#else TEST_F(OtlpHttpMetricExporterTestPeer, ExportJsonIntegrationTestSumPointData) { ExportJsonIntegrationTestExportSumPointData(); @@ -820,7 +818,7 @@ TEST_F(OtlpHttpMetricExporterTestPeer, ExportBinaryIntegrationTestHistogramPoint { ExportBinaryIntegrationTestExportHistogramPointData(); } -# endif +#endif // Test exporter configuration options TEST_F(OtlpHttpMetricExporterTestPeer, ConfigTest) @@ -849,7 +847,7 @@ TEST_F(OtlpHttpMetricExporterTestPeer, 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(OtlpHttpMetricExporterTestPeer, ConfigFromEnv) { @@ -936,10 +934,8 @@ TEST_F(OtlpHttpMetricExporterTestPeer, DefaultEndpoint) EXPECT_EQ("http://localhost:4318/v1/metrics", GetOtlpDefaultMetricsEndpoint()); } -# endif +#endif } // namespace otlp } // namespace exporter OPENTELEMETRY_END_NAMESPACE - -#endif diff --git a/exporters/otlp/test/otlp_metrics_serialization_test.cc b/exporters/otlp/test/otlp_metrics_serialization_test.cc index 22e6a2173f..adc4f488b0 100644 --- a/exporters/otlp/test/otlp_metrics_serialization_test.cc +++ b/exporters/otlp/test/otlp_metrics_serialization_test.cc @@ -1,12 +1,10 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW +#include "opentelemetry/exporters/otlp/otlp_metric_utils.h" +#include "opentelemetry/proto/metrics/v1/metrics.pb.h" -# include "opentelemetry/exporters/otlp/otlp_metric_utils.h" -# include "opentelemetry/proto/metrics/v1/metrics.pb.h" - -# include +#include OPENTELEMETRY_BEGIN_NAMESPACE namespace exporter @@ -155,5 +153,3 @@ TEST(OtlpMetricSerializationTest, ObservableGauge) } // namespace otlp } // namespace exporter OPENTELEMETRY_END_NAMESPACE - -#endif diff --git a/exporters/prometheus/CMakeLists.txt b/exporters/prometheus/CMakeLists.txt index 56523ec848..7c7cbf5444 100644 --- a/exporters/prometheus/CMakeLists.txt +++ b/exporters/prometheus/CMakeLists.txt @@ -16,75 +16,37 @@ include_directories(include) if(NOT TARGET prometheus-cpp::core) find_package(prometheus-cpp CONFIG REQUIRED) endif() -if(WITH_METRICS_PREVIEW) - add_library( - prometheus_exporter_deprecated - src/prometheus_exporter.cc src/prometheus_collector.cc - src/prometheus_exporter_utils.cc) - target_include_directories( - prometheus_exporter_deprecated - PUBLIC "$" - "$") - set(PROMETHEUS_EXPORTER_TARGETS_DEPRECATED prometheus_exporter_deprecated) - if(TARGET pull) - list(APPEND PROMETHEUS_EXPORTER_TARGETS_DEPRECATED pull) - endif() - if(TARGET core) - list(APPEND PROMETHEUS_EXPORTER_TARGETS_DEPRECATED core) - endif() - target_link_libraries( - prometheus_exporter_deprecated - PUBLIC opentelemetry_metrics_deprecated prometheus-cpp::pull - prometheus-cpp::core) - install( - TARGETS ${PROMETHEUS_EXPORTER_TARGETS_DEPRECATED} - EXPORT "${PROJECT_NAME}-target" - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) +add_library(prometheus_exporter src/exporter.cc src/collector.cc + src/exporter_utils.cc) +target_include_directories( + prometheus_exporter + PUBLIC "$" + "$") - install( - DIRECTORY include/opentelemetry/exporters/prometheus - DESTINATION include/opentelemetry/exporters/ - FILES_MATCHING - PATTERN "*.h") - if(BUILD_TESTING) - add_subdirectory(test) - endif() -else() - - add_library(prometheus_exporter src/exporter.cc src/collector.cc - src/exporter_utils.cc) - target_include_directories( - prometheus_exporter - PUBLIC "$" - "$") - - set(PROMETHEUS_EXPORTER_TARGETS prometheus_exporter) - if(TARGET pull) - list(APPEND PROMETHEUS_EXPORTER_TARGETS pull) - endif() - if(TARGET core) - list(APPEND PROMETHEUS_EXPORTER_TARGETS core) - endif() - target_link_libraries( - prometheus_exporter PUBLIC opentelemetry_metrics prometheus-cpp::pull - prometheus-cpp::core) - install( - TARGETS ${PROMETHEUS_EXPORTER_TARGETS} - EXPORT "${PROJECT_NAME}-target" - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) +set(PROMETHEUS_EXPORTER_TARGETS prometheus_exporter) +if(TARGET pull) + list(APPEND PROMETHEUS_EXPORTER_TARGETS pull) +endif() +if(TARGET core) + list(APPEND PROMETHEUS_EXPORTER_TARGETS core) +endif() +target_link_libraries( + prometheus_exporter PUBLIC opentelemetry_metrics prometheus-cpp::pull + prometheus-cpp::core) +install( + TARGETS ${PROMETHEUS_EXPORTER_TARGETS} + EXPORT "${PROJECT_NAME}-target" + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) - install( - DIRECTORY include/opentelemetry/exporters/prometheus - DESTINATION include/opentelemetry/exporters/ - FILES_MATCHING - PATTERN "*.h") +install( + DIRECTORY include/opentelemetry/exporters/prometheus + DESTINATION include/opentelemetry/exporters/ + FILES_MATCHING + PATTERN "*.h") - if(BUILD_TESTING) - add_subdirectory(test) - endif() +if(BUILD_TESTING) + add_subdirectory(test) endif() diff --git a/exporters/prometheus/include/opentelemetry/exporters/prometheus/collector.h b/exporters/prometheus/include/opentelemetry/exporters/prometheus/collector.h index 68f50d29fa..2e7489e983 100644 --- a/exporters/prometheus/include/opentelemetry/exporters/prometheus/collector.h +++ b/exporters/prometheus/include/opentelemetry/exporters/prometheus/collector.h @@ -2,15 +2,14 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include -# include -# include +#include +#include +#include -# include -# include -# include "opentelemetry/exporters/prometheus/exporter_utils.h" +#include +#include +#include "opentelemetry/exporters/prometheus/exporter_utils.h" namespace prometheus_client = ::prometheus; @@ -84,4 +83,3 @@ class PrometheusCollector : public prometheus_client::Collectable } // namespace metrics } // namespace exporter OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/exporters/prometheus/include/opentelemetry/exporters/prometheus/exporter.h b/exporters/prometheus/include/opentelemetry/exporters/prometheus/exporter.h index 2553d2fa42..ab05fc71db 100644 --- a/exporters/prometheus/include/opentelemetry/exporters/prometheus/exporter.h +++ b/exporters/prometheus/include/opentelemetry/exporters/prometheus/exporter.h @@ -2,18 +2,18 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include -# include -# include - -# include -# include "opentelemetry/common/spin_lock_mutex.h" -# include "opentelemetry/exporters/prometheus/collector.h" -# include "opentelemetry/nostd/span.h" -# include "opentelemetry/sdk/common/env_variables.h" -# include "opentelemetry/sdk/metrics/push_metric_exporter.h" -# include "opentelemetry/version.h" + +#include +#include +#include + +#include +#include "opentelemetry/common/spin_lock_mutex.h" +#include "opentelemetry/exporters/prometheus/collector.h" +#include "opentelemetry/nostd/span.h" +#include "opentelemetry/sdk/common/env_variables.h" +#include "opentelemetry/sdk/metrics/push_metric_exporter.h" +#include "opentelemetry/version.h" /** * This class is an implementation of the MetricsExporter interface and @@ -131,4 +131,3 @@ class PrometheusExporter : public sdk::metrics::PushMetricExporter } // namespace metrics } // namespace exporter OPENTELEMETRY_END_NAMESPACE -#endif // ENABLE_METRICS_PREVIEW diff --git a/exporters/prometheus/include/opentelemetry/exporters/prometheus/exporter_utils.h b/exporters/prometheus/include/opentelemetry/exporters/prometheus/exporter_utils.h index 9400cff40f..d85d6d8a0c 100644 --- a/exporters/prometheus/include/opentelemetry/exporters/prometheus/exporter_utils.h +++ b/exporters/prometheus/include/opentelemetry/exporters/prometheus/exporter_utils.h @@ -3,14 +3,12 @@ #pragma once -#ifndef ENABLE_METRICS_PREVIEW - -# include -# include -# include -# include "opentelemetry/metrics/provider.h" -# include "opentelemetry/sdk/metrics/meter.h" -# include "opentelemetry/version.h" +#include +#include +#include +#include "opentelemetry/metrics/provider.h" +#include "opentelemetry/sdk/metrics/meter.h" +#include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace exporter @@ -113,4 +111,3 @@ class PrometheusExporterUtils } // namespace metrics } // namespace exporter OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/exporters/prometheus/src/collector.cc b/exporters/prometheus/src/collector.cc index 834e04dc55..07dd40da98 100644 --- a/exporters/prometheus/src/collector.cc +++ b/exporters/prometheus/src/collector.cc @@ -1,9 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW - -# include "opentelemetry/exporters/prometheus/collector.h" +#include "opentelemetry/exporters/prometheus/collector.h" namespace metric_sdk = opentelemetry::sdk::metrics; @@ -87,4 +85,3 @@ int PrometheusCollector::GetMaxCollectionSize() const } // namespace metrics } // namespace exporter OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/exporters/prometheus/src/exporter.cc b/exporters/prometheus/src/exporter.cc index f66dcb7d4f..f220ebd7d7 100644 --- a/exporters/prometheus/src/exporter.cc +++ b/exporters/prometheus/src/exporter.cc @@ -1,8 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/exporters/prometheus/exporter.h" +#include "opentelemetry/exporters/prometheus/exporter.h" OPENTELEMETRY_BEGIN_NAMESPACE @@ -109,4 +108,3 @@ bool PrometheusExporter::IsShutdown() const } // namespace metrics } // namespace exporter OPENTELEMETRY_END_NAMESPACE -#endif // ENABLE_METRICS_PREVIEW diff --git a/exporters/prometheus/src/exporter_utils.cc b/exporters/prometheus/src/exporter_utils.cc index fc2b102f24..a8c648132e 100644 --- a/exporters/prometheus/src/exporter_utils.cc +++ b/exporters/prometheus/src/exporter_utils.cc @@ -1,17 +1,16 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW -# include -# include -# include -# include "prometheus/metric_family.h" +#include +#include +#include +#include "prometheus/metric_family.h" -# include -# include "opentelemetry/exporters/prometheus/exporter_utils.h" -# include "opentelemetry/sdk/metrics/export/metric_producer.h" +#include +#include "opentelemetry/exporters/prometheus/exporter_utils.h" +#include "opentelemetry/sdk/metrics/export/metric_producer.h" -# include "opentelemetry/sdk/common/global_log_handler.h" +#include "opentelemetry/sdk/common/global_log_handler.h" namespace prometheus_client = ::prometheus; namespace metric_sdk = opentelemetry::sdk::metrics; @@ -370,4 +369,3 @@ void PrometheusExporterUtils::SetValue(std::vector values, } // namespace metrics } // namespace exporter OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/exporters/prometheus/test/CMakeLists.txt b/exporters/prometheus/test/CMakeLists.txt index 385ad83952..a954357488 100644 --- a/exporters/prometheus/test/CMakeLists.txt +++ b/exporters/prometheus/test/CMakeLists.txt @@ -1,24 +1,10 @@ -if(WITH_METRICS_PREVIEW) - foreach(testname prometheus_exporter_test prometheus_collector_test - prometheus_exporter_utils_test) - add_executable(${testname} "${testname}.cc") - target_link_libraries( - ${testname} ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} - prometheus_exporter_deprecated prometheus-cpp::pull) - gtest_add_tests( - TARGET ${testname} - TEST_PREFIX exporter. - TEST_LIST ${testname}) - endforeach() -else() - foreach(testname exporter_test collector_test exporter_utils_test) - add_executable(${testname} "${testname}.cc") - target_link_libraries( - ${testname} ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} - prometheus_exporter prometheus-cpp::pull opentelemetry_resources) - gtest_add_tests( - TARGET ${testname} - TEST_PREFIX exporter. - TEST_LIST ${testname}) - endforeach() -endif() +foreach(testname exporter_test collector_test exporter_utils_test) + add_executable(${testname} "${testname}.cc") + target_link_libraries( + ${testname} ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} + prometheus_exporter prometheus-cpp::pull opentelemetry_resources) + gtest_add_tests( + TARGET ${testname} + TEST_PREFIX exporter. + TEST_LIST ${testname}) +endforeach() diff --git a/exporters/prometheus/test/collector_test.cc b/exporters/prometheus/test/collector_test.cc index a2a7e04cfa..b6460761ed 100644 --- a/exporters/prometheus/test/collector_test.cc +++ b/exporters/prometheus/test/collector_test.cc @@ -1,15 +1,14 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW -# include -# include -# include -# include +#include +#include +#include +#include -# include "opentelemetry/exporters/prometheus/collector.h" -# include "opentelemetry/version.h" -# include "prometheus_test_helper.h" +#include "opentelemetry/exporters/prometheus/collector.h" +#include "opentelemetry/version.h" +#include "prometheus_test_helper.h" using opentelemetry::exporter::metrics::PrometheusCollector; namespace metric_api = opentelemetry::metrics; @@ -351,4 +350,3 @@ TEST(PrometheusCollector, ConcurrentlyAddingAndConcurrentlyCollecting) } OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/exporters/prometheus/test/exporter_test.cc b/exporters/prometheus/test/exporter_test.cc index 8c35c6a856..c115dbfa87 100644 --- a/exporters/prometheus/test/exporter_test.cc +++ b/exporters/prometheus/test/exporter_test.cc @@ -1,14 +1,12 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW +#include -# include - -# include "opentelemetry/exporters/prometheus/collector.h" -# include "opentelemetry/exporters/prometheus/exporter.h" -# include "opentelemetry/version.h" -# include "prometheus_test_helper.h" +#include "opentelemetry/exporters/prometheus/collector.h" +#include "opentelemetry/exporters/prometheus/exporter.h" +#include "opentelemetry/version.h" +#include "prometheus_test_helper.h" /** * PrometheusExporterTest is a friend class of PrometheusExporter. @@ -160,5 +158,3 @@ TEST(PrometheusExporter, InvalidArgumentWhenPassedEmptyRecordCollection) ExportResult code = ExportResult::kFailureInvalidArgument; ASSERT_EQ(res, code); } - -#endif // ENABLE_METRICS_PREVIEW diff --git a/exporters/prometheus/test/exporter_utils_test.cc b/exporters/prometheus/test/exporter_utils_test.cc index 2f103b702b..25e7ad0fdd 100644 --- a/exporters/prometheus/test/exporter_utils_test.cc +++ b/exporters/prometheus/test/exporter_utils_test.cc @@ -1,13 +1,12 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW -# include -# include "prometheus/metric_family.h" -# include "prometheus/metric_type.h" +#include +#include "prometheus/metric_family.h" +#include "prometheus/metric_type.h" -# include "opentelemetry/exporters/prometheus/exporter_utils.h" -# include "prometheus_test_helper.h" +#include "opentelemetry/exporters/prometheus/exporter_utils.h" +#include "prometheus_test_helper.h" using opentelemetry::exporter::metrics::PrometheusExporterUtils; namespace metric_sdk = opentelemetry::sdk::metrics; @@ -152,4 +151,3 @@ TEST(PrometheusExporterUtils, TranslateToPrometheusHistogramNormal) } OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/exporters/prometheus/test/prometheus_test_helper.h b/exporters/prometheus/test/prometheus_test_helper.h index 1042804d00..4743e032bd 100644 --- a/exporters/prometheus/test/prometheus_test_helper.h +++ b/exporters/prometheus/test/prometheus_test_helper.h @@ -3,9 +3,7 @@ #pragma once -#ifndef ENABLE_METRICS_PREVIEW - -# include "opentelemetry/version.h" +#include "opentelemetry/version.h" namespace metric_sdk = opentelemetry::sdk::metrics; namespace nostd = opentelemetry::nostd; @@ -241,4 +239,3 @@ inline bool operator==(const metric_sdk::MetricData &lhs, const metric_sdk::Metr } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif // ENABLE_METRICS_PREVIEW diff --git a/sdk/CMakeLists.txt b/sdk/CMakeLists.txt index ca5af6334d..c3466b7776 100644 --- a/sdk/CMakeLists.txt +++ b/sdk/CMakeLists.txt @@ -24,17 +24,11 @@ if(NOT WITH_LOGS_PREVIEW) set(LOGS_EXCLUDE_PATTERN "logs") endif() -set(METRICS_EXCLUDE_PATTERN "") -if(NOT WITH_METRICS_PREVIEW) - set(METRICS_EXCLUDE_PATTERN "_metrics") -endif() - install( DIRECTORY include/opentelemetry/sdk DESTINATION include/opentelemetry FILES_MATCHING PATTERN "*.h" - PATTERN "${METRICS_EXCLUDE_PATTERN}" EXCLUDE PATTERN "${LOGS_EXCLUDE_PATTERN}" EXCLUDE) add_subdirectory(src) diff --git a/sdk/include/opentelemetry/sdk/metrics/aggregation/aggregation.h b/sdk/include/opentelemetry/sdk/metrics/aggregation/aggregation.h index 786466fd12..361a1cd3b8 100644 --- a/sdk/include/opentelemetry/sdk/metrics/aggregation/aggregation.h +++ b/sdk/include/opentelemetry/sdk/metrics/aggregation/aggregation.h @@ -2,10 +2,10 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/nostd/string_view.h" -# include "opentelemetry/sdk/metrics/data/metric_data.h" -# include "opentelemetry/sdk/metrics/data/point_data.h" + +#include "opentelemetry/nostd/string_view.h" +#include "opentelemetry/sdk/metrics/data/metric_data.h" +#include "opentelemetry/sdk/metrics/data/point_data.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk { @@ -52,4 +52,3 @@ class Aggregation } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/metrics/aggregation/aggregation_config.h b/sdk/include/opentelemetry/sdk/metrics/aggregation/aggregation_config.h index 61bf2716a7..ee297881d0 100644 --- a/sdk/include/opentelemetry/sdk/metrics/aggregation/aggregation_config.h +++ b/sdk/include/opentelemetry/sdk/metrics/aggregation/aggregation_config.h @@ -2,9 +2,9 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include -# include "opentelemetry/version.h" + +#include +#include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk { @@ -25,5 +25,3 @@ class HistogramAggregationConfig : public AggregationConfig } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE - -#endif // ENABLE_METRICS_PREVIEW diff --git a/sdk/include/opentelemetry/sdk/metrics/aggregation/default_aggregation.h b/sdk/include/opentelemetry/sdk/metrics/aggregation/default_aggregation.h index 001e54a2af..446ffac802 100644 --- a/sdk/include/opentelemetry/sdk/metrics/aggregation/default_aggregation.h +++ b/sdk/include/opentelemetry/sdk/metrics/aggregation/default_aggregation.h @@ -2,19 +2,19 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include -# include "opentelemetry/common/spin_lock_mutex.h" -# include "opentelemetry/sdk/metrics/aggregation/aggregation.h" -# include "opentelemetry/sdk/metrics/aggregation/aggregation_config.h" -# include "opentelemetry/sdk/metrics/aggregation/drop_aggregation.h" -# include "opentelemetry/sdk/metrics/aggregation/histogram_aggregation.h" -# include "opentelemetry/sdk/metrics/aggregation/lastvalue_aggregation.h" -# include "opentelemetry/sdk/metrics/aggregation/sum_aggregation.h" -# include "opentelemetry/sdk/metrics/data/point_data.h" -# include "opentelemetry/sdk/metrics/instruments.h" -# include +#include +#include "opentelemetry/common/spin_lock_mutex.h" +#include "opentelemetry/sdk/metrics/aggregation/aggregation.h" +#include "opentelemetry/sdk/metrics/aggregation/aggregation_config.h" +#include "opentelemetry/sdk/metrics/aggregation/drop_aggregation.h" +#include "opentelemetry/sdk/metrics/aggregation/histogram_aggregation.h" +#include "opentelemetry/sdk/metrics/aggregation/lastvalue_aggregation.h" +#include "opentelemetry/sdk/metrics/aggregation/sum_aggregation.h" +#include "opentelemetry/sdk/metrics/data/point_data.h" +#include "opentelemetry/sdk/metrics/instruments.h" + +#include OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -167,4 +167,3 @@ class DefaultAggregation } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/metrics/aggregation/drop_aggregation.h b/sdk/include/opentelemetry/sdk/metrics/aggregation/drop_aggregation.h index f32ffcd1d3..713ce60b8e 100644 --- a/sdk/include/opentelemetry/sdk/metrics/aggregation/drop_aggregation.h +++ b/sdk/include/opentelemetry/sdk/metrics/aggregation/drop_aggregation.h @@ -2,11 +2,11 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/common/spin_lock_mutex.h" -# include "opentelemetry/sdk/metrics/aggregation/aggregation.h" -# include +#include "opentelemetry/common/spin_lock_mutex.h" +#include "opentelemetry/sdk/metrics/aggregation/aggregation.h" + +#include OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -48,4 +48,3 @@ class DropAggregation : public Aggregation } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/metrics/aggregation/histogram_aggregation.h b/sdk/include/opentelemetry/sdk/metrics/aggregation/histogram_aggregation.h index 0efe0c9a5b..ae9eeb4ded 100644 --- a/sdk/include/opentelemetry/sdk/metrics/aggregation/histogram_aggregation.h +++ b/sdk/include/opentelemetry/sdk/metrics/aggregation/histogram_aggregation.h @@ -2,13 +2,13 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once + #include -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/common/spin_lock_mutex.h" -# include "opentelemetry/sdk/metrics/aggregation/aggregation.h" -# include "opentelemetry/sdk/metrics/aggregation/aggregation_config.h" +#include "opentelemetry/common/spin_lock_mutex.h" +#include "opentelemetry/sdk/metrics/aggregation/aggregation.h" +#include "opentelemetry/sdk/metrics/aggregation/aggregation_config.h" -# include +#include OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -111,4 +111,3 @@ void HistogramDiff(HistogramPointData ¤t, HistogramPointData &next, Histog } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/metrics/aggregation/lastvalue_aggregation.h b/sdk/include/opentelemetry/sdk/metrics/aggregation/lastvalue_aggregation.h index e4580e5e3a..05242e304d 100644 --- a/sdk/include/opentelemetry/sdk/metrics/aggregation/lastvalue_aggregation.h +++ b/sdk/include/opentelemetry/sdk/metrics/aggregation/lastvalue_aggregation.h @@ -2,11 +2,11 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/common/spin_lock_mutex.h" -# include "opentelemetry/sdk/metrics/aggregation/aggregation.h" -# include +#include "opentelemetry/common/spin_lock_mutex.h" +#include "opentelemetry/sdk/metrics/aggregation/aggregation.h" + +#include OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -60,4 +60,3 @@ class DoubleLastValueAggregation : public Aggregation } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/metrics/aggregation/sum_aggregation.h b/sdk/include/opentelemetry/sdk/metrics/aggregation/sum_aggregation.h index bb0d637b60..881854e0c2 100644 --- a/sdk/include/opentelemetry/sdk/metrics/aggregation/sum_aggregation.h +++ b/sdk/include/opentelemetry/sdk/metrics/aggregation/sum_aggregation.h @@ -2,11 +2,11 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/common/spin_lock_mutex.h" -# include "opentelemetry/sdk/metrics/aggregation/aggregation.h" -# include +#include "opentelemetry/common/spin_lock_mutex.h" +#include "opentelemetry/sdk/metrics/aggregation/aggregation.h" + +#include OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -61,4 +61,3 @@ class DoubleSumAggregation : public Aggregation } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/metrics/async_instruments.h b/sdk/include/opentelemetry/sdk/metrics/async_instruments.h index 13a059962c..321c8089c1 100644 --- a/sdk/include/opentelemetry/sdk/metrics/async_instruments.h +++ b/sdk/include/opentelemetry/sdk/metrics/async_instruments.h @@ -2,12 +2,12 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/metrics/async_instruments.h" -# include "opentelemetry/metrics/observer_result.h" -# include "opentelemetry/nostd/string_view.h" -# include "opentelemetry/sdk/metrics/instruments.h" -# include "opentelemetry/sdk/metrics/state/observable_registry.h" + +#include "opentelemetry/metrics/async_instruments.h" +#include "opentelemetry/metrics/observer_result.h" +#include "opentelemetry/nostd/string_view.h" +#include "opentelemetry/sdk/metrics/instruments.h" +#include "opentelemetry/sdk/metrics/state/observable_registry.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -42,4 +42,3 @@ class ObservableInstrument : public opentelemetry::metrics::ObservableInstrument } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/metrics/data/exemplar_data.h b/sdk/include/opentelemetry/sdk/metrics/data/exemplar_data.h index 49ae1ed56c..f04b06c9f6 100644 --- a/sdk/include/opentelemetry/sdk/metrics/data/exemplar_data.h +++ b/sdk/include/opentelemetry/sdk/metrics/data/exemplar_data.h @@ -2,13 +2,13 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include -# include "opentelemetry/common/timestamp.h" -# include "opentelemetry/context/context.h" -# include "opentelemetry/sdk/common/attribute_utils.h" -# include "opentelemetry/sdk/metrics/data/metric_data.h" -# include "opentelemetry/sdk/metrics/export/metric_producer.h" + +#include +#include "opentelemetry/common/timestamp.h" +#include "opentelemetry/context/context.h" +#include "opentelemetry/sdk/common/attribute_utils.h" +#include "opentelemetry/sdk/metrics/data/metric_data.h" +#include "opentelemetry/sdk/metrics/export/metric_producer.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -81,4 +81,3 @@ class ExemplarData } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/metrics/data/metric_data.h b/sdk/include/opentelemetry/sdk/metrics/data/metric_data.h index 6b209f16d3..28a53dd407 100644 --- a/sdk/include/opentelemetry/sdk/metrics/data/metric_data.h +++ b/sdk/include/opentelemetry/sdk/metrics/data/metric_data.h @@ -2,14 +2,14 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/nostd/variant.h" -# include "opentelemetry/sdk/common/attribute_utils.h" -# include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h" -# include "opentelemetry/sdk/metrics/data/point_data.h" -# include "opentelemetry/sdk/metrics/instruments.h" -# include "opentelemetry/sdk/resource/resource.h" -# include "opentelemetry/version.h" + +#include "opentelemetry/nostd/variant.h" +#include "opentelemetry/sdk/common/attribute_utils.h" +#include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h" +#include "opentelemetry/sdk/metrics/data/point_data.h" +#include "opentelemetry/sdk/metrics/instruments.h" +#include "opentelemetry/sdk/resource/resource.h" +#include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -40,4 +40,3 @@ class MetricData } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/metrics/data/point_data.h b/sdk/include/opentelemetry/sdk/metrics/data/point_data.h index 81878ff757..359da0b864 100644 --- a/sdk/include/opentelemetry/sdk/metrics/data/point_data.h +++ b/sdk/include/opentelemetry/sdk/metrics/data/point_data.h @@ -2,13 +2,13 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/common/timestamp.h" -# include "opentelemetry/nostd/variant.h" -# include "opentelemetry/sdk/metrics/instruments.h" -# include "opentelemetry/version.h" -# include +#include "opentelemetry/common/timestamp.h" +#include "opentelemetry/nostd/variant.h" +#include "opentelemetry/sdk/metrics/instruments.h" +#include "opentelemetry/version.h" + +#include OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -78,4 +78,3 @@ class DropPointData } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/metrics/exemplar/always_sample_filter.h b/sdk/include/opentelemetry/sdk/metrics/exemplar/always_sample_filter.h index 8bcb974993..c10ec061bb 100644 --- a/sdk/include/opentelemetry/sdk/metrics/exemplar/always_sample_filter.h +++ b/sdk/include/opentelemetry/sdk/metrics/exemplar/always_sample_filter.h @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/sdk/metrics/exemplar/filter.h" + +#include "opentelemetry/sdk/metrics/exemplar/filter.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -35,4 +35,3 @@ class AlwaysSampleFilter final : public ExemplarFilter } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/metrics/exemplar/filter.h b/sdk/include/opentelemetry/sdk/metrics/exemplar/filter.h index 3c8c43fb58..cfc3439992 100644 --- a/sdk/include/opentelemetry/sdk/metrics/exemplar/filter.h +++ b/sdk/include/opentelemetry/sdk/metrics/exemplar/filter.h @@ -2,9 +2,9 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/context/context.h" -# include "opentelemetry/sdk/common/attribute_utils.h" + +#include "opentelemetry/context/context.h" +#include "opentelemetry/sdk/common/attribute_utils.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -40,4 +40,3 @@ class ExemplarFilter } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/metrics/exemplar/filtered_exemplar_reservoir.h b/sdk/include/opentelemetry/sdk/metrics/exemplar/filtered_exemplar_reservoir.h index f410bef6d0..5264c33170 100644 --- a/sdk/include/opentelemetry/sdk/metrics/exemplar/filtered_exemplar_reservoir.h +++ b/sdk/include/opentelemetry/sdk/metrics/exemplar/filtered_exemplar_reservoir.h @@ -2,14 +2,14 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include -# include -# include "opentelemetry/context/context.h" -# include "opentelemetry/nostd/shared_ptr.h" -# include "opentelemetry/sdk/common/attribute_utils.h" -# include "opentelemetry/sdk/metrics/exemplar/filter.h" -# include "opentelemetry/sdk/metrics/exemplar/reservoir.h" + +#include +#include +#include "opentelemetry/context/context.h" +#include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/sdk/common/attribute_utils.h" +#include "opentelemetry/sdk/metrics/exemplar/filter.h" +#include "opentelemetry/sdk/metrics/exemplar/reservoir.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -62,4 +62,3 @@ class FilteredExemplarReservoir final : public ExemplarReservoir } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/metrics/exemplar/fixed_size_exemplar_reservoir.h b/sdk/include/opentelemetry/sdk/metrics/exemplar/fixed_size_exemplar_reservoir.h index e8564f4285..d2cc13f20c 100644 --- a/sdk/include/opentelemetry/sdk/metrics/exemplar/fixed_size_exemplar_reservoir.h +++ b/sdk/include/opentelemetry/sdk/metrics/exemplar/fixed_size_exemplar_reservoir.h @@ -2,16 +2,16 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include -# include -# include "opentelemetry/context/context.h" -# include "opentelemetry/nostd/function_ref.h" -# include "opentelemetry/nostd/shared_ptr.h" -# include "opentelemetry/sdk/common/attribute_utils.h" -# include "opentelemetry/sdk/metrics/exemplar/reservoir.h" -# include "opentelemetry/sdk/metrics/exemplar/reservoir_cell.h" -# include "opentelemetry/sdk/metrics/exemplar/reservoir_cell_selector.h" + +#include +#include +#include "opentelemetry/context/context.h" +#include "opentelemetry/nostd/function_ref.h" +#include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/sdk/common/attribute_utils.h" +#include "opentelemetry/sdk/metrics/exemplar/reservoir.h" +#include "opentelemetry/sdk/metrics/exemplar/reservoir_cell.h" +#include "opentelemetry/sdk/metrics/exemplar/reservoir_cell_selector.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -101,4 +101,3 @@ class FixedSizeExemplarReservoir : public ExemplarReservoir } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/metrics/exemplar/histogram_exemplar_reservoir.h b/sdk/include/opentelemetry/sdk/metrics/exemplar/histogram_exemplar_reservoir.h index ad7f163860..7da7dc8ac0 100644 --- a/sdk/include/opentelemetry/sdk/metrics/exemplar/histogram_exemplar_reservoir.h +++ b/sdk/include/opentelemetry/sdk/metrics/exemplar/histogram_exemplar_reservoir.h @@ -2,17 +2,17 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include -# include -# include "opentelemetry/context/context.h" -# include "opentelemetry/nostd/shared_ptr.h" -# include "opentelemetry/sdk/common/attribute_utils.h" -# include "opentelemetry/sdk/metrics/data/exemplar_data.h" -# include "opentelemetry/sdk/metrics/exemplar/filter.h" -# include "opentelemetry/sdk/metrics/exemplar/fixed_size_exemplar_reservoir.h" -# include "opentelemetry/sdk/metrics/exemplar/reservoir.h" -# include "opentelemetry/sdk/metrics/exemplar/reservoir_cell_selector.h" + +#include +#include +#include "opentelemetry/context/context.h" +#include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/sdk/common/attribute_utils.h" +#include "opentelemetry/sdk/metrics/data/exemplar_data.h" +#include "opentelemetry/sdk/metrics/exemplar/filter.h" +#include "opentelemetry/sdk/metrics/exemplar/fixed_size_exemplar_reservoir.h" +#include "opentelemetry/sdk/metrics/exemplar/reservoir.h" +#include "opentelemetry/sdk/metrics/exemplar/reservoir_cell_selector.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -78,4 +78,3 @@ class HistogramExemplarReservoir : public FixedSizeExemplarReservoir } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/metrics/exemplar/never_sample_filter.h b/sdk/include/opentelemetry/sdk/metrics/exemplar/never_sample_filter.h index e5015c9b9f..1f2967467b 100644 --- a/sdk/include/opentelemetry/sdk/metrics/exemplar/never_sample_filter.h +++ b/sdk/include/opentelemetry/sdk/metrics/exemplar/never_sample_filter.h @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/sdk/metrics/exemplar/filter.h" + +#include "opentelemetry/sdk/metrics/exemplar/filter.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -35,4 +35,3 @@ class NeverSampleFilter final : public ExemplarFilter } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/metrics/exemplar/no_exemplar_reservoir.h b/sdk/include/opentelemetry/sdk/metrics/exemplar/no_exemplar_reservoir.h index 481690a0c3..d137991f71 100644 --- a/sdk/include/opentelemetry/sdk/metrics/exemplar/no_exemplar_reservoir.h +++ b/sdk/include/opentelemetry/sdk/metrics/exemplar/no_exemplar_reservoir.h @@ -2,12 +2,12 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include -# include "opentelemetry/context/context.h" -# include "opentelemetry/nostd/shared_ptr.h" -# include "opentelemetry/sdk/common/attribute_utils.h" -# include "opentelemetry/sdk/metrics/exemplar/reservoir.h" + +#include +#include "opentelemetry/context/context.h" +#include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/sdk/common/attribute_utils.h" +#include "opentelemetry/sdk/metrics/exemplar/reservoir.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -48,4 +48,3 @@ class NoExemplarReservoir final : public ExemplarReservoir } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/metrics/exemplar/reservoir.h b/sdk/include/opentelemetry/sdk/metrics/exemplar/reservoir.h index 5fcb90d6b4..ea418b698d 100644 --- a/sdk/include/opentelemetry/sdk/metrics/exemplar/reservoir.h +++ b/sdk/include/opentelemetry/sdk/metrics/exemplar/reservoir.h @@ -2,11 +2,11 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include -# include "opentelemetry/sdk/metrics/data/exemplar_data.h" -# include "opentelemetry/sdk/metrics/exemplar/filter.h" -# include "opentelemetry/sdk/metrics/exemplar/reservoir_cell_selector.h" + +#include +#include "opentelemetry/sdk/metrics/data/exemplar_data.h" +#include "opentelemetry/sdk/metrics/exemplar/filter.h" +#include "opentelemetry/sdk/metrics/exemplar/reservoir_cell_selector.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -66,4 +66,3 @@ class ExemplarReservoir } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/metrics/exemplar/reservoir_cell.h b/sdk/include/opentelemetry/sdk/metrics/exemplar/reservoir_cell.h index 324fbe1993..2309fc72e4 100644 --- a/sdk/include/opentelemetry/sdk/metrics/exemplar/reservoir_cell.h +++ b/sdk/include/opentelemetry/sdk/metrics/exemplar/reservoir_cell.h @@ -2,17 +2,17 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include -# include -# include -# include "opentelemetry/common/timestamp.h" -# include "opentelemetry/context/context.h" -# include "opentelemetry/nostd/shared_ptr.h" -# include "opentelemetry/sdk/common/attribute_utils.h" -# include "opentelemetry/sdk/metrics/data/exemplar_data.h" -# include "opentelemetry/sdk/metrics/exemplar/filter.h" -# include "opentelemetry/trace/context.h" + +#include +#include +#include +#include "opentelemetry/common/timestamp.h" +#include "opentelemetry/context/context.h" +#include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/sdk/common/attribute_utils.h" +#include "opentelemetry/sdk/metrics/data/exemplar_data.h" +#include "opentelemetry/sdk/metrics/exemplar/filter.h" +#include "opentelemetry/trace/context.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -150,4 +150,3 @@ class ReservoirCell } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/metrics/exemplar/reservoir_cell_selector.h b/sdk/include/opentelemetry/sdk/metrics/exemplar/reservoir_cell_selector.h index 6972bf429b..1017d64aa7 100644 --- a/sdk/include/opentelemetry/sdk/metrics/exemplar/reservoir_cell_selector.h +++ b/sdk/include/opentelemetry/sdk/metrics/exemplar/reservoir_cell_selector.h @@ -2,14 +2,14 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once + #include -#ifndef ENABLE_METRICS_PREVIEW -# include -# include -# include "opentelemetry/context/context.h" -# include "opentelemetry/nostd/shared_ptr.h" -# include "opentelemetry/sdk/common/attribute_utils.h" -# include "opentelemetry/sdk/metrics/exemplar/reservoir_cell.h" +#include +#include +#include "opentelemetry/context/context.h" +#include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/sdk/common/attribute_utils.h" +#include "opentelemetry/sdk/metrics/exemplar/reservoir_cell.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -41,4 +41,3 @@ class ReservoirCellSelector } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/metrics/exemplar/with_trace_sample_filter.h b/sdk/include/opentelemetry/sdk/metrics/exemplar/with_trace_sample_filter.h index afeb179866..de01cbc632 100644 --- a/sdk/include/opentelemetry/sdk/metrics/exemplar/with_trace_sample_filter.h +++ b/sdk/include/opentelemetry/sdk/metrics/exemplar/with_trace_sample_filter.h @@ -2,9 +2,9 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/sdk/metrics/exemplar/filter.h" -# include "opentelemetry/trace/context.h" + +#include "opentelemetry/sdk/metrics/exemplar/filter.h" +#include "opentelemetry/trace/context.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -41,4 +41,3 @@ class WithTraceSampleFilter final : public ExemplarFilter } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/metrics/export/metric_producer.h b/sdk/include/opentelemetry/sdk/metrics/export/metric_producer.h index 07f4cadbd1..82b8c1c474 100644 --- a/sdk/include/opentelemetry/sdk/metrics/export/metric_producer.h +++ b/sdk/include/opentelemetry/sdk/metrics/export/metric_producer.h @@ -2,10 +2,10 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h" -# include "opentelemetry/sdk/metrics/data/metric_data.h" -# include "opentelemetry/sdk/resource/resource.h" + +#include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h" +#include "opentelemetry/sdk/metrics/data/metric_data.h" +#include "opentelemetry/sdk/resource/resource.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -56,4 +56,3 @@ class MetricProducer } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/metrics/export/periodic_exporting_metric_reader.h b/sdk/include/opentelemetry/sdk/metrics/export/periodic_exporting_metric_reader.h index 0e9f56722f..96b37f0d40 100644 --- a/sdk/include/opentelemetry/sdk/metrics/export/periodic_exporting_metric_reader.h +++ b/sdk/include/opentelemetry/sdk/metrics/export/periodic_exporting_metric_reader.h @@ -2,15 +2,14 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/sdk/metrics/metric_reader.h" -# include "opentelemetry/version.h" +#include "opentelemetry/sdk/metrics/metric_reader.h" +#include "opentelemetry/version.h" -# include -# include -# include -# include +#include +#include +#include +#include OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -70,4 +69,3 @@ class PeriodicExportingMetricReader : public MetricReader } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/metrics/instrument_metadata_validator.h b/sdk/include/opentelemetry/sdk/metrics/instrument_metadata_validator.h index 97e7550cde..0a8362e9e9 100644 --- a/sdk/include/opentelemetry/sdk/metrics/instrument_metadata_validator.h +++ b/sdk/include/opentelemetry/sdk/metrics/instrument_metadata_validator.h @@ -2,15 +2,15 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include -# include "opentelemetry/common/macros.h" -# include "opentelemetry/nostd/string_view.h" -# include "opentelemetry/version.h" -# if HAVE_WORKING_REGEX -# include -# endif +#include +#include "opentelemetry/common/macros.h" +#include "opentelemetry/nostd/string_view.h" +#include "opentelemetry/version.h" + +#if HAVE_WORKING_REGEX +# include +#endif OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -26,13 +26,12 @@ class InstrumentMetaDataValidator bool ValidateDescription(nostd::string_view description) const; private: -# if HAVE_WORKING_REGEX +#if HAVE_WORKING_REGEX const std::regex name_reg_key_; const std::regex unit_reg_key_; -# endif +#endif }; } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/metrics/instruments.h b/sdk/include/opentelemetry/sdk/metrics/instruments.h index b176eabe5e..6c6497555b 100644 --- a/sdk/include/opentelemetry/sdk/metrics/instruments.h +++ b/sdk/include/opentelemetry/sdk/metrics/instruments.h @@ -2,10 +2,11 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include -# include "opentelemetry/common/macros.h" -# include "opentelemetry/sdk/common/attribute_utils.h" + +#include +#include "opentelemetry/common/macros.h" +#include "opentelemetry/sdk/common/attribute_utils.h" + OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk { @@ -76,4 +77,3 @@ InstrumentType type_; } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/metrics/meter.h b/sdk/include/opentelemetry/sdk/metrics/meter.h index 80f9d5bc67..6beff61063 100644 --- a/sdk/include/opentelemetry/sdk/metrics/meter.h +++ b/sdk/include/opentelemetry/sdk/metrics/meter.h @@ -2,20 +2,20 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include -# include "opentelemetry/metrics/meter.h" -# include "opentelemetry/metrics/noop.h" -# include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h" -# include "opentelemetry/sdk/metrics/instrument_metadata_validator.h" -# include "opentelemetry/sdk/metrics/instruments.h" -# include "opentelemetry/sdk/metrics/meter_context.h" -# include "opentelemetry/sdk/metrics/state/async_metric_storage.h" - -# include "opentelemetry/common/macros.h" -# include "opentelemetry/sdk/resource/resource.h" -# include "opentelemetry/sdk_config.h" -# include "opentelemetry/version.h" + +#include +#include "opentelemetry/metrics/meter.h" +#include "opentelemetry/metrics/noop.h" +#include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h" +#include "opentelemetry/sdk/metrics/instrument_metadata_validator.h" +#include "opentelemetry/sdk/metrics/instruments.h" +#include "opentelemetry/sdk/metrics/meter_context.h" +#include "opentelemetry/sdk/metrics/state/async_metric_storage.h" + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/sdk/resource/resource.h" +#include "opentelemetry/sdk_config.h" +#include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -144,4 +144,3 @@ class Meter final : public opentelemetry::metrics::Meter } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/metrics/meter_context.h b/sdk/include/opentelemetry/sdk/metrics/meter_context.h index 8af3c22eea..6a0e3f65d7 100644 --- a/sdk/include/opentelemetry/sdk/metrics/meter_context.h +++ b/sdk/include/opentelemetry/sdk/metrics/meter_context.h @@ -2,19 +2,18 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/common/spin_lock_mutex.h" -# include "opentelemetry/sdk/metrics/state/metric_collector.h" -# include "opentelemetry/sdk/metrics/view/instrument_selector.h" -# include "opentelemetry/sdk/metrics/view/meter_selector.h" -# include "opentelemetry/sdk/metrics/view/view_registry.h" -# include "opentelemetry/sdk/resource/resource.h" -# include "opentelemetry/version.h" +#include "opentelemetry/common/spin_lock_mutex.h" +#include "opentelemetry/sdk/metrics/state/metric_collector.h" +#include "opentelemetry/sdk/metrics/view/instrument_selector.h" +#include "opentelemetry/sdk/metrics/view/meter_selector.h" +#include "opentelemetry/sdk/metrics/view/view_registry.h" +#include "opentelemetry/sdk/resource/resource.h" +#include "opentelemetry/version.h" -# include -# include -# include +#include +#include +#include OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -131,4 +130,3 @@ class MeterContext : public std::enable_shared_from_this } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/metrics/meter_provider.h b/sdk/include/opentelemetry/sdk/metrics/meter_provider.h index 8b41106bec..f2c72e2d25 100644 --- a/sdk/include/opentelemetry/sdk/metrics/meter_provider.h +++ b/sdk/include/opentelemetry/sdk/metrics/meter_provider.h @@ -2,17 +2,17 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include -# include -# include -# include "opentelemetry/metrics/meter.h" -# include "opentelemetry/metrics/meter_provider.h" -# include "opentelemetry/nostd/shared_ptr.h" -# include "opentelemetry/sdk/metrics/meter.h" -# include "opentelemetry/sdk/metrics/meter_context.h" -# include "opentelemetry/sdk/resource/resource.h" -# include "opentelemetry/version.h" + +#include +#include +#include +#include "opentelemetry/metrics/meter.h" +#include "opentelemetry/metrics/meter_provider.h" +#include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/sdk/metrics/meter.h" +#include "opentelemetry/sdk/metrics/meter_context.h" +#include "opentelemetry/sdk/resource/resource.h" +#include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -94,4 +94,3 @@ class MeterProvider final : public opentelemetry::metrics::MeterProvider } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/metrics/metric_reader.h b/sdk/include/opentelemetry/sdk/metrics/metric_reader.h index 5d78c4b388..d7d6bcbd39 100644 --- a/sdk/include/opentelemetry/sdk/metrics/metric_reader.h +++ b/sdk/include/opentelemetry/sdk/metrics/metric_reader.h @@ -2,16 +2,16 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/common/spin_lock_mutex.h" -# include "opentelemetry/sdk/common/global_log_handler.h" -# include "opentelemetry/sdk/metrics/data/metric_data.h" -# include "opentelemetry/sdk/metrics/export/metric_producer.h" -# include "opentelemetry/sdk/metrics/instruments.h" -# include "opentelemetry/version.h" -# include -# include +#include "opentelemetry/common/spin_lock_mutex.h" +#include "opentelemetry/sdk/common/global_log_handler.h" +#include "opentelemetry/sdk/metrics/data/metric_data.h" +#include "opentelemetry/sdk/metrics/export/metric_producer.h" +#include "opentelemetry/sdk/metrics/instruments.h" +#include "opentelemetry/version.h" + +#include +#include OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -74,4 +74,3 @@ class MetricReader } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/metrics/observer_result.h b/sdk/include/opentelemetry/sdk/metrics/observer_result.h index e4f2a4887e..4b6a55e3bc 100644 --- a/sdk/include/opentelemetry/sdk/metrics/observer_result.h +++ b/sdk/include/opentelemetry/sdk/metrics/observer_result.h @@ -2,13 +2,13 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/common/key_value_iterable.h" -# include "opentelemetry/metrics/observer_result.h" -# include "opentelemetry/sdk/metrics/state/attributes_hashmap.h" -# include "opentelemetry/sdk/metrics/view/attributes_processor.h" -# include +#include "opentelemetry/common/key_value_iterable.h" +#include "opentelemetry/metrics/observer_result.h" +#include "opentelemetry/sdk/metrics/state/attributes_hashmap.h" +#include "opentelemetry/sdk/metrics/view/attributes_processor.h" + +#include OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -53,4 +53,3 @@ class ObserverResultT final : public opentelemetry::metrics::ObserverResultT } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/metrics/push_metric_exporter.h b/sdk/include/opentelemetry/sdk/metrics/push_metric_exporter.h index 5c5b85931f..58e2c68c62 100644 --- a/sdk/include/opentelemetry/sdk/metrics/push_metric_exporter.h +++ b/sdk/include/opentelemetry/sdk/metrics/push_metric_exporter.h @@ -2,15 +2,14 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/nostd/span.h" -# include "opentelemetry/sdk/common/exporter_utils.h" -# include "opentelemetry/sdk/metrics/export/metric_producer.h" -# include "opentelemetry/version.h" +#include "opentelemetry/nostd/span.h" +#include "opentelemetry/sdk/common/exporter_utils.h" +#include "opentelemetry/sdk/metrics/export/metric_producer.h" +#include "opentelemetry/version.h" -# include -# include +#include +#include OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -60,4 +59,3 @@ class PushMetricExporter } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/metrics/state/async_metric_storage.h b/sdk/include/opentelemetry/sdk/metrics/state/async_metric_storage.h index 82b5d385db..69920547ba 100644 --- a/sdk/include/opentelemetry/sdk/metrics/state/async_metric_storage.h +++ b/sdk/include/opentelemetry/sdk/metrics/state/async_metric_storage.h @@ -2,19 +2,19 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/nostd/shared_ptr.h" -# include "opentelemetry/sdk/common/attributemap_hash.h" -# include "opentelemetry/sdk/metrics/aggregation/default_aggregation.h" -# include "opentelemetry/sdk/metrics/instruments.h" -# include "opentelemetry/sdk/metrics/observer_result.h" -# include "opentelemetry/sdk/metrics/state/attributes_hashmap.h" -# include "opentelemetry/sdk/metrics/state/metric_collector.h" -# include "opentelemetry/sdk/metrics/state/metric_storage.h" -# include "opentelemetry/sdk/metrics/state/temporal_metric_storage.h" -# include "opentelemetry/sdk/metrics/view/attributes_processor.h" -# include +#include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/sdk/common/attributemap_hash.h" +#include "opentelemetry/sdk/metrics/aggregation/default_aggregation.h" +#include "opentelemetry/sdk/metrics/instruments.h" +#include "opentelemetry/sdk/metrics/observer_result.h" +#include "opentelemetry/sdk/metrics/state/attributes_hashmap.h" +#include "opentelemetry/sdk/metrics/state/metric_collector.h" +#include "opentelemetry/sdk/metrics/state/metric_storage.h" +#include "opentelemetry/sdk/metrics/state/temporal_metric_storage.h" +#include "opentelemetry/sdk/metrics/view/attributes_processor.h" + +#include OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -127,4 +127,3 @@ class AsyncMetricStorage : public MetricStorage, public AsyncWritableMetricStora } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/metrics/state/attributes_hashmap.h b/sdk/include/opentelemetry/sdk/metrics/state/attributes_hashmap.h index 2f93b32f66..5b575fd024 100644 --- a/sdk/include/opentelemetry/sdk/metrics/state/attributes_hashmap.h +++ b/sdk/include/opentelemetry/sdk/metrics/state/attributes_hashmap.h @@ -2,17 +2,17 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/nostd/function_ref.h" -# include "opentelemetry/sdk/common/attribute_utils.h" -# include "opentelemetry/sdk/common/attributemap_hash.h" -# include "opentelemetry/sdk/metrics/aggregation/aggregation.h" -# include "opentelemetry/sdk/metrics/instruments.h" -# include "opentelemetry/version.h" -# include -# include -# include +#include "opentelemetry/nostd/function_ref.h" +#include "opentelemetry/sdk/common/attribute_utils.h" +#include "opentelemetry/sdk/common/attributemap_hash.h" +#include "opentelemetry/sdk/metrics/aggregation/aggregation.h" +#include "opentelemetry/sdk/metrics/instruments.h" +#include "opentelemetry/version.h" + +#include +#include +#include OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -107,4 +107,3 @@ class AttributesHashMap } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/metrics/state/metric_collector.h b/sdk/include/opentelemetry/sdk/metrics/state/metric_collector.h index 5164aafe59..95cd8a7d10 100644 --- a/sdk/include/opentelemetry/sdk/metrics/state/metric_collector.h +++ b/sdk/include/opentelemetry/sdk/metrics/state/metric_collector.h @@ -2,9 +2,9 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/sdk/metrics/data/metric_data.h" -# include "opentelemetry/sdk/metrics/export/metric_producer.h" + +#include "opentelemetry/sdk/metrics/data/metric_data.h" +#include "opentelemetry/sdk/metrics/export/metric_producer.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -60,4 +60,3 @@ class MetricCollector : public MetricProducer, public CollectorHandle } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/metrics/state/metric_storage.h b/sdk/include/opentelemetry/sdk/metrics/state/metric_storage.h index b85854358e..0f8f4ddba7 100644 --- a/sdk/include/opentelemetry/sdk/metrics/state/metric_storage.h +++ b/sdk/include/opentelemetry/sdk/metrics/state/metric_storage.h @@ -2,13 +2,13 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/common/key_value_iterable_view.h" -# include "opentelemetry/common/timestamp.h" -# include "opentelemetry/context/context.h" -# include "opentelemetry/sdk/metrics/data/metric_data.h" -# include "opentelemetry/sdk/metrics/instruments.h" -# include "opentelemetry/sdk/metrics/state/attributes_hashmap.h" + +#include "opentelemetry/common/key_value_iterable_view.h" +#include "opentelemetry/common/timestamp.h" +#include "opentelemetry/context/context.h" +#include "opentelemetry/sdk/metrics/data/metric_data.h" +#include "opentelemetry/sdk/metrics/instruments.h" +#include "opentelemetry/sdk/metrics/state/attributes_hashmap.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -123,4 +123,3 @@ class NoopAsyncWritableMetricStorage : public AsyncWritableMetricStorage } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/metrics/state/multi_metric_storage.h b/sdk/include/opentelemetry/sdk/metrics/state/multi_metric_storage.h index 740261a0c2..421c12b34c 100644 --- a/sdk/include/opentelemetry/sdk/metrics/state/multi_metric_storage.h +++ b/sdk/include/opentelemetry/sdk/metrics/state/multi_metric_storage.h @@ -2,12 +2,12 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/common/key_value_iterable_view.h" -# include "opentelemetry/sdk/metrics/instruments.h" -# include "opentelemetry/sdk/metrics/state/metric_storage.h" -# include +#include "opentelemetry/common/key_value_iterable_view.h" +#include "opentelemetry/sdk/metrics/instruments.h" +#include "opentelemetry/sdk/metrics/state/metric_storage.h" + +#include OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -100,4 +100,3 @@ class AsyncMultiMetricStorage : public AsyncWritableMetricStorage } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/metrics/state/observable_registry.h b/sdk/include/opentelemetry/sdk/metrics/state/observable_registry.h index bf76145f03..09c439afa4 100644 --- a/sdk/include/opentelemetry/sdk/metrics/state/observable_registry.h +++ b/sdk/include/opentelemetry/sdk/metrics/state/observable_registry.h @@ -2,14 +2,13 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/common/timestamp.h" -# include "opentelemetry/metrics/async_instruments.h" +#include "opentelemetry/common/timestamp.h" +#include "opentelemetry/metrics/async_instruments.h" -# include -# include -# include +#include +#include +#include OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -45,4 +44,3 @@ class ObservableRegistry } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/metrics/state/sync_metric_storage.h b/sdk/include/opentelemetry/sdk/metrics/state/sync_metric_storage.h index f6af1f036f..c6a78451af 100644 --- a/sdk/include/opentelemetry/sdk/metrics/state/sync_metric_storage.h +++ b/sdk/include/opentelemetry/sdk/metrics/state/sync_metric_storage.h @@ -2,21 +2,21 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include -# include "opentelemetry/common/key_value_iterable_view.h" -# include "opentelemetry/sdk/common/attributemap_hash.h" -# include "opentelemetry/sdk/metrics/aggregation/default_aggregation.h" -# include "opentelemetry/sdk/metrics/exemplar/reservoir.h" -# include "opentelemetry/sdk/metrics/state/attributes_hashmap.h" -# include "opentelemetry/sdk/metrics/state/metric_collector.h" -# include "opentelemetry/sdk/metrics/state/metric_storage.h" -# include "opentelemetry/sdk/metrics/state/temporal_metric_storage.h" -# include "opentelemetry/sdk/metrics/view/attributes_processor.h" +#include +#include "opentelemetry/common/key_value_iterable_view.h" +#include "opentelemetry/sdk/common/attributemap_hash.h" +#include "opentelemetry/sdk/metrics/aggregation/default_aggregation.h" +#include "opentelemetry/sdk/metrics/exemplar/reservoir.h" +#include "opentelemetry/sdk/metrics/state/attributes_hashmap.h" +#include "opentelemetry/sdk/metrics/state/metric_collector.h" +#include "opentelemetry/sdk/metrics/state/metric_storage.h" -# include -# include +#include "opentelemetry/sdk/metrics/state/temporal_metric_storage.h" +#include "opentelemetry/sdk/metrics/view/attributes_processor.h" + +#include +#include OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -36,9 +36,9 @@ class SyncMetricStorage : public MetricStorage, public SyncWritableMetricStorage aggregation_type_{aggregation_type}, attributes_hashmap_(new AttributesHashMap()), attributes_processor_{attributes_processor}, -# ifdef ENABLE_METRICS_EXEMPLAR_PREVIEW +#ifdef ENABLE_METRICS_EXEMPLAR_PREVIEW exemplar_reservoir_(exemplar_reservoir), -# endif +#endif temporal_metric_storage_(instrument_descriptor, aggregation_config) { @@ -54,9 +54,9 @@ class SyncMetricStorage : public MetricStorage, public SyncWritableMetricStorage { return; } -# ifdef ENABLE_METRICS_EXEMPLAR_PREVIEW +#ifdef ENABLE_METRICS_EXEMPLAR_PREVIEW exemplar_reservoir_->OfferMeasurement(value, {}, context, std::chrono::system_clock::now()); -# endif +#endif std::lock_guard guard(attribute_hashmap_lock_); attributes_hashmap_->GetOrSetDefault({}, create_default_aggregation_)->Aggregate(value); } @@ -69,10 +69,10 @@ class SyncMetricStorage : public MetricStorage, public SyncWritableMetricStorage { return; } -# ifdef ENABLE_METRICS_EXEMPLAR_PREVIEW +#ifdef ENABLE_METRICS_EXEMPLAR_PREVIEW exemplar_reservoir_->OfferMeasurement(value, attributes, context, std::chrono::system_clock::now()); -# endif +#endif auto attr = attributes_processor_->process(attributes); std::lock_guard guard(attribute_hashmap_lock_); attributes_hashmap_->GetOrSetDefault(attr, create_default_aggregation_)->Aggregate(value); @@ -84,9 +84,9 @@ class SyncMetricStorage : public MetricStorage, public SyncWritableMetricStorage { return; } -# ifdef ENABLE_METRICS_EXEMPLAR_PREVIEW +#ifdef ENABLE_METRICS_EXEMPLAR_PREVIEW exemplar_reservoir_->OfferMeasurement(value, {}, context, std::chrono::system_clock::now()); -# endif +#endif std::lock_guard guard(attribute_hashmap_lock_); attributes_hashmap_->GetOrSetDefault({}, create_default_aggregation_)->Aggregate(value); } @@ -95,18 +95,18 @@ class SyncMetricStorage : public MetricStorage, public SyncWritableMetricStorage const opentelemetry::common::KeyValueIterable &attributes, const opentelemetry::context::Context &context) noexcept override { -# ifdef ENABLE_METRICS_EXEMPLAR_PREVIEW +#ifdef ENABLE_METRICS_EXEMPLAR_PREVIEW exemplar_reservoir_->OfferMeasurement(value, attributes, context, std::chrono::system_clock::now()); -# endif +#endif if (instrument_descriptor_.value_type_ != InstrumentValueType::kDouble) { return; } -# ifdef ENABLE_METRICS_EXEMPLAR_PREVIEW +#ifdef ENABLE_METRICS_EXEMPLAR_PREVIEW exemplar_reservoir_->OfferMeasurement(value, attributes, context, std::chrono::system_clock::now()); -# endif +#endif auto attr = attributes_processor_->process(attributes); std::lock_guard guard(attribute_hashmap_lock_); attributes_hashmap_->GetOrSetDefault(attr, create_default_aggregation_)->Aggregate(value); @@ -131,9 +131,9 @@ class SyncMetricStorage : public MetricStorage, public SyncWritableMetricStorage std::unordered_map last_reported_metrics_; const AttributesProcessor *attributes_processor_; std::function()> create_default_aggregation_; -# ifdef ENABLE_METRICS_EXEMPLAR_PREVIEW +#ifdef ENABLE_METRICS_EXEMPLAR_PREVIEW nostd::shared_ptr exemplar_reservoir_; -# endif +#endif TemporalMetricStorage temporal_metric_storage_; opentelemetry::common::SpinLockMutex attribute_hashmap_lock_; }; @@ -141,4 +141,3 @@ class SyncMetricStorage : public MetricStorage, public SyncWritableMetricStorage } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/metrics/state/temporal_metric_storage.h b/sdk/include/opentelemetry/sdk/metrics/state/temporal_metric_storage.h index 5cb556ae20..439ca3cd4d 100644 --- a/sdk/include/opentelemetry/sdk/metrics/state/temporal_metric_storage.h +++ b/sdk/include/opentelemetry/sdk/metrics/state/temporal_metric_storage.h @@ -2,13 +2,13 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/nostd/shared_ptr.h" -# include "opentelemetry/sdk/metrics/aggregation/default_aggregation.h" -# include "opentelemetry/sdk/metrics/state/attributes_hashmap.h" -# include "opentelemetry/sdk/metrics/state/metric_collector.h" -# include +#include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/sdk/metrics/aggregation/default_aggregation.h" +#include "opentelemetry/sdk/metrics/state/attributes_hashmap.h" +#include "opentelemetry/sdk/metrics/state/metric_collector.h" + +#include OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -51,4 +51,3 @@ class TemporalMetricStorage } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/metrics/sync_instruments.h b/sdk/include/opentelemetry/sdk/metrics/sync_instruments.h index 8e2f420598..803191170c 100644 --- a/sdk/include/opentelemetry/sdk/metrics/sync_instruments.h +++ b/sdk/include/opentelemetry/sdk/metrics/sync_instruments.h @@ -2,15 +2,15 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/common/key_value_iterable.h" -# include "opentelemetry/metrics/sync_instruments.h" -# include "opentelemetry/nostd/string_view.h" -# include "opentelemetry/sdk/metrics/instruments.h" -# include "opentelemetry/sdk/metrics/state/metric_storage.h" -# include "opentelemetry/sdk_config.h" -# include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h" +#include "opentelemetry/common/key_value_iterable.h" +#include "opentelemetry/metrics/sync_instruments.h" +#include "opentelemetry/nostd/string_view.h" +#include "opentelemetry/sdk/metrics/instruments.h" +#include "opentelemetry/sdk/metrics/state/metric_storage.h" +#include "opentelemetry/sdk_config.h" + +#include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -200,4 +200,3 @@ class DoubleHistogram : public Synchronous, public opentelemetry::metrics::Histo } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/metrics/view/attributes_processor.h b/sdk/include/opentelemetry/sdk/metrics/view/attributes_processor.h index d6d536454c..754f45e1b6 100644 --- a/sdk/include/opentelemetry/sdk/metrics/view/attributes_processor.h +++ b/sdk/include/opentelemetry/sdk/metrics/view/attributes_processor.h @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/sdk/common/attribute_utils.h" + +#include "opentelemetry/sdk/common/attribute_utils.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk { @@ -77,4 +77,3 @@ class FilteringAttributesProcessor : public AttributesProcessor } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/metrics/view/instrument_selector.h b/sdk/include/opentelemetry/sdk/metrics/view/instrument_selector.h index 24c347ffa9..a8cf38b49f 100644 --- a/sdk/include/opentelemetry/sdk/metrics/view/instrument_selector.h +++ b/sdk/include/opentelemetry/sdk/metrics/view/instrument_selector.h @@ -2,10 +2,10 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/nostd/string_view.h" -# include "opentelemetry/sdk/metrics/instruments.h" -# include "opentelemetry/sdk/metrics/view/predicate_factory.h" + +#include "opentelemetry/nostd/string_view.h" +#include "opentelemetry/sdk/metrics/instruments.h" +#include "opentelemetry/sdk/metrics/view/predicate_factory.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk { @@ -33,4 +33,3 @@ class InstrumentSelector } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/metrics/view/meter_selector.h b/sdk/include/opentelemetry/sdk/metrics/view/meter_selector.h index ff3fd6afc4..de61d21412 100644 --- a/sdk/include/opentelemetry/sdk/metrics/view/meter_selector.h +++ b/sdk/include/opentelemetry/sdk/metrics/view/meter_selector.h @@ -2,9 +2,10 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once + #include "opentelemetry/nostd/string_view.h" #include "opentelemetry/sdk/metrics/view/predicate_factory.h" -#ifndef ENABLE_METRICS_PREVIEW + OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk { @@ -44,4 +45,3 @@ class MeterSelector } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/metrics/view/predicate.h b/sdk/include/opentelemetry/sdk/metrics/view/predicate.h index b60a338b7f..b5dafcf51a 100644 --- a/sdk/include/opentelemetry/sdk/metrics/view/predicate.h +++ b/sdk/include/opentelemetry/sdk/metrics/view/predicate.h @@ -2,11 +2,11 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include -# include "opentelemetry/common/macros.h" -# include "opentelemetry/nostd/string_view.h" -# include "opentelemetry/sdk/common/global_log_handler.h" + +#include +#include "opentelemetry/common/macros.h" +#include "opentelemetry/nostd/string_view.h" +#include "opentelemetry/sdk/common/global_log_handler.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -26,22 +26,22 @@ class PatternPredicate : public Predicate PatternPredicate(opentelemetry::nostd::string_view pattern) : reg_key_{pattern.data()} {} bool Match(opentelemetry::nostd::string_view str) const noexcept override { -# if HAVE_WORKING_REGEX +#if HAVE_WORKING_REGEX return std::regex_match(str.data(), reg_key_); -# else +#else // TBD - Support regex match for GCC4.8 OTEL_INTERNAL_LOG_ERROR( "PatternPredicate::Match - failed. std::regex not fully supported for this compiler."); return false; // not supported -# endif +#endif } private: -# if HAVE_WORKING_REGEX +#if HAVE_WORKING_REGEX std::regex reg_key_; -# else +#else std::string reg_key_; -# endif +#endif }; class ExactPredicate : public Predicate @@ -73,4 +73,3 @@ class MatchNothingPattern : public Predicate } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/metrics/view/predicate_factory.h b/sdk/include/opentelemetry/sdk/metrics/view/predicate_factory.h index 1240d7c819..7df3955873 100644 --- a/sdk/include/opentelemetry/sdk/metrics/view/predicate_factory.h +++ b/sdk/include/opentelemetry/sdk/metrics/view/predicate_factory.h @@ -2,9 +2,10 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once + #include "opentelemetry/nostd/string_view.h" #include "opentelemetry/sdk/metrics/view/predicate.h" -#ifndef ENABLE_METRICS_PREVIEW + OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk { @@ -42,4 +43,3 @@ class PredicateFactory } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/metrics/view/view.h b/sdk/include/opentelemetry/sdk/metrics/view/view.h index 7f2ca0e2b2..678c53f6c6 100644 --- a/sdk/include/opentelemetry/sdk/metrics/view/view.h +++ b/sdk/include/opentelemetry/sdk/metrics/view/view.h @@ -2,13 +2,13 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/nostd/shared_ptr.h" -# include "opentelemetry/nostd/string_view.h" -# include "opentelemetry/sdk/metrics/aggregation/aggregation_config.h" -# include "opentelemetry/sdk/metrics/aggregation/default_aggregation.h" -# include "opentelemetry/sdk/metrics/instruments.h" -# include "opentelemetry/sdk/metrics/view/attributes_processor.h" + +#include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/nostd/string_view.h" +#include "opentelemetry/sdk/metrics/aggregation/aggregation_config.h" +#include "opentelemetry/sdk/metrics/aggregation/default_aggregation.h" +#include "opentelemetry/sdk/metrics/instruments.h" +#include "opentelemetry/sdk/metrics/view/attributes_processor.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -66,4 +66,3 @@ class View } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/include/opentelemetry/sdk/metrics/view/view_registry.h b/sdk/include/opentelemetry/sdk/metrics/view/view_registry.h index dedd154b1c..87773b2091 100644 --- a/sdk/include/opentelemetry/sdk/metrics/view/view_registry.h +++ b/sdk/include/opentelemetry/sdk/metrics/view/view_registry.h @@ -2,12 +2,12 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#ifndef ENABLE_METRICS_PREVIEW -# include -# include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h" -# include "opentelemetry/sdk/metrics/view/instrument_selector.h" -# include "opentelemetry/sdk/metrics/view/meter_selector.h" -# include "opentelemetry/sdk/metrics/view/view.h" + +#include +#include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h" +#include "opentelemetry/sdk/metrics/view/instrument_selector.h" +#include "opentelemetry/sdk/metrics/view/meter_selector.h" +#include "opentelemetry/sdk/metrics/view/view.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -99,4 +99,3 @@ class ViewRegistry } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/src/CMakeLists.txt b/sdk/src/CMakeLists.txt index aab294b6de..5fe55165c9 100644 --- a/sdk/src/CMakeLists.txt +++ b/sdk/src/CMakeLists.txt @@ -1,10 +1,6 @@ add_subdirectory(common) add_subdirectory(trace) -if(WITH_METRICS_PREVIEW) - add_subdirectory(_metrics) -else() - add_subdirectory(metrics) -endif() +add_subdirectory(metrics) if(WITH_LOGS_PREVIEW) add_subdirectory(logs) endif() diff --git a/sdk/src/metrics/aggregation/histogram_aggregation.cc b/sdk/src/metrics/aggregation/histogram_aggregation.cc index b8bbb190d3..60dcc36827 100644 --- a/sdk/src/metrics/aggregation/histogram_aggregation.cc +++ b/sdk/src/metrics/aggregation/histogram_aggregation.cc @@ -1,15 +1,14 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/sdk/metrics/aggregation/histogram_aggregation.h" -# include -# include -# include -# include -# include "opentelemetry/version.h" - -# include +#include "opentelemetry/sdk/metrics/aggregation/histogram_aggregation.h" +#include +#include +#include +#include +#include "opentelemetry/version.h" + +#include OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk { @@ -190,4 +189,3 @@ PointType DoubleHistogramAggregation::ToPoint() const noexcept } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/src/metrics/aggregation/lastvalue_aggregation.cc b/sdk/src/metrics/aggregation/lastvalue_aggregation.cc index 17ccbbd726..d6b89acde8 100644 --- a/sdk/src/metrics/aggregation/lastvalue_aggregation.cc +++ b/sdk/src/metrics/aggregation/lastvalue_aggregation.cc @@ -1,12 +1,11 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/sdk/metrics/aggregation/lastvalue_aggregation.h" -# include "opentelemetry/common/timestamp.h" -# include "opentelemetry/version.h" +#include "opentelemetry/sdk/metrics/aggregation/lastvalue_aggregation.h" +#include "opentelemetry/common/timestamp.h" +#include "opentelemetry/version.h" -# include +#include OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -137,4 +136,3 @@ PointType DoubleLastValueAggregation::ToPoint() const noexcept } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/src/metrics/aggregation/sum_aggregation.cc b/sdk/src/metrics/aggregation/sum_aggregation.cc index eab53a49c2..f3c88ad13c 100644 --- a/sdk/src/metrics/aggregation/sum_aggregation.cc +++ b/sdk/src/metrics/aggregation/sum_aggregation.cc @@ -1,14 +1,13 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/sdk/metrics/aggregation/sum_aggregation.h" -# include "opentelemetry/sdk/common/global_log_handler.h" -# include "opentelemetry/sdk/metrics/data/point_data.h" -# include "opentelemetry/version.h" +#include "opentelemetry/sdk/metrics/aggregation/sum_aggregation.h" +#include "opentelemetry/sdk/common/global_log_handler.h" +#include "opentelemetry/sdk/metrics/data/point_data.h" +#include "opentelemetry/version.h" -# include -# include +#include +#include OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -128,4 +127,3 @@ PointType DoubleSumAggregation::ToPoint() const noexcept } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/src/metrics/async_instruments.cc b/sdk/src/metrics/async_instruments.cc index 916ca765af..1d2b1a9552 100644 --- a/sdk/src/metrics/async_instruments.cc +++ b/sdk/src/metrics/async_instruments.cc @@ -1,12 +1,11 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/sdk/metrics/async_instruments.h" -# include "opentelemetry/sdk/metrics/state/metric_storage.h" -# include "opentelemetry/sdk_config.h" +#include "opentelemetry/sdk/metrics/async_instruments.h" +#include "opentelemetry/sdk/metrics/state/metric_storage.h" +#include "opentelemetry/sdk_config.h" -# include +#include OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -48,4 +47,3 @@ AsyncWritableMetricStorage *ObservableInstrument::GetMetricStorage() } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/src/metrics/exemplar/filter.cc b/sdk/src/metrics/exemplar/filter.cc index 89d89b37a3..d74f024858 100644 --- a/sdk/src/metrics/exemplar/filter.cc +++ b/sdk/src/metrics/exemplar/filter.cc @@ -1,11 +1,10 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/sdk/metrics/exemplar/filter.h" -# include "opentelemetry/sdk/metrics/exemplar/always_sample_filter.h" -# include "opentelemetry/sdk/metrics/exemplar/never_sample_filter.h" -# include "opentelemetry/sdk/metrics/exemplar/with_trace_sample_filter.h" +#include "opentelemetry/sdk/metrics/exemplar/filter.h" +#include "opentelemetry/sdk/metrics/exemplar/always_sample_filter.h" +#include "opentelemetry/sdk/metrics/exemplar/never_sample_filter.h" +#include "opentelemetry/sdk/metrics/exemplar/with_trace_sample_filter.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -34,4 +33,3 @@ std::shared_ptr ExemplarFilter::GetWithTraceSampleFilter() noexc } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/src/metrics/exemplar/reservoir.cc b/sdk/src/metrics/exemplar/reservoir.cc index 6209d91e80..b6f62a9885 100644 --- a/sdk/src/metrics/exemplar/reservoir.cc +++ b/sdk/src/metrics/exemplar/reservoir.cc @@ -1,14 +1,13 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/sdk/metrics/exemplar/reservoir.h" -# include -# include "opentelemetry/sdk/metrics/exemplar/filtered_exemplar_reservoir.h" -# include "opentelemetry/sdk/metrics/exemplar/fixed_size_exemplar_reservoir.h" -# include "opentelemetry/sdk/metrics/exemplar/histogram_exemplar_reservoir.h" -# include "opentelemetry/sdk/metrics/exemplar/no_exemplar_reservoir.h" -# include "opentelemetry/sdk/metrics/exemplar/reservoir_cell.h" +#include "opentelemetry/sdk/metrics/exemplar/reservoir.h" +#include +#include "opentelemetry/sdk/metrics/exemplar/filtered_exemplar_reservoir.h" +#include "opentelemetry/sdk/metrics/exemplar/fixed_size_exemplar_reservoir.h" +#include "opentelemetry/sdk/metrics/exemplar/histogram_exemplar_reservoir.h" +#include "opentelemetry/sdk/metrics/exemplar/no_exemplar_reservoir.h" +#include "opentelemetry/sdk/metrics/exemplar/reservoir_cell.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -41,4 +40,3 @@ nostd::shared_ptr ExemplarReservoir::GetNoExemplarReservoir() } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/src/metrics/export/periodic_exporting_metric_reader.cc b/sdk/src/metrics/export/periodic_exporting_metric_reader.cc index eab145ecae..4220509b74 100644 --- a/sdk/src/metrics/export/periodic_exporting_metric_reader.cc +++ b/sdk/src/metrics/export/periodic_exporting_metric_reader.cc @@ -1,13 +1,12 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/sdk/metrics/export/periodic_exporting_metric_reader.h" -# include "opentelemetry/sdk/common/global_log_handler.h" -# include "opentelemetry/sdk/metrics/push_metric_exporter.h" +#include "opentelemetry/sdk/metrics/export/periodic_exporting_metric_reader.h" +#include "opentelemetry/sdk/common/global_log_handler.h" +#include "opentelemetry/sdk/metrics/push_metric_exporter.h" -# include -# include +#include +#include OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -101,4 +100,3 @@ bool PeriodicExportingMetricReader::OnShutDown(std::chrono::microseconds timeout } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/src/metrics/instrument_metadata_validator.cc b/sdk/src/metrics/instrument_metadata_validator.cc index 8dd0930e77..50ee98e68a 100644 --- a/sdk/src/metrics/instrument_metadata_validator.cc +++ b/sdk/src/metrics/instrument_metadata_validator.cc @@ -1,13 +1,12 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/sdk/metrics/instrument_metadata_validator.h" -# include "opentelemetry/common/macros.h" -# include "opentelemetry/nostd/string_view.h" +#include "opentelemetry/sdk/metrics/instrument_metadata_validator.h" +#include "opentelemetry/common/macros.h" +#include "opentelemetry/nostd/string_view.h" -# include -# include +#include +#include OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -21,20 +20,20 @@ const std::string kInstrumentUnitPattern = "[\x01-\x7F]{0,63}"; // instrument-unit = It can have a maximum length of 63 ASCII chars InstrumentMetaDataValidator::InstrumentMetaDataValidator() -# if HAVE_WORKING_REGEX +#if HAVE_WORKING_REGEX // clang-format off : name_reg_key_{kInstrumentNamePattern}, unit_reg_key_{kInstrumentUnitPattern} // clang-format on -# endif +#endif {} bool InstrumentMetaDataValidator::ValidateName(nostd::string_view name) const { -# if HAVE_WORKING_REGEX +#if HAVE_WORKING_REGEX return std::regex_match(name.data(), name_reg_key_); -# else +#else const size_t kMaxSize = 63; // size atmost 63 chars if (name.size() > kMaxSize) @@ -49,14 +48,14 @@ bool InstrumentMetaDataValidator::ValidateName(nostd::string_view name) const // subsequent chars should be either of alphabets, digits, underscore, minus, dot return !std::any_of(std::next(name.begin()), name.end(), [](char c) { return !isalnum(c) && c != '-' && c != '_' && c != '.'; }); -# endif +#endif } bool InstrumentMetaDataValidator::ValidateUnit(nostd::string_view unit) const { -# if HAVE_WORKING_REGEX +#if HAVE_WORKING_REGEX return std::regex_match(unit.data(), unit_reg_key_); -# else +#else const size_t kMaxSize = 63; // length atmost 63 chars if (unit.size() > kMaxSize) @@ -66,7 +65,7 @@ bool InstrumentMetaDataValidator::ValidateUnit(nostd::string_view unit) const // all should be ascii chars. return !std::any_of(unit.begin(), unit.end(), [](char c) { return static_cast(c) > 127; }); -# endif +#endif } bool InstrumentMetaDataValidator::ValidateDescription(nostd::string_view /*description*/) const @@ -77,4 +76,3 @@ bool InstrumentMetaDataValidator::ValidateDescription(nostd::string_view /*descr } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/src/metrics/meter.cc b/sdk/src/metrics/meter.cc index e5848e8619..feae7fd3b8 100644 --- a/sdk/src/metrics/meter.cc +++ b/sdk/src/metrics/meter.cc @@ -1,22 +1,21 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/sdk/metrics/meter.h" -# include -# include "opentelemetry/metrics/noop.h" -# include "opentelemetry/nostd/shared_ptr.h" -# include "opentelemetry/sdk/metrics/async_instruments.h" -# include "opentelemetry/sdk/metrics/exemplar/histogram_exemplar_reservoir.h" -# include "opentelemetry/sdk/metrics/state/multi_metric_storage.h" -# include "opentelemetry/sdk/metrics/state/observable_registry.h" -# include "opentelemetry/sdk/metrics/state/sync_metric_storage.h" +#include "opentelemetry/sdk/metrics/meter.h" +#include +#include "opentelemetry/metrics/noop.h" +#include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/sdk/metrics/async_instruments.h" +#include "opentelemetry/sdk/metrics/exemplar/histogram_exemplar_reservoir.h" +#include "opentelemetry/sdk/metrics/state/multi_metric_storage.h" +#include "opentelemetry/sdk/metrics/state/observable_registry.h" +#include "opentelemetry/sdk/metrics/state/sync_metric_storage.h" -# include "opentelemetry/sdk/common/global_log_handler.h" -# include "opentelemetry/sdk/metrics/sync_instruments.h" -# include "opentelemetry/sdk_config.h" +#include "opentelemetry/sdk/common/global_log_handler.h" +#include "opentelemetry/sdk/metrics/sync_instruments.h" +#include "opentelemetry/sdk_config.h" -# include +#include OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -412,4 +411,3 @@ std::vector Meter::Collect(CollectorHandle *collector, } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/src/metrics/meter_context.cc b/sdk/src/metrics/meter_context.cc index 581a6b1b93..497340145b 100644 --- a/sdk/src/metrics/meter_context.cc +++ b/sdk/src/metrics/meter_context.cc @@ -1,12 +1,11 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/sdk/metrics/meter_context.h" -# include "opentelemetry/sdk/common/global_log_handler.h" -# include "opentelemetry/sdk/metrics/metric_reader.h" -# include "opentelemetry/sdk_config.h" -# include "opentelemetry/version.h" +#include "opentelemetry/sdk/metrics/meter_context.h" +#include "opentelemetry/sdk/common/global_log_handler.h" +#include "opentelemetry/sdk/metrics/metric_reader.h" +#include "opentelemetry/sdk_config.h" +#include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -145,4 +144,3 @@ bool MeterContext::ForceFlush(std::chrono::microseconds timeout) noexcept } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/src/metrics/meter_provider.cc b/sdk/src/metrics/meter_provider.cc index 1114f73537..6a06f9d2d8 100644 --- a/sdk/src/metrics/meter_provider.cc +++ b/sdk/src/metrics/meter_provider.cc @@ -1,16 +1,15 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/sdk/metrics/meter_provider.h" -# include "opentelemetry/metrics/meter.h" -# include "opentelemetry/sdk/metrics/metric_reader.h" +#include "opentelemetry/sdk/metrics/meter_provider.h" +#include "opentelemetry/metrics/meter.h" +#include "opentelemetry/sdk/metrics/metric_reader.h" -# include "opentelemetry/sdk/common/global_log_handler.h" -# include "opentelemetry/sdk_config.h" -# include "opentelemetry/version.h" +#include "opentelemetry/sdk/common/global_log_handler.h" +#include "opentelemetry/sdk_config.h" +#include "opentelemetry/version.h" -# include +#include OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -103,4 +102,3 @@ MeterProvider::~MeterProvider() } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/src/metrics/metric_reader.cc b/sdk/src/metrics/metric_reader.cc index 6960e9a6fa..9ac7fc21ba 100644 --- a/sdk/src/metrics/metric_reader.cc +++ b/sdk/src/metrics/metric_reader.cc @@ -1,11 +1,10 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/sdk/metrics/metric_reader.h" -# include "opentelemetry/sdk/metrics/export/metric_producer.h" +#include "opentelemetry/sdk/metrics/metric_reader.h" +#include "opentelemetry/sdk/metrics/export/metric_producer.h" -# include +#include OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -84,4 +83,3 @@ bool MetricReader::IsShutdown() const noexcept } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/src/metrics/state/metric_collector.cc b/sdk/src/metrics/state/metric_collector.cc index fd61b4f782..ed14f96c7d 100644 --- a/sdk/src/metrics/state/metric_collector.cc +++ b/sdk/src/metrics/state/metric_collector.cc @@ -1,14 +1,13 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/sdk/metrics/state/metric_collector.h" -# include "opentelemetry/sdk/common/global_log_handler.h" -# include "opentelemetry/sdk/metrics/meter.h" -# include "opentelemetry/sdk/metrics/meter_context.h" -# include "opentelemetry/sdk/metrics/metric_reader.h" -# include "opentelemetry/sdk_config.h" -# include "opentelemetry/version.h" +#include "opentelemetry/sdk/metrics/state/metric_collector.h" +#include "opentelemetry/sdk/common/global_log_handler.h" +#include "opentelemetry/sdk/metrics/meter.h" +#include "opentelemetry/sdk/metrics/meter_context.h" +#include "opentelemetry/sdk/metrics/metric_reader.h" +#include "opentelemetry/sdk_config.h" +#include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -65,4 +64,3 @@ bool MetricCollector::Shutdown(std::chrono::microseconds timeout) noexcept } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/src/metrics/state/observable_registry.cc b/sdk/src/metrics/state/observable_registry.cc index 215f202916..0296167b05 100644 --- a/sdk/src/metrics/state/observable_registry.cc +++ b/sdk/src/metrics/state/observable_registry.cc @@ -1,13 +1,11 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW - -# include "opentelemetry/sdk/metrics/state/observable_registry.h" -# include "opentelemetry/sdk/metrics/async_instruments.h" -# include "opentelemetry/sdk/metrics/observer_result.h" -# include "opentelemetry/sdk/metrics/state/metric_storage.h" -# include "opentelemetry/sdk_config.h" +#include "opentelemetry/sdk/metrics/state/observable_registry.h" +#include "opentelemetry/sdk/metrics/async_instruments.h" +#include "opentelemetry/sdk/metrics/observer_result.h" +#include "opentelemetry/sdk/metrics/state/metric_storage.h" +#include "opentelemetry/sdk_config.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -84,4 +82,3 @@ void ObservableRegistry::Observe(opentelemetry::common::SystemTimestamp collecti } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/src/metrics/state/sync_metric_storage.cc b/sdk/src/metrics/state/sync_metric_storage.cc index be753ca98f..72bee72ea5 100644 --- a/sdk/src/metrics/state/sync_metric_storage.cc +++ b/sdk/src/metrics/state/sync_metric_storage.cc @@ -1,9 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW - -# include "opentelemetry/sdk/metrics/state/sync_metric_storage.h" +#include "opentelemetry/sdk/metrics/state/sync_metric_storage.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -34,4 +32,3 @@ bool SyncMetricStorage::Collect(CollectorHandle *collector, } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/src/metrics/state/temporal_metric_storage.cc b/sdk/src/metrics/state/temporal_metric_storage.cc index 0cb84aa39b..0875d86912 100644 --- a/sdk/src/metrics/state/temporal_metric_storage.cc +++ b/sdk/src/metrics/state/temporal_metric_storage.cc @@ -1,15 +1,14 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW -# include -# include -# include -# include "opentelemetry/nostd/shared_ptr.h" +#include +#include +#include +#include "opentelemetry/nostd/shared_ptr.h" -# include "opentelemetry/metrics/meter.h" -# include "opentelemetry/sdk/metrics/aggregation/default_aggregation.h" -# include "opentelemetry/sdk/metrics/state/temporal_metric_storage.h" +#include "opentelemetry/metrics/meter.h" +#include "opentelemetry/sdk/metrics/aggregation/default_aggregation.h" +#include "opentelemetry/sdk/metrics/state/temporal_metric_storage.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -137,4 +136,3 @@ bool TemporalMetricStorage::buildMetrics(CollectorHandle *collector, } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/src/metrics/sync_instruments.cc b/sdk/src/metrics/sync_instruments.cc index a39e622d78..6fe72b55bf 100644 --- a/sdk/src/metrics/sync_instruments.cc +++ b/sdk/src/metrics/sync_instruments.cc @@ -1,10 +1,9 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/sdk/metrics/sync_instruments.h" +#include "opentelemetry/sdk/metrics/sync_instruments.h" -# include +#include OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -221,4 +220,3 @@ void DoubleHistogram::Record(double value, const opentelemetry::context::Context } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/test/CMakeLists.txt b/sdk/test/CMakeLists.txt index 2527e8aac4..219455a7e7 100644 --- a/sdk/test/CMakeLists.txt +++ b/sdk/test/CMakeLists.txt @@ -1,10 +1,6 @@ add_subdirectory(common) add_subdirectory(trace) -if(WITH_METRICS_PREVIEW) - add_subdirectory(_metrics) -else() - add_subdirectory(metrics) -endif() +add_subdirectory(metrics) if(WITH_LOGS_PREVIEW) add_subdirectory(logs) endif() diff --git a/sdk/test/metrics/aggregation_test.cc b/sdk/test/metrics/aggregation_test.cc index 6e4121931c..fffe56b104 100644 --- a/sdk/test/metrics/aggregation_test.cc +++ b/sdk/test/metrics/aggregation_test.cc @@ -1,14 +1,13 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW -# include -# include "opentelemetry/sdk/metrics/aggregation/histogram_aggregation.h" -# include "opentelemetry/sdk/metrics/aggregation/lastvalue_aggregation.h" -# include "opentelemetry/sdk/metrics/aggregation/sum_aggregation.h" +#include +#include "opentelemetry/sdk/metrics/aggregation/histogram_aggregation.h" +#include "opentelemetry/sdk/metrics/aggregation/lastvalue_aggregation.h" +#include "opentelemetry/sdk/metrics/aggregation/sum_aggregation.h" -# include "opentelemetry/nostd/shared_ptr.h" -# include "opentelemetry/nostd/variant.h" +#include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/nostd/variant.h" using namespace opentelemetry::sdk::metrics; namespace nostd = opentelemetry::nostd; @@ -218,4 +217,3 @@ TEST(Aggregation, DoubleHistogramAggregation) EXPECT_EQ(histogram_data.counts_[4], 0); // aggr2(28.1) - aggr1(25.1) EXPECT_EQ(histogram_data.counts_[7], 1); // aggr2(105.0) - aggr1(0) } -#endif diff --git a/sdk/test/metrics/async_instruments_test.cc b/sdk/test/metrics/async_instruments_test.cc index b65c22f521..87d0a441d5 100644 --- a/sdk/test/metrics/async_instruments_test.cc +++ b/sdk/test/metrics/async_instruments_test.cc @@ -1,11 +1,10 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/sdk/metrics/async_instruments.h" -# include "opentelemetry/sdk/metrics/state/multi_metric_storage.h" +#include "opentelemetry/sdk/metrics/async_instruments.h" +#include "opentelemetry/sdk/metrics/state/multi_metric_storage.h" -# include +#include using namespace opentelemetry; using namespace opentelemetry::sdk::metrics; @@ -27,5 +26,3 @@ TEST(AsyncInstruments, ObservableInstrument) observable_registry); observable_counter_long.AddCallback(asyc_generate_measurements, nullptr); } - -#endif diff --git a/sdk/test/metrics/async_metric_storage_test.cc b/sdk/test/metrics/async_metric_storage_test.cc index fd4df4d7f8..b70d1bf52d 100644 --- a/sdk/test/metrics/async_metric_storage_test.cc +++ b/sdk/test/metrics/async_metric_storage_test.cc @@ -1,22 +1,21 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 +#include "opentelemetry/sdk/metrics/state/async_metric_storage.h" #include -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/common/key_value_iterable_view.h" -# include "opentelemetry/sdk/metrics/async_instruments.h" -# include "opentelemetry/sdk/metrics/instruments.h" -# include "opentelemetry/sdk/metrics/meter_context.h" -# include "opentelemetry/sdk/metrics/metric_reader.h" -# include "opentelemetry/sdk/metrics/observer_result.h" -# include "opentelemetry/sdk/metrics/push_metric_exporter.h" -# include "opentelemetry/sdk/metrics/state/async_metric_storage.h" -# include "opentelemetry/sdk/metrics/state/metric_collector.h" -# include "opentelemetry/sdk/metrics/state/observable_registry.h" - -# include -# include -# include +#include "opentelemetry/common/key_value_iterable_view.h" +#include "opentelemetry/sdk/metrics/async_instruments.h" +#include "opentelemetry/sdk/metrics/instruments.h" +#include "opentelemetry/sdk/metrics/meter_context.h" +#include "opentelemetry/sdk/metrics/metric_reader.h" +#include "opentelemetry/sdk/metrics/observer_result.h" +#include "opentelemetry/sdk/metrics/push_metric_exporter.h" +#include "opentelemetry/sdk/metrics/state/metric_collector.h" +#include "opentelemetry/sdk/metrics/state/observable_registry.h" + +#include +#include +#include using namespace opentelemetry::sdk::metrics; using namespace opentelemetry::sdk::instrumentationscope; @@ -219,5 +218,3 @@ INSTANTIATE_TEST_SUITE_P(WritableMetricStorageTestObservableGaugeFixtureLong, WritableMetricStorageTestObservableGaugeFixture, ::testing::Values(AggregationTemporality::kCumulative, AggregationTemporality::kDelta)); - -#endif diff --git a/sdk/test/metrics/attributes_hashmap_benchmark.cc b/sdk/test/metrics/attributes_hashmap_benchmark.cc index 2e90291e7c..71aaa1cd6f 100644 --- a/sdk/test/metrics/attributes_hashmap_benchmark.cc +++ b/sdk/test/metrics/attributes_hashmap_benchmark.cc @@ -2,15 +2,14 @@ // SPDX-License-Identifier: Apache-2.0 #include -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/sdk/common/attributemap_hash.h" -# include "opentelemetry/sdk/metrics/aggregation/aggregation.h" -# include "opentelemetry/sdk/metrics/aggregation/drop_aggregation.h" -# include "opentelemetry/sdk/metrics/instruments.h" -# include "opentelemetry/sdk/metrics/state/attributes_hashmap.h" +#include "opentelemetry/sdk/common/attributemap_hash.h" +#include "opentelemetry/sdk/metrics/aggregation/aggregation.h" +#include "opentelemetry/sdk/metrics/aggregation/drop_aggregation.h" +#include "opentelemetry/sdk/metrics/instruments.h" +#include "opentelemetry/sdk/metrics/state/attributes_hashmap.h" -# include -# include +#include +#include using namespace opentelemetry::sdk::metrics; constexpr size_t MAX_THREADS = 500; @@ -53,5 +52,5 @@ void BM_AttributseHashMap(benchmark::State &state) BENCHMARK(BM_AttributseHashMap); } // namespace -#endif + BENCHMARK_MAIN(); diff --git a/sdk/test/metrics/attributes_hashmap_test.cc b/sdk/test/metrics/attributes_hashmap_test.cc index c4a58b4813..dd74d5c75b 100644 --- a/sdk/test/metrics/attributes_hashmap_test.cc +++ b/sdk/test/metrics/attributes_hashmap_test.cc @@ -1,13 +1,12 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/sdk/metrics/state/attributes_hashmap.h" -# include -# include "opentelemetry/sdk/metrics/aggregation/drop_aggregation.h" -# include "opentelemetry/sdk/metrics/instruments.h" +#include "opentelemetry/sdk/metrics/state/attributes_hashmap.h" +#include +#include "opentelemetry/sdk/metrics/aggregation/drop_aggregation.h" +#include "opentelemetry/sdk/metrics/instruments.h" -# include +#include using namespace opentelemetry::sdk::metrics; namespace nostd = opentelemetry::nostd; @@ -68,5 +67,3 @@ TEST(AttributesHashMap, BasicTests) }); EXPECT_EQ(count, hash_map.Size()); } - -#endif diff --git a/sdk/test/metrics/attributes_processor_benchmark.cc b/sdk/test/metrics/attributes_processor_benchmark.cc index d558a668f7..28f1984b40 100644 --- a/sdk/test/metrics/attributes_processor_benchmark.cc +++ b/sdk/test/metrics/attributes_processor_benchmark.cc @@ -2,9 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 #include -#ifndef ENABLE_METRICS_PREVIEW -# include -# include "opentelemetry/sdk/metrics/view/attributes_processor.h" +#include +#include "opentelemetry/sdk/metrics/view/attributes_processor.h" using namespace opentelemetry::sdk::metrics; namespace { @@ -23,5 +22,5 @@ void BM_AttributseProcessorFilter(benchmark::State &state) BENCHMARK(BM_AttributseProcessorFilter); } // namespace -#endif + BENCHMARK_MAIN(); diff --git a/sdk/test/metrics/attributes_processor_test.cc b/sdk/test/metrics/attributes_processor_test.cc index d496cc7b09..62c0879ca9 100644 --- a/sdk/test/metrics/attributes_processor_test.cc +++ b/sdk/test/metrics/attributes_processor_test.cc @@ -1,9 +1,8 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/sdk/metrics/view/attributes_processor.h" -# include +#include "opentelemetry/sdk/metrics/view/attributes_processor.h" +#include using namespace opentelemetry::sdk::metrics; using namespace opentelemetry::common; @@ -45,5 +44,3 @@ TEST(AttributesProcessor, FilteringAllAttributesProcessor) auto filtered_attributes = attributes_processor.process(iterable); EXPECT_EQ(filter.size(), kNumFilterAttributes); } - -#endif diff --git a/sdk/test/metrics/exemplar/always_sample_filter_test.cc b/sdk/test/metrics/exemplar/always_sample_filter_test.cc index a2f70c1585..cd9e58f284 100644 --- a/sdk/test/metrics/exemplar/always_sample_filter_test.cc +++ b/sdk/test/metrics/exemplar/always_sample_filter_test.cc @@ -1,9 +1,8 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW -# include -# include "opentelemetry/sdk/metrics/exemplar/filter.h" +#include +#include "opentelemetry/sdk/metrics/exemplar/filter.h" using namespace opentelemetry::sdk::metrics; @@ -15,5 +14,3 @@ TEST(AlwaysSampleFilter, SampleMeasurement) ASSERT_TRUE(filter->ShouldSampleMeasurement((int64_t)1, MetricAttributes{}, opentelemetry::context::Context{})); } - -#endif diff --git a/sdk/test/metrics/exemplar/histogram_exemplar_reservoir_test.cc b/sdk/test/metrics/exemplar/histogram_exemplar_reservoir_test.cc index 0d180b3836..a26b0eb952 100644 --- a/sdk/test/metrics/exemplar/histogram_exemplar_reservoir_test.cc +++ b/sdk/test/metrics/exemplar/histogram_exemplar_reservoir_test.cc @@ -1,10 +1,9 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 +#include "opentelemetry/sdk/metrics/exemplar/histogram_exemplar_reservoir.h" +#include #include -#ifndef ENABLE_METRICS_PREVIEW -# include -# include "opentelemetry/sdk/metrics/exemplar/histogram_exemplar_reservoir.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -33,4 +32,3 @@ TEST_F(HistogramExemplarReservoirTestPeer, OfferMeasurement) } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/test/metrics/exemplar/never_sample_filter_test.cc b/sdk/test/metrics/exemplar/never_sample_filter_test.cc index 61d991e41e..4428f60104 100644 --- a/sdk/test/metrics/exemplar/never_sample_filter_test.cc +++ b/sdk/test/metrics/exemplar/never_sample_filter_test.cc @@ -1,10 +1,9 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 +#include #include "opentelemetry/context/context.h" -#ifndef ENABLE_METRICS_PREVIEW -# include -# include "opentelemetry/sdk/metrics/exemplar/filter.h" +#include "opentelemetry/sdk/metrics/exemplar/filter.h" using namespace opentelemetry::sdk::metrics; @@ -16,5 +15,3 @@ TEST(NeverSampleFilter, SampleMeasurement) ASSERT_FALSE(filter->ShouldSampleMeasurement((int64_t)1, MetricAttributes{}, opentelemetry::context::Context{})); } - -#endif diff --git a/sdk/test/metrics/exemplar/no_exemplar_reservoir_test.cc b/sdk/test/metrics/exemplar/no_exemplar_reservoir_test.cc index d93ac0a018..ebf79d2136 100644 --- a/sdk/test/metrics/exemplar/no_exemplar_reservoir_test.cc +++ b/sdk/test/metrics/exemplar/no_exemplar_reservoir_test.cc @@ -1,9 +1,8 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/sdk/metrics/exemplar/no_exemplar_reservoir.h" -# include +#include "opentelemetry/sdk/metrics/exemplar/no_exemplar_reservoir.h" +#include using namespace opentelemetry::sdk::metrics; @@ -17,5 +16,3 @@ TEST(NoExemplarReservoir, OfferMeasurement) auto exemplar_data = reservoir->CollectAndReset(MetricAttributes{}); ASSERT_TRUE(exemplar_data.empty()); } - -#endif diff --git a/sdk/test/metrics/exemplar/reservoir_cell_test.cc b/sdk/test/metrics/exemplar/reservoir_cell_test.cc index c73701b9af..0285279728 100644 --- a/sdk/test/metrics/exemplar/reservoir_cell_test.cc +++ b/sdk/test/metrics/exemplar/reservoir_cell_test.cc @@ -1,9 +1,8 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/sdk/metrics/exemplar/reservoir_cell.h" -# include +#include "opentelemetry/sdk/metrics/exemplar/reservoir_cell.h" +#include OPENTELEMETRY_BEGIN_NAMESPACE namespace sdk @@ -71,4 +70,3 @@ TEST_F(ReservoirCellTestPeer, Filtered) } // namespace metrics } // namespace sdk OPENTELEMETRY_END_NAMESPACE -#endif diff --git a/sdk/test/metrics/exemplar/with_trace_sample_filter_test.cc b/sdk/test/metrics/exemplar/with_trace_sample_filter_test.cc index 77bc534f46..be22f93f06 100644 --- a/sdk/test/metrics/exemplar/with_trace_sample_filter_test.cc +++ b/sdk/test/metrics/exemplar/with_trace_sample_filter_test.cc @@ -1,10 +1,9 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 +#include #include "opentelemetry/context/context.h" -#ifndef ENABLE_METRICS_PREVIEW -# include -# include "opentelemetry/sdk/metrics/exemplar/filter.h" +#include "opentelemetry/sdk/metrics/exemplar/filter.h" using namespace opentelemetry::sdk::metrics; @@ -16,5 +15,3 @@ TEST(WithTraceSampleFilter, SampleMeasurement) ASSERT_FALSE(filter->ShouldSampleMeasurement((int64_t)1, MetricAttributes{}, opentelemetry::context::Context{})); } - -#endif diff --git a/sdk/test/metrics/instrument_metadata_validator_test.cc b/sdk/test/metrics/instrument_metadata_validator_test.cc index df7e7be594..68c350747a 100644 --- a/sdk/test/metrics/instrument_metadata_validator_test.cc +++ b/sdk/test/metrics/instrument_metadata_validator_test.cc @@ -1,9 +1,8 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/sdk/metrics/instrument_metadata_validator.h" -# include +#include "opentelemetry/sdk/metrics/instrument_metadata_validator.h" +#include static std::string CreateVeryLargeString(size_t multiple) { @@ -72,4 +71,3 @@ TEST(InstrumentMetadataValidator, TestUnit) EXPECT_TRUE(validator.ValidateName(str)); } } -#endif diff --git a/sdk/test/metrics/meter_provider_sdk_test.cc b/sdk/test/metrics/meter_provider_sdk_test.cc index ee75ed54ac..7663ca9b01 100644 --- a/sdk/test/metrics/meter_provider_sdk_test.cc +++ b/sdk/test/metrics/meter_provider_sdk_test.cc @@ -1,15 +1,14 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW -# include -# include "opentelemetry/sdk/metrics/export/metric_producer.h" -# include "opentelemetry/sdk/metrics/meter.h" -# include "opentelemetry/sdk/metrics/meter_provider.h" -# include "opentelemetry/sdk/metrics/metric_reader.h" -# include "opentelemetry/sdk/metrics/push_metric_exporter.h" -# include "opentelemetry/sdk/metrics/view/instrument_selector.h" -# include "opentelemetry/sdk/metrics/view/meter_selector.h" +#include +#include "opentelemetry/sdk/metrics/export/metric_producer.h" +#include "opentelemetry/sdk/metrics/meter.h" +#include "opentelemetry/sdk/metrics/meter_provider.h" +#include "opentelemetry/sdk/metrics/metric_reader.h" +#include "opentelemetry/sdk/metrics/push_metric_exporter.h" +#include "opentelemetry/sdk/metrics/view/instrument_selector.h" +#include "opentelemetry/sdk/metrics/view/meter_selector.h" using namespace opentelemetry::sdk::metrics; @@ -82,11 +81,11 @@ TEST(MeterProvider, GetMeter) ASSERT_NE(m3, m6); // Should be an sdk::metrics::Meter -# ifdef OPENTELEMETRY_RTTI_ENABLED +#ifdef OPENTELEMETRY_RTTI_ENABLED auto sdkMeter1 = dynamic_cast(m1.get()); -# else +#else auto sdkMeter1 = static_cast(m1.get()); -# endif +#endif ASSERT_NE(nullptr, sdkMeter1); std::unique_ptr exporter(new MockMetricExporter()); std::unique_ptr reader{new MockMetricReader(std::move(exporter))}; @@ -103,4 +102,3 @@ TEST(MeterProvider, GetMeter) mp1.ForceFlush(); mp1.Shutdown(); } -#endif diff --git a/sdk/test/metrics/meter_test.cc b/sdk/test/metrics/meter_test.cc index 521c1d0c1c..fb260ea19d 100644 --- a/sdk/test/metrics/meter_test.cc +++ b/sdk/test/metrics/meter_test.cc @@ -1,14 +1,13 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/sdk/metrics/meter.h" -# include "opentelemetry/sdk/metrics/data/point_data.h" -# include "opentelemetry/sdk/metrics/meter_context.h" -# include "opentelemetry/sdk/metrics/meter_provider.h" -# include "opentelemetry/sdk/metrics/metric_reader.h" +#include "opentelemetry/sdk/metrics/meter.h" +#include "opentelemetry/sdk/metrics/data/point_data.h" +#include "opentelemetry/sdk/metrics/meter_context.h" +#include "opentelemetry/sdk/metrics/meter_provider.h" +#include "opentelemetry/sdk/metrics/metric_reader.h" -# include +#include using namespace opentelemetry; using namespace opentelemetry::sdk::instrumentationscope; @@ -131,5 +130,3 @@ TEST(MeterTest, StressMultiThread) } } } - -#endif diff --git a/sdk/test/metrics/metric_reader_test.cc b/sdk/test/metrics/metric_reader_test.cc index 31987c6ada..de787d617c 100644 --- a/sdk/test/metrics/metric_reader_test.cc +++ b/sdk/test/metrics/metric_reader_test.cc @@ -1,11 +1,10 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/sdk/metrics/metric_reader.h" -# include -# include "opentelemetry/sdk/metrics/meter_context.h" -# include "opentelemetry/sdk/metrics/push_metric_exporter.h" +#include "opentelemetry/sdk/metrics/metric_reader.h" +#include +#include "opentelemetry/sdk/metrics/meter_context.h" +#include "opentelemetry/sdk/metrics/push_metric_exporter.h" using namespace opentelemetry; using namespace opentelemetry::sdk::instrumentationscope; @@ -46,4 +45,3 @@ TEST(MetricReaderTest, BasicTests) new MetricCollector(meter_context2.get(), std::move(metric_reader2))}; metric_producer->Collect([](ResourceMetrics & /* metric_data */) { return true; }); } -#endif diff --git a/sdk/test/metrics/multi_metric_storage_test.cc b/sdk/test/metrics/multi_metric_storage_test.cc index 30d2e4ccb9..1c230bafcf 100644 --- a/sdk/test/metrics/multi_metric_storage_test.cc +++ b/sdk/test/metrics/multi_metric_storage_test.cc @@ -1,13 +1,12 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/sdk/metrics/state/multi_metric_storage.h" -# include "opentelemetry/common/key_value_iterable_view.h" -# include "opentelemetry/sdk/metrics/exemplar/no_exemplar_reservoir.h" -# include "opentelemetry/sdk/metrics/instruments.h" +#include "opentelemetry/sdk/metrics/state/multi_metric_storage.h" +#include "opentelemetry/common/key_value_iterable_view.h" +#include "opentelemetry/sdk/metrics/exemplar/no_exemplar_reservoir.h" +#include "opentelemetry/sdk/metrics/instruments.h" -# include +#include using namespace opentelemetry; using namespace opentelemetry::sdk::instrumentationscope; @@ -61,4 +60,3 @@ TEST(MultiMetricStorageTest, BasicTests) EXPECT_EQ(static_cast(storage.get())->num_calls_long, 3); EXPECT_EQ(static_cast(storage.get())->num_calls_double, 1); } -#endif diff --git a/sdk/test/metrics/observable_registry_test.cc b/sdk/test/metrics/observable_registry_test.cc index a0ee283ef7..6b6efb755a 100644 --- a/sdk/test/metrics/observable_registry_test.cc +++ b/sdk/test/metrics/observable_registry_test.cc @@ -1,15 +1,14 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/sdk/metrics/state/observable_registry.h" -# include "opentelemetry/metrics/observer_result.h" +#include "opentelemetry/sdk/metrics/state/observable_registry.h" +#include "opentelemetry/metrics/observer_result.h" -# include +#include using namespace opentelemetry::sdk::metrics; -# if 0 +#if 0 class MeasurementFetcher { public: @@ -67,11 +66,10 @@ class MeasurementFetcher static const size_t number_of_attributes = 2; // GET , PUT }; -# endif +#endif TEST(ObservableRegistry, BasicTests) { ObservableRegistry registry; EXPECT_EQ(1, 1); } -#endif diff --git a/sdk/test/metrics/observer_result_test.cc b/sdk/test/metrics/observer_result_test.cc index 7370866636..eea56738b9 100644 --- a/sdk/test/metrics/observer_result_test.cc +++ b/sdk/test/metrics/observer_result_test.cc @@ -1,11 +1,10 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/sdk/metrics/observer_result.h" -# include "opentelemetry/sdk/metrics/view/attributes_processor.h" +#include "opentelemetry/sdk/metrics/observer_result.h" +#include "opentelemetry/sdk/metrics/view/attributes_processor.h" -# include +#include using namespace opentelemetry::sdk::metrics; TEST(ObserverResult, BasicTests) @@ -34,5 +33,3 @@ TEST(ObserverResult, BasicTests) delete attributes_processor; } - -#endif diff --git a/sdk/test/metrics/periodic_exporting_metric_reader_test.cc b/sdk/test/metrics/periodic_exporting_metric_reader_test.cc index 59ae25118b..cd789b5028 100644 --- a/sdk/test/metrics/periodic_exporting_metric_reader_test.cc +++ b/sdk/test/metrics/periodic_exporting_metric_reader_test.cc @@ -1,13 +1,11 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW +#include "opentelemetry/sdk/metrics/export/periodic_exporting_metric_reader.h" +#include "opentelemetry/sdk/metrics/export/metric_producer.h" +#include "opentelemetry/sdk/metrics/push_metric_exporter.h" -# include "opentelemetry/sdk/metrics/export/periodic_exporting_metric_reader.h" -# include "opentelemetry/sdk/metrics/export/metric_producer.h" -# include "opentelemetry/sdk/metrics/push_metric_exporter.h" - -# include +#include using namespace opentelemetry; using namespace opentelemetry::sdk::instrumentationscope; @@ -76,5 +74,3 @@ TEST(PeriodicExporingMetricReader, BasicTests) EXPECT_EQ(static_cast(exporter_ptr)->GetDataCount(), static_cast(&producer)->GetDataCount()); } - -#endif diff --git a/sdk/test/metrics/sync_instruments_test.cc b/sdk/test/metrics/sync_instruments_test.cc index fd9240518a..0747115bab 100644 --- a/sdk/test/metrics/sync_instruments_test.cc +++ b/sdk/test/metrics/sync_instruments_test.cc @@ -1,16 +1,15 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/sdk/metrics/sync_instruments.h" -# include "opentelemetry/context/context.h" -# include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h" -# include "opentelemetry/sdk/metrics/exemplar/no_exemplar_reservoir.h" -# include "opentelemetry/sdk/metrics/state/multi_metric_storage.h" +#include "opentelemetry/sdk/metrics/sync_instruments.h" +#include "opentelemetry/context/context.h" +#include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h" +#include "opentelemetry/sdk/metrics/exemplar/no_exemplar_reservoir.h" +#include "opentelemetry/sdk/metrics/state/multi_metric_storage.h" -# include -# include -# include +#include +#include +#include using namespace opentelemetry; using namespace opentelemetry::sdk::instrumentationscope; @@ -130,5 +129,3 @@ TEST(SyncInstruments, DoubleHistogram) counter.Record(10.10, opentelemetry::common::KeyValueIterableView({}), opentelemetry::context::Context{}); } - -#endif diff --git a/sdk/test/metrics/sync_metric_storage_counter_test.cc b/sdk/test/metrics/sync_metric_storage_counter_test.cc index 7118e66529..5603a8db05 100644 --- a/sdk/test/metrics/sync_metric_storage_counter_test.cc +++ b/sdk/test/metrics/sync_metric_storage_counter_test.cc @@ -2,16 +2,15 @@ // SPDX-License-Identifier: Apache-2.0 #include -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/common/key_value_iterable_view.h" -# include "opentelemetry/nostd/shared_ptr.h" -# include "opentelemetry/sdk/metrics/exemplar/histogram_exemplar_reservoir.h" -# include "opentelemetry/sdk/metrics/instruments.h" -# include "opentelemetry/sdk/metrics/state/sync_metric_storage.h" -# include "opentelemetry/sdk/metrics/view/attributes_processor.h" +#include "opentelemetry/common/key_value_iterable_view.h" +#include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/sdk/metrics/exemplar/histogram_exemplar_reservoir.h" +#include "opentelemetry/sdk/metrics/instruments.h" +#include "opentelemetry/sdk/metrics/state/sync_metric_storage.h" +#include "opentelemetry/sdk/metrics/view/attributes_processor.h" -# include -# include +#include +#include using namespace opentelemetry::sdk::metrics; using namespace opentelemetry::common; @@ -310,5 +309,3 @@ INSTANTIATE_TEST_SUITE_P(WritableMetricStorageTestDouble, WritableMetricStorageTestFixture, ::testing::Values(AggregationTemporality::kCumulative, AggregationTemporality::kDelta)); - -#endif diff --git a/sdk/test/metrics/sync_metric_storage_histogram_test.cc b/sdk/test/metrics/sync_metric_storage_histogram_test.cc index a50848ad3d..6544a21a8c 100644 --- a/sdk/test/metrics/sync_metric_storage_histogram_test.cc +++ b/sdk/test/metrics/sync_metric_storage_histogram_test.cc @@ -2,16 +2,15 @@ // SPDX-License-Identifier: Apache-2.0 #include -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/common/key_value_iterable_view.h" -# include "opentelemetry/nostd/shared_ptr.h" -# include "opentelemetry/sdk/metrics/exemplar/no_exemplar_reservoir.h" -# include "opentelemetry/sdk/metrics/instruments.h" -# include "opentelemetry/sdk/metrics/state/sync_metric_storage.h" -# include "opentelemetry/sdk/metrics/view/attributes_processor.h" +#include "opentelemetry/common/key_value_iterable_view.h" +#include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/sdk/metrics/exemplar/no_exemplar_reservoir.h" +#include "opentelemetry/sdk/metrics/instruments.h" +#include "opentelemetry/sdk/metrics/state/sync_metric_storage.h" +#include "opentelemetry/sdk/metrics/view/attributes_processor.h" -# include -# include +#include +#include using namespace opentelemetry::sdk::metrics; using namespace opentelemetry::common; @@ -312,5 +311,3 @@ INSTANTIATE_TEST_SUITE_P(WritableMetricStorageHistogramTestDouble, WritableMetricStorageHistogramTestFixture, ::testing::Values(AggregationTemporality::kCumulative, AggregationTemporality::kDelta)); - -#endif diff --git a/sdk/test/metrics/sync_metric_storage_up_down_counter_test.cc b/sdk/test/metrics/sync_metric_storage_up_down_counter_test.cc index 77841d7330..f84bde7628 100644 --- a/sdk/test/metrics/sync_metric_storage_up_down_counter_test.cc +++ b/sdk/test/metrics/sync_metric_storage_up_down_counter_test.cc @@ -1,17 +1,16 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/common/key_value_iterable_view.h" -# include "opentelemetry/nostd/shared_ptr.h" -# include "opentelemetry/sdk/metrics/exemplar/histogram_exemplar_reservoir.h" -# include "opentelemetry/sdk/metrics/instruments.h" -# include "opentelemetry/sdk/metrics/state/sync_metric_storage.h" -# include "opentelemetry/sdk/metrics/view/attributes_processor.h" - -# include -# include -# include +#include "opentelemetry/common/key_value_iterable_view.h" +#include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/sdk/metrics/exemplar/histogram_exemplar_reservoir.h" +#include "opentelemetry/sdk/metrics/instruments.h" +#include "opentelemetry/sdk/metrics/state/sync_metric_storage.h" +#include "opentelemetry/sdk/metrics/view/attributes_processor.h" + +#include +#include +#include using namespace opentelemetry::sdk::metrics; using namespace opentelemetry::common; @@ -326,5 +325,3 @@ INSTANTIATE_TEST_SUITE_P(WritableMetricStorageTestDouble, WritableMetricStorageTestFixture, ::testing::Values(AggregationTemporality::kCumulative, AggregationTemporality::kDelta)); - -#endif diff --git a/sdk/test/metrics/view_registry_test.cc b/sdk/test/metrics/view_registry_test.cc index a6b0115f42..6c07b639ce 100644 --- a/sdk/test/metrics/view_registry_test.cc +++ b/sdk/test/metrics/view_registry_test.cc @@ -1,13 +1,12 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef ENABLE_METRICS_PREVIEW -# include "opentelemetry/sdk/metrics/view/view_registry.h" -# include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h" -# include "opentelemetry/sdk/metrics/instruments.h" -# include "opentelemetry/sdk/metrics/view/predicate.h" +#include "opentelemetry/sdk/metrics/view/view_registry.h" +#include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h" +#include "opentelemetry/sdk/metrics/instruments.h" +#include "opentelemetry/sdk/metrics/view/predicate.h" -# include +#include using namespace opentelemetry::sdk::metrics; using namespace opentelemetry::sdk::instrumentationscope; @@ -29,17 +28,17 @@ TEST(ViewRegistry, FindViewsEmptyRegistry) registry.FindViews(default_instrument_descriptor, *default_instrumentation_scope.get(), [&count](const View &view) { count++; -# if HAVE_WORKING_REGEX +#if HAVE_WORKING_REGEX EXPECT_EQ(view.GetName(), ""); EXPECT_EQ(view.GetDescription(), ""); -# endif +#endif EXPECT_EQ(view.GetAggregationType(), AggregationType::kDefault); return true; }); -# if HAVE_WORKING_REGEX +#if HAVE_WORKING_REGEX EXPECT_EQ(count, 1); EXPECT_EQ(status, true); -# endif +#endif } TEST(ViewRegistry, FindNonExistingView) @@ -74,15 +73,14 @@ TEST(ViewRegistry, FindNonExistingView) registry.FindViews(default_instrument_descriptor, *default_instrumentation_scope.get(), [&count, &view_name, &view_description](const View &view) { count++; -# if HAVE_WORKING_REGEX +#if HAVE_WORKING_REGEX EXPECT_EQ(view.GetName(), view_name); EXPECT_EQ(view.GetDescription(), view_description); -# endif +#endif return true; }); -# if HAVE_WORKING_REGEX +#if HAVE_WORKING_REGEX EXPECT_EQ(count, 1); EXPECT_EQ(status, true); -# endif -} #endif +}