diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 33078816f6..f11b088b82 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -182,6 +182,48 @@ jobs: run: | (cd ./functional/otlp; ./run_test.sh) + cmake_clang_yaml_config: + name: CMake clang 18 (maintainer mode, yaml config) + runs-on: ubuntu-24.04 + env: + CC: /usr/bin/clang-18 + CXX: /usr/bin/clang++-18 + CXX_STANDARD: '14' + steps: + - name: Harden the runner (Audit all outbound calls) + uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 # v2.12.2 + with: + egress-policy: audit + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + submodules: 'recursive' + - name: setup + run: | + sudo -E ./ci/setup_ci_environment.sh + - name: install dependencies + run: | + sudo -E ./ci/install_thirdparty.sh --install-dir /usr/local --tags-file third_party_release + - name: install ryml + run: | + sudo -E ./ci/install_ryml.sh + - name: run cmake clang (maintainer mode, sync) + run: | + ./ci/do_ci.sh cmake.maintainer.yaml.test + - name: install shelltest + run: sudo apt update && sudo apt-get install -y shelltestrunner + - name: generate test cert + env: + CFSSL_VERSION: 1.6.3 + run: | + sudo -E ./tools/setup-cfssl.sh + (cd ./functional/cert; ./generate_cert.sh) + - name: run otlp func test + run: | + (cd ./functional/otlp; ./run_test.sh) + - name: run configuration func test + run: | + (cd ./functional/configuration; ./run_test.sh) + cmake_clang_maintainer_async_test: name: CMake clang 18 (maintainer mode, async) runs-on: ubuntu-24.04 diff --git a/.github/workflows/clang-tidy.yaml b/.github/workflows/clang-tidy.yaml index 9d7abda33d..54d6898a6d 100644 --- a/.github/workflows/clang-tidy.yaml +++ b/.github/workflows/clang-tidy.yaml @@ -17,9 +17,9 @@ jobs: matrix: include: - cmake_options: all-options-abiv1-preview - warning_limit: 61 + warning_limit: 66 - cmake_options: all-options-abiv2-preview - warning_limit: 61 + warning_limit: 66 steps: - name: Harden the runner (Audit all outbound calls) uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0 @@ -48,6 +48,7 @@ jobs: libgmock-dev \ libgtest-dev \ libbenchmark-dev + sudo ./ci/install_ryml.sh if ! command -v clang-tidy &> /dev/null; then echo "clang-tidy could not be found" diff --git a/.github/workflows/iwyu.yml b/.github/workflows/iwyu.yml index 76c9c93bc7..b3cb5a1f4e 100644 --- a/.github/workflows/iwyu.yml +++ b/.github/workflows/iwyu.yml @@ -53,9 +53,15 @@ jobs: llvm-dev \ libclang-dev \ cmake + + - name: Install rapidyaml + run: | + sudo ./ci/install_ryml.sh + - name: Install include-what-you-use run: | sudo ./ci/install_iwyu.sh + - name: Prepare CMake env: CC: clang diff --git a/.iwyu.imp b/.iwyu.imp index 123e72f32d..02fc11c194 100644 --- a/.iwyu.imp +++ b/.iwyu.imp @@ -11,6 +11,17 @@ { "include": ["", "private", "", "public"] }, { "include": ["", "private", "", "public"] }, + # Work around for ryml + { "include": ["", "private", "", "public"] }, + + { "include": ["", "private", "", "public"] }, + { "include": ["", "private", "", "public"] }, + { "include": ["", "private", "", "public"] }, + { "include": ["", "private", "", "public"] }, + { "include": ["", "private", "", "public"] }, + { "include": ["", "private", "", "public"] }, + { "include": ["", "private", "", "public"] }, + # Local opentelemetry-cpp style # We prefer to include for simplicity diff --git a/CMakeLists.txt b/CMakeLists.txt index 005717c46d..49701dc5d8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,6 +77,8 @@ endif() option(WITH_ABI_VERSION_1 "ABI version 1" ON) option(WITH_ABI_VERSION_2 "EXPERIMENTAL: ABI version 2 preview" OFF) +option(WITH_CONFIGURATION "EXPERIMENTAL: YAML configuration file" OFF) + file(READ "${CMAKE_CURRENT_LIST_DIR}/api/include/opentelemetry/version.h" OPENTELEMETRY_CPP_HEADER_VERSION_H) @@ -382,6 +384,18 @@ if((NOT WITH_API_ONLY) AND USE_NLOHMANN_JSON) include("${opentelemetry-cpp_SOURCE_DIR}/cmake/nlohmann-json.cmake") endif() +# +# Do we need RapidYaml ? +# + +if((NOT WITH_API_ONLY) AND WITH_CONFIGURATION) + find_package(ryml 0.7.2 REQUIRED) + message( + STATUS + "Found ryml: include ${RYML_INCLUDE_DIR}, lib ${RYML_LIB_DIR}, version ${ryml_VERSION}" + ) +endif() + # # Do we need OpenTracing ? # diff --git a/api/include/opentelemetry/common/string_util.h b/api/include/opentelemetry/common/string_util.h index 273a65272b..5108f186e7 100644 --- a/api/include/opentelemetry/common/string_util.h +++ b/api/include/opentelemetry/common/string_util.h @@ -3,6 +3,8 @@ #pragma once +#include + #include "opentelemetry/nostd/string_view.h" #include "opentelemetry/version.h" diff --git a/ci/do_ci.sh b/ci/do_ci.sh index 6e0be2eec4..007c2f5b65 100755 --- a/ci/do_ci.sh +++ b/ci/do_ci.sh @@ -218,6 +218,31 @@ elif [[ "$1" == "cmake.maintainer.abiv2.test" ]]; then eval "$MAKE_COMMAND" make test exit 0 +elif [[ "$1" == "cmake.maintainer.yaml.test" ]]; then + cd "${BUILD_DIR}" + rm -rf * + cmake "${CMAKE_OPTIONS[@]}" \ + -DWITH_OTLP_HTTP=ON \ + -DWITH_OTLP_GRPC=ON \ + -DWITH_OTLP_FILE=ON \ + -DWITH_PROMETHEUS=ON \ + -DWITH_EXAMPLES=ON \ + -DWITH_EXAMPLES_HTTP=ON \ + -DWITH_ZIPKIN=ON \ + -DBUILD_W3CTRACECONTEXT_TEST=ON \ + -DWITH_ELASTICSEARCH=ON \ + -DWITH_METRICS_EXEMPLAR_PREVIEW=ON \ + -DWITH_ASYNC_EXPORT_PREVIEW=OFF \ + -DOTELCPP_MAINTAINER_MODE=ON \ + -DWITH_NO_DEPRECATED_CODE=ON \ + -DWITH_OTLP_HTTP_COMPRESSION=ON \ + -DWITH_OTLP_RETRY_PREVIEW=ON \ + -DWITH_THREAD_INSTRUMENTATION_PREVIEW=ON \ + -DWITH_CONFIGURATION=ON \ + "${SRC_DIR}" + eval "$MAKE_COMMAND" + make test + exit 0 elif [[ "$1" == "cmake.with_async_export.test" ]]; then cd "${BUILD_DIR}" rm -rf * diff --git a/ci/install_ryml.sh b/ci/install_ryml.sh new file mode 100755 index 0000000000..da48b79f4f --- /dev/null +++ b/ci/install_ryml.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +set -ex +export DEBIAN_FRONTEND=noninteractive +[ -z "${RYML_VERSION}" ] && export RYML_VERSION="v0.9.0" + +BUILD_DIR=/tmp/ +INSTALL_DIR=/usr/local/ +pushd $BUILD_DIR +git clone --recursive -b ${RYML_VERSION} https://github.com/biojppm/rapidyaml.git + +cd rapidyaml +RYML_BUILD_OPTIONS=( + "-DBUILD_TESTING=OFF" + "-DCMAKE_POSITION_INDEPENDENT_CODE=ON" + "-DCMAKE_INSTALL_PREFIX=$INSTALL_DIR" +) + +if [ ! -z "${CXX_STANDARD}" ]; then + RYML_BUILD_OPTIONS=(${RYML_BUILD_OPTIONS[@]} "-DCMAKE_CXX_STANDARD=${CXX_STANDARD}") +fi + +mkdir build && pushd build +cmake "${RYML_BUILD_OPTIONS[@]}" .. +make -j $(nproc) +make install +popd +popd +export PATH=${INSTALL_DIR}/bin:$PATH # ensure to use the installed ryml diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index b0991c0c8e..0bee685546 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -31,3 +31,7 @@ add_subdirectory(multi_processor) if(WITH_EXAMPLES_HTTP) add_subdirectory(http) endif() + +if(WITH_CONFIGURATION) + add_subdirectory(configuration) +endif() diff --git a/examples/configuration/CMakeLists.txt b/examples/configuration/CMakeLists.txt new file mode 100644 index 0000000000..c67b815cf6 --- /dev/null +++ b/examples/configuration/CMakeLists.txt @@ -0,0 +1,86 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +if(DEFINED OPENTELEMETRY_BUILD_DLL) + add_definitions(-DOPENTELEMETRY_BUILD_IMPORT_DLL) +endif() + +include_directories(${CMAKE_SOURCE_DIR}/sdk/include) + +add_executable( + example_yaml + main.cc + custom_sampler.cc + custom_sampler_builder.cc + custom_span_exporter.cc + custom_span_exporter_builder.cc + custom_span_processor.cc + custom_span_processor_builder.cc + custom_push_metric_exporter.cc + custom_push_metric_exporter_builder.cc + custom_pull_metric_exporter.cc + custom_pull_metric_exporter_builder.cc + custom_log_record_exporter.cc + custom_log_record_exporter_builder.cc + custom_log_record_processor.cc + custom_log_record_processor_builder.cc) + +target_link_libraries( + example_yaml + ${CMAKE_THREAD_LIBS_INIT} + common_metrics_foo_library + common_logs_foo_library + opentelemetry_exporter_ostream_span_builder + opentelemetry_exporter_ostream_metrics_builder + opentelemetry_exporter_ostream_logs_builder) + +if(WITH_OTLP_HTTP) + include_directories(${CMAKE_SOURCE_DIR}/exporters/otlp/include) + add_definitions(-DOTEL_HAVE_OTLP_HTTP) + target_link_libraries(example_yaml opentelemetry_exporter_otlp_http_builder) + target_link_libraries(example_yaml + opentelemetry_exporter_otlp_http_log_builder) + target_link_libraries(example_yaml + opentelemetry_exporter_otlp_http_metric_builder) +endif() + +if(WITH_OTLP_GRPC) + include_directories(${CMAKE_SOURCE_DIR}/exporters/otlp/include) + add_definitions(-DOTEL_HAVE_OTLP_GRPC) + target_link_libraries(example_yaml opentelemetry_exporter_otlp_grpc_builder) + target_link_libraries(example_yaml + opentelemetry_exporter_otlp_grpc_log_builder) + target_link_libraries(example_yaml + opentelemetry_exporter_otlp_grpc_metrics_builder) +endif() + +if(WITH_OTLP_FILE) + include_directories(${CMAKE_SOURCE_DIR}/exporters/otlp/include) + add_definitions(-DOTEL_HAVE_OTLP_FILE) + target_link_libraries(example_yaml opentelemetry_exporter_otlp_file_builder) + target_link_libraries(example_yaml + opentelemetry_exporter_otlp_file_log_builder) + target_link_libraries(example_yaml + opentelemetry_exporter_otlp_file_metric_builder) +endif() + +if(WITH_ZIPKIN) + include_directories(${CMAKE_SOURCE_DIR}/exporters/zipkin/include) + add_definitions(-DOTEL_HAVE_ZIPKIN) + target_link_libraries(example_yaml + opentelemetry_exporter_zipkin_trace_builder) +endif() + +if(WITH_PROMETHEUS) + include_directories(${CMAKE_SOURCE_DIR}/exporters/prometheus/include) + add_definitions(-DOTEL_HAVE_PROMETHEUS) + target_link_libraries(example_yaml opentelemetry_exporter_prometheus_builder) +endif() + +if(DEFINED OPENTELEMETRY_BUILD_DLL) + target_link_libraries(example_yaml opentelemetry_cpp) +else() + target_link_libraries( + example_yaml opentelemetry_configuration opentelemetry_common + opentelemetry_trace opentelemetry_logs) +endif() diff --git a/examples/configuration/anchors.yaml b/examples/configuration/anchors.yaml new file mode 100644 index 0000000000..b0ce674278 --- /dev/null +++ b/examples/configuration/anchors.yaml @@ -0,0 +1,45 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +# anchors.yaml demonstrates anchor substitution to reuse OTLP exporter configuration across signals. + +file_format: "0.1" +exporters: + otlp: &otlp-exporter + protocol: http/protobuf + endpoint: http://localhost:4318 + certificate: /app/cert.pem + client_key: /app/cert.pem + client_certificate: /app/cert.pem + headers: + api-key: !!str 1234 + compression: gzip + timeout: 10000 + +logger_provider: + processors: + - batch: + exporter: + otlp: + # expand the otlp-exporter anchor + <<: *otlp-exporter + +meter_provider: + readers: + - periodic: + interval: 5000 + timeout: 30000 + exporter: + otlp: + # expand the otlp-exporter anchor and add metric specific configuration + <<: *otlp-exporter + temporality_preference: delta + default_histogram_aggregation: base2_exponential_bucket_histogram + +tracer_provider: + processors: + - batch: + exporter: + otlp: + # expand the otlp-exporter anchor + <<: *otlp-exporter diff --git a/exporters/ostream/CMakeLists.txt b/exporters/ostream/CMakeLists.txt index 52369ea139..9308eb7d9f 100644 --- a/exporters/ostream/CMakeLists.txt +++ b/exporters/ostream/CMakeLists.txt @@ -1,6 +1,10 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 +# +# opentelemetry_exporter_ostream_span +# + add_library(opentelemetry_exporter_ostream_span src/span_exporter.cc src/span_exporter_factory.cc) @@ -27,6 +31,31 @@ if(BUILD_TESTING) TEST_LIST ostream_span_test) endif() # BUILD_TESTING +# +# opentelemetry_exporter_ostream_span_builder +# + +add_library(opentelemetry_exporter_ostream_span_builder + src/console_span_builder.cc) + +set_target_properties(opentelemetry_exporter_ostream_span_builder + PROPERTIES EXPORT_NAME ostream_span_exporter_builder) +set_target_version(opentelemetry_exporter_ostream_span_builder) + +target_include_directories( + opentelemetry_exporter_ostream_span_builder + PUBLIC "$") + +target_link_libraries(opentelemetry_exporter_ostream_span_builder + PUBLIC opentelemetry_exporter_ostream_span) + +list(APPEND OPENTELEMETRY_OSTREAM_BUILDER_TARGETS + opentelemetry_exporter_ostream_span_builder) + +# +# opentelemetry_exporter_ostream_metrics +# + add_library(opentelemetry_exporter_ostream_metrics src/metric_exporter.cc src/metric_exporter_factory.cc) set_target_properties(opentelemetry_exporter_ostream_metrics @@ -53,6 +82,29 @@ if(BUILD_TESTING) TEST_LIST ostream_metric_test) endif() +# +# opentelemetry_exporter_ostream_metrics_builder +# + +add_library(opentelemetry_exporter_ostream_metrics_builder + src/console_push_metric_builder.cc) +set_target_properties(opentelemetry_exporter_ostream_metrics_builder + PROPERTIES EXPORT_NAME ostream_metrics_exporter_builder) +set_target_version(opentelemetry_exporter_ostream_metrics_builder) + +target_include_directories( + opentelemetry_exporter_ostream_metrics_builder + PUBLIC "$") +target_link_libraries(opentelemetry_exporter_ostream_metrics_builder + PUBLIC opentelemetry_exporter_ostream_metrics) + +list(APPEND OPENTELEMETRY_OSTREAM_BUILDER_TARGETS + opentelemetry_exporter_ostream_metrics_builder) + +# +# opentelemetry_exporter_ostream_logs +# + add_library(opentelemetry_exporter_ostream_logs src/log_record_exporter.cc src/log_record_exporter_factory.cc) set_target_properties(opentelemetry_exporter_ostream_logs @@ -66,6 +118,35 @@ target_link_libraries(opentelemetry_exporter_ostream_logs PUBLIC opentelemetry_logs) list(APPEND OPENTELEMETRY_OSTREAM_TARGETS opentelemetry_exporter_ostream_logs) +if(BUILD_TESTING) + add_executable(ostream_log_test test/ostream_log_test.cc) + target_link_libraries(ostream_log_test ${GTEST_BOTH_LIBRARIES} + opentelemetry_exporter_ostream_logs) + gtest_add_tests( + TARGET ostream_log_test + TEST_PREFIX exporter. + TEST_LIST ostream_log_test) +endif() + +# +# opentelemetry_exporter_ostream_logs_builder +# + +add_library(opentelemetry_exporter_ostream_logs_builder + src/console_log_record_builder.cc) +set_target_properties( + opentelemetry_exporter_ostream_logs_builder + PROPERTIES EXPORT_NAME ostream_log_record_exporter_builder) +set_target_version(opentelemetry_exporter_ostream_logs_builder) + +target_include_directories( + opentelemetry_exporter_ostream_logs_builder + PUBLIC "$") +target_link_libraries(opentelemetry_exporter_ostream_logs_builder + PUBLIC opentelemetry_exporter_ostream_logs) +list(APPEND OPENTELEMETRY_OSTREAM_BUILDER_TARGETS + opentelemetry_exporter_ostream_logs_builder) + otel_add_component( COMPONENT exporters_ostream @@ -77,14 +158,30 @@ otel_add_component( "include/opentelemetry/exporters" FILES_MATCHING PATTERN - "*.h") + "*.h" + PATTERN + "console_log_record_builder.h" + EXCLUDE + PATTERN + "console_push_metric_builder.h" + EXCLUDE + PATTERN + "console_span_builder.h" + EXCLUDE) -if(BUILD_TESTING) - add_executable(ostream_log_test test/ostream_log_test.cc) - target_link_libraries(ostream_log_test ${GTEST_BOTH_LIBRARIES} - opentelemetry_exporter_ostream_logs) - gtest_add_tests( - TARGET ostream_log_test - TEST_PREFIX exporter. - TEST_LIST ostream_log_test) -endif() +otel_add_component( + COMPONENT + exporters_ostream_builder + TARGETS + ${OPENTELEMETRY_OSTREAM_BUILDER_TARGETS} + FILES_DIRECTORY + "include/opentelemetry/exporters/ostream" + FILES_DESTINATION + "include/opentelemetry/exporters" + FILES_MATCHING + PATTERN + "console_log_record_builder.h" + PATTERN + "console_push_metric_builder.h" + PATTERN + "console_span_builder.h") diff --git a/exporters/otlp/CMakeLists.txt b/exporters/otlp/CMakeLists.txt index 9ad6d7922d..b943696c28 100644 --- a/exporters/otlp/CMakeLists.txt +++ b/exporters/otlp/CMakeLists.txt @@ -7,6 +7,10 @@ else() set(OPENTELEMETRY_OTLP_TARGETS_LIB_TYPE) endif() +# +# opentelemetry_otlp_recordable +# + add_library( opentelemetry_otlp_recordable ${OPENTELEMETRY_OTLP_TARGETS_LIB_TYPE} @@ -31,6 +35,25 @@ target_link_libraries(opentelemetry_otlp_recordable PUBLIC opentelemetry_logs) target_link_libraries(opentelemetry_otlp_recordable PUBLIC opentelemetry_metrics) +# +# opentelemetry_exporter_otlp_builder_utils +# + +add_library(opentelemetry_exporter_otlp_builder_utils + ${OPENTELEMETRY_OTLP_TARGETS_LIB_TYPE} src/otlp_builder_utils.cc) + +set_target_properties(opentelemetry_exporter_otlp_builder_utils + PROPERTIES EXPORT_NAME otlp_builder_utils) +set_target_version(opentelemetry_exporter_otlp_builder_utils) + +target_include_directories( + opentelemetry_exporter_otlp_builder_utils + PUBLIC "$" + "$") + +target_link_libraries(opentelemetry_exporter_otlp_builder_utils + PUBLIC opentelemetry_otlp_recordable) + if(WITH_OTLP_GRPC) if(NOT DEFINED grpc_lib_type) message( @@ -42,6 +65,11 @@ if(WITH_OTLP_GRPC) else() set(OPENTELEMETRY_OTLP_GRPC_CLIENT_LIB_TYPE) endif() + + # + # opentelemetry_exporter_otlp_grpc_client + # + add_library( opentelemetry_exporter_otlp_grpc_client ${OPENTELEMETRY_OTLP_GRPC_CLIENT_LIB_TYPE} src/otlp_grpc_client.cc @@ -78,6 +106,10 @@ if(WITH_OTLP_GRPC) list(APPEND OPENTELEMETRY_OTLP_GRPC_TARGETS opentelemetry_exporter_otlp_grpc_client opentelemetry_proto_grpc) + # + # opentelemetry_exporter_otlp_grpc + # + add_library( opentelemetry_exporter_otlp_grpc ${OPENTELEMETRY_OTLP_TARGETS_LIB_TYPE} src/otlp_grpc_exporter.cc @@ -94,6 +126,28 @@ if(WITH_OTLP_GRPC) list(APPEND OPENTELEMETRY_OTLP_GRPC_TARGETS opentelemetry_exporter_otlp_grpc) + # + # opentelemetry_exporter_otlp_grpc_builder + # + + add_library( + opentelemetry_exporter_otlp_grpc_builder + ${OPENTELEMETRY_OTLP_TARGETS_LIB_TYPE} src/otlp_grpc_span_builder.cc) + + set_target_properties(opentelemetry_exporter_otlp_grpc_builder + PROPERTIES EXPORT_NAME otlp_grpc_exporter_builder) + set_target_version(opentelemetry_exporter_otlp_grpc_builder) + + target_link_libraries(opentelemetry_exporter_otlp_grpc_builder + PUBLIC opentelemetry_exporter_otlp_grpc) + + list(APPEND OPENTELEMETRY_OTLP_GRPC_BUILDER_TARGETS + opentelemetry_exporter_otlp_grpc_builder) + + # + # opentelemetry_exporter_otlp_grpc_log + # + add_library( opentelemetry_exporter_otlp_grpc_log ${OPENTELEMETRY_OTLP_TARGETS_LIB_TYPE} src/otlp_grpc_log_record_exporter.cc @@ -112,6 +166,29 @@ if(WITH_OTLP_GRPC) list(APPEND OPENTELEMETRY_OTLP_GRPC_TARGETS opentelemetry_exporter_otlp_grpc_log) + # + # opentelemetry_exporter_otlp_grpc_log_builder + # + + add_library( + opentelemetry_exporter_otlp_grpc_log_builder + ${OPENTELEMETRY_OTLP_TARGETS_LIB_TYPE} src/otlp_grpc_log_record_builder.cc) + + set_target_properties( + opentelemetry_exporter_otlp_grpc_log_builder + PROPERTIES EXPORT_NAME otlp_grpc_log_record_exporter_builder) + set_target_version(opentelemetry_exporter_otlp_grpc_log_builder) + + target_link_libraries(opentelemetry_exporter_otlp_grpc_log_builder + PUBLIC opentelemetry_exporter_otlp_grpc_log) + + list(APPEND OPENTELEMETRY_OTLP_GRPC_BUILDER_TARGETS + opentelemetry_exporter_otlp_grpc_log_builder) + + # + # opentelemetry_exporter_otlp_grpc_metrics + # + add_library( opentelemetry_exporter_otlp_grpc_metrics ${OPENTELEMETRY_OTLP_TARGETS_LIB_TYPE} src/otlp_grpc_metric_exporter.cc @@ -129,9 +206,34 @@ if(WITH_OTLP_GRPC) list(APPEND OPENTELEMETRY_OTLP_GRPC_TARGETS opentelemetry_exporter_otlp_grpc_metrics) + + # + # opentelemetry_exporter_otlp_grpc_metrics_builder + # + + add_library( + opentelemetry_exporter_otlp_grpc_metrics_builder + ${OPENTELEMETRY_OTLP_TARGETS_LIB_TYPE} src/otlp_grpc_push_metric_builder.cc) + + set_target_properties( + opentelemetry_exporter_otlp_grpc_metrics_builder + PROPERTIES EXPORT_NAME otlp_grpc_metrics_exporter_builder) + set_target_version(opentelemetry_exporter_otlp_grpc_metrics_builder) + + target_link_libraries(opentelemetry_exporter_otlp_grpc_metrics_builder + PUBLIC opentelemetry_exporter_otlp_grpc_metrics) + + list(APPEND OPENTELEMETRY_OTLP_GRPC_BUILDER_TARGETS + opentelemetry_exporter_otlp_grpc_metrics_builder) + endif() if(WITH_OTLP_HTTP) + + # + # opentelemetry_exporter_otlp_http_client + # + add_library( opentelemetry_exporter_otlp_http_client ${OPENTELEMETRY_OTLP_TARGETS_LIB_TYPE} src/otlp_http.cc @@ -158,6 +260,10 @@ if(WITH_OTLP_HTTP) list(APPEND OPENTELEMETRY_OTLP_HTTP_TARGETS opentelemetry_exporter_otlp_http_client) + # + # opentelemetry_exporter_otlp_http + # + add_library( opentelemetry_exporter_otlp_http ${OPENTELEMETRY_OTLP_TARGETS_LIB_TYPE} src/otlp_http_exporter.cc @@ -174,6 +280,30 @@ if(WITH_OTLP_HTTP) list(APPEND OPENTELEMETRY_OTLP_HTTP_TARGETS opentelemetry_exporter_otlp_http) + # + # opentelemetry_exporter_otlp_http_builder + # + + add_library( + opentelemetry_exporter_otlp_http_builder + ${OPENTELEMETRY_OTLP_TARGETS_LIB_TYPE} src/otlp_http_span_builder.cc) + + set_target_properties(opentelemetry_exporter_otlp_http_builder + PROPERTIES EXPORT_NAME otlp_http_exporter_builder) + set_target_version(opentelemetry_exporter_otlp_http_builder) + + target_link_libraries(opentelemetry_exporter_otlp_http_builder + PUBLIC opentelemetry_exporter_otlp_http) + target_link_libraries(opentelemetry_exporter_otlp_http_builder + PUBLIC opentelemetry_exporter_otlp_builder_utils) + + list(APPEND OPENTELEMETRY_OTLP_HTTP_BUILDER_TARGETS + opentelemetry_exporter_otlp_http_builder) + + # + # opentelemetry_exporter_otlp_http_log + # + add_library( opentelemetry_exporter_otlp_http_log ${OPENTELEMETRY_OTLP_TARGETS_LIB_TYPE} src/otlp_http_log_record_exporter.cc @@ -192,6 +322,31 @@ if(WITH_OTLP_HTTP) list(APPEND OPENTELEMETRY_OTLP_HTTP_TARGETS opentelemetry_exporter_otlp_http_log) + # + # opentelemetry_exporter_otlp_http_log_builder + # + + add_library( + opentelemetry_exporter_otlp_http_log_builder + ${OPENTELEMETRY_OTLP_TARGETS_LIB_TYPE} src/otlp_http_log_record_builder.cc) + + set_target_properties( + opentelemetry_exporter_otlp_http_log_builder + PROPERTIES EXPORT_NAME otlp_http_log_record_exporter_builder) + set_target_version(opentelemetry_exporter_otlp_http_log_builder) + + target_link_libraries(opentelemetry_exporter_otlp_http_log_builder + PUBLIC opentelemetry_exporter_otlp_http_log) + target_link_libraries(opentelemetry_exporter_otlp_http_log_builder + PUBLIC opentelemetry_exporter_otlp_builder_utils) + + list(APPEND OPENTELEMETRY_OTLP_HTTP_BUILDER_TARGETS + opentelemetry_exporter_otlp_http_log_builder) + + # + # opentelemetry_exporter_otlp_http_metric + # + add_library( opentelemetry_exporter_otlp_http_metric ${OPENTELEMETRY_OTLP_TARGETS_LIB_TYPE} src/otlp_http_metric_exporter.cc @@ -209,9 +364,36 @@ if(WITH_OTLP_HTTP) list(APPEND OPENTELEMETRY_OTLP_HTTP_TARGETS opentelemetry_exporter_otlp_http_metric) + + # + # opentelemetry_exporter_otlp_http_metric_builder + # + + add_library( + opentelemetry_exporter_otlp_http_metric_builder + ${OPENTELEMETRY_OTLP_TARGETS_LIB_TYPE} src/otlp_http_push_metric_builder.cc) + + set_target_properties( + opentelemetry_exporter_otlp_http_metric_builder + PROPERTIES EXPORT_NAME otlp_http_metric_exporter_builder) + set_target_version(opentelemetry_exporter_otlp_http_metric_builder) + + target_link_libraries(opentelemetry_exporter_otlp_http_metric_builder + PUBLIC opentelemetry_exporter_otlp_http_metric) + target_link_libraries(opentelemetry_exporter_otlp_http_metric_builder + PUBLIC opentelemetry_exporter_otlp_builder_utils) + + list(APPEND OPENTELEMETRY_OTLP_HTTP_BUILDER_TARGETS + opentelemetry_exporter_otlp_http_metric_builder) + endif() if(WITH_OTLP_FILE) + + # + # opentelemetry_exporter_otlp_file_client + # + add_library(opentelemetry_exporter_otlp_file_client ${OPENTELEMETRY_OTLP_TARGETS_LIB_TYPE} src/otlp_file_client.cc) set_target_properties(opentelemetry_exporter_otlp_file_client @@ -231,6 +413,10 @@ if(WITH_OTLP_FILE) list(APPEND OPENTELEMETRY_OTLP_FILE_TARGETS opentelemetry_exporter_otlp_file_client) + # + # opentelemetry_exporter_otlp_file + # + add_library( opentelemetry_exporter_otlp_file ${OPENTELEMETRY_OTLP_TARGETS_LIB_TYPE} src/otlp_file_exporter.cc @@ -247,6 +433,28 @@ if(WITH_OTLP_FILE) list(APPEND OPENTELEMETRY_OTLP_FILE_TARGETS opentelemetry_exporter_otlp_file) + # + # opentelemetry_exporter_otlp_file_builder + # + + add_library( + opentelemetry_exporter_otlp_file_builder + ${OPENTELEMETRY_OTLP_TARGETS_LIB_TYPE} src/otlp_file_span_builder.cc) + + set_target_properties(opentelemetry_exporter_otlp_file_builder + PROPERTIES EXPORT_NAME otlp_file_exporter_builder) + set_target_version(opentelemetry_exporter_otlp_file_builder) + + target_link_libraries(opentelemetry_exporter_otlp_file_builder + PUBLIC opentelemetry_exporter_otlp_file) + + list(APPEND OPENTELEMETRY_OTLP_FILE_BUILDER_TARGETS + opentelemetry_exporter_otlp_file_builder) + + # + # opentelemetry_exporter_otlp_file_log + # + add_library( opentelemetry_exporter_otlp_file_log ${OPENTELEMETRY_OTLP_TARGETS_LIB_TYPE} src/otlp_file_log_record_exporter.cc @@ -265,6 +473,29 @@ if(WITH_OTLP_FILE) list(APPEND OPENTELEMETRY_OTLP_FILE_TARGETS opentelemetry_exporter_otlp_file_log) + # + # opentelemetry_exporter_otlp_file_log_builder + # + + add_library( + opentelemetry_exporter_otlp_file_log_builder + ${OPENTELEMETRY_OTLP_TARGETS_LIB_TYPE} src/otlp_file_log_record_builder.cc) + + set_target_properties( + opentelemetry_exporter_otlp_file_log_builder + PROPERTIES EXPORT_NAME otlp_file_log_record_exporter_builder) + set_target_version(opentelemetry_exporter_otlp_file_log_builder) + + target_link_libraries(opentelemetry_exporter_otlp_file_log_builder + PUBLIC opentelemetry_exporter_otlp_file_log) + + list(APPEND OPENTELEMETRY_OTLP_FILE_BUILDER_TARGETS + opentelemetry_exporter_otlp_file_log_builder) + + # + # opentelemetry_exporter_otlp_file_metric + # + add_library( opentelemetry_exporter_otlp_file_metric ${OPENTELEMETRY_OTLP_TARGETS_LIB_TYPE} src/otlp_file_metric_exporter.cc @@ -282,6 +513,26 @@ if(WITH_OTLP_FILE) list(APPEND OPENTELEMETRY_OTLP_FILE_TARGETS opentelemetry_exporter_otlp_file_metric) + + # + # opentelemetry_exporter_otlp_file_metric_builder + # + + add_library( + opentelemetry_exporter_otlp_file_metric_builder + ${OPENTELEMETRY_OTLP_TARGETS_LIB_TYPE} src/otlp_file_push_metric_builder.cc) + + set_target_properties( + opentelemetry_exporter_otlp_file_metric_builder + PROPERTIES EXPORT_NAME otlp_file_metric_exporter_builder) + set_target_version(opentelemetry_exporter_otlp_file_metric_builder) + + target_link_libraries(opentelemetry_exporter_otlp_file_metric_builder + PUBLIC opentelemetry_exporter_otlp_file_metric) + + list(APPEND OPENTELEMETRY_OTLP_FILE_BUILDER_TARGETS + opentelemetry_exporter_otlp_file_metric_builder) + endif() target_link_libraries( @@ -302,6 +553,9 @@ otel_add_component( PATTERN "*.h" PATTERN + "otlp_builder_utils*.h" + EXCLUDE + PATTERN "otlp_http*.h" EXCLUDE PATTERN @@ -311,6 +565,19 @@ otel_add_component( "otlp_file*.h" EXCLUDE) +otel_add_component( + COMPONENT + exporter_otlp_builder_utils + TARGETS + opentelemetry_exporter_otlp_builder_utils + FILES_DIRECTORY + "include/opentelemetry/exporters/otlp" + FILES_DESTINATION + "include/opentelemetry/exporters" + FILES_MATCHING + PATTERN + "otlp_builder_utils.h") + if(WITH_OTLP_GRPC) otel_add_component( COMPONENT @@ -323,7 +590,34 @@ if(WITH_OTLP_GRPC) "include/opentelemetry/exporters" FILES_MATCHING PATTERN - "otlp_grpc*.h") + "otlp_grpc*.h" + PATTERN + "otlp_grpc_span_builder.h" + EXCLUDE + PATTERN + "otlp_grpc_log_record_builder.h" + EXCLUDE + PATTERN + "otlp_grpc_push_metric_builder.h" + EXCLUDE) + + otel_add_component( + COMPONENT + exporters_otlp_grpc_builder + TARGETS + ${OPENTELEMETRY_OTLP_GRPC_BUILDER_TARGETS} + FILES_DIRECTORY + "include/opentelemetry/exporters/otlp" + FILES_DESTINATION + "include/opentelemetry/exporters" + FILES_MATCHING + PATTERN + "otlp_grpc_span_builder.h" + PATTERN + "otlp_grpc_log_record_builder.h" + PATTERN + "otlp_grpc_push_metric_builder.h") + endif() if(WITH_OTLP_HTTP) @@ -338,7 +632,34 @@ if(WITH_OTLP_HTTP) "include/opentelemetry/exporters" FILES_MATCHING PATTERN - "otlp_http*.h") + "otlp_http*.h" + PATTERN + "otlp_http_span_builder.h" + EXCLUDE + PATTERN + "otlp_http_log_record_builder.h" + EXCLUDE + PATTERN + "otlp_http_push_metric_builder.h" + EXCLUDE) + + otel_add_component( + COMPONENT + exporters_otlp_http_builder + TARGETS + ${OPENTELEMETRY_OTLP_HTTP_BUILDER_TARGETS} + FILES_DIRECTORY + "include/opentelemetry/exporters/otlp" + FILES_DESTINATION + "include/opentelemetry/exporters" + FILES_MATCHING + PATTERN + "otlp_http_span_builder.h" + PATTERN + "otlp_http_log_record_builder.h" + PATTERN + "otlp_http_push_metric_builder.h") + endif() if(WITH_OTLP_FILE) @@ -353,7 +674,34 @@ if(WITH_OTLP_FILE) "include/opentelemetry/exporters" FILES_MATCHING PATTERN - "otlp_file*.h") + "otlp_file*.h" + PATTERN + "otlp_file_span_builder.h" + EXCLUDE + PATTERN + "otlp_file_log_record_builder.h" + EXCLUDE + PATTERN + "otlp_file_push_metric_builder.h" + EXCLUDE) + + otel_add_component( + COMPONENT + exporters_otlp_file_builder + TARGETS + ${OPENTELEMETRY_OTLP_FILE_BUILDER_TARGETS} + FILES_DIRECTORY + "include/opentelemetry/exporters/otlp" + FILES_DESTINATION + "include/opentelemetry/exporters" + FILES_MATCHING + PATTERN + "otlp_file_span_builder.h" + PATTERN + "otlp_file_log_record_builder.h" + PATTERN + "otlp_file_push_metric_builder.h") + endif() if(BUILD_TESTING) diff --git a/exporters/prometheus/CMakeLists.txt b/exporters/prometheus/CMakeLists.txt index d6eb288b9b..8b9e974169 100644 --- a/exporters/prometheus/CMakeLists.txt +++ b/exporters/prometheus/CMakeLists.txt @@ -1,6 +1,10 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 +# +# opentelemetry_exporter_prometheus +# + add_library( opentelemetry_exporter_prometheus src/exporter.cc src/exporter_options.cc src/exporter_factory.cc @@ -20,6 +24,25 @@ target_link_libraries( PUBLIC opentelemetry_metrics prometheus-cpp::core PRIVATE prometheus-cpp::pull) +# +# opentelemetry_exporter_prometheus_builder +# + +add_library(opentelemetry_exporter_prometheus_builder + src/prometheus_pull_builder.cc) + +set_target_properties(opentelemetry_exporter_prometheus_builder + PROPERTIES EXPORT_NAME prometheus_exporter_builder) +set_target_version(opentelemetry_exporter_prometheus_builder) + +target_include_directories( + opentelemetry_exporter_prometheus_builder + PUBLIC "$" + "$") + +target_link_libraries(opentelemetry_exporter_prometheus_builder + PUBLIC opentelemetry_exporter_prometheus) + otel_add_component( COMPONENT exporters_prometheus @@ -31,7 +54,23 @@ otel_add_component( "include/opentelemetry/exporters" FILES_MATCHING PATTERN - "*.h") + "*.h" + PATTERN + "prometheus_pull_builder.h" + EXCLUDE) + +otel_add_component( + COMPONENT + exporters_prometheus_builder + TARGETS + opentelemetry_exporter_prometheus_builder + FILES_DIRECTORY + "include/opentelemetry/exporters/prometheus" + FILES_DESTINATION + "include/opentelemetry/exporters" + FILES_MATCHING + PATTERN + "prometheus_pull_builder.h") if(BUILD_TESTING) add_subdirectory(test) diff --git a/exporters/zipkin/CMakeLists.txt b/exporters/zipkin/CMakeLists.txt index 9fc92ba7a5..c8e3e9be2f 100644 --- a/exporters/zipkin/CMakeLists.txt +++ b/exporters/zipkin/CMakeLists.txt @@ -1,6 +1,10 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 +# +# opentelemetry_exporter_zipkin_trace +# + add_library( opentelemetry_exporter_zipkin_trace src/zipkin_exporter.cc src/zipkin_exporter_factory.cc src/recordable.cc) @@ -20,6 +24,25 @@ target_link_libraries( PUBLIC opentelemetry_trace opentelemetry_http_client_curl nlohmann_json::nlohmann_json) +# +# opentelemetry_exporter_zipkin_trace_builder +# + +add_library(opentelemetry_exporter_zipkin_trace_builder src/zipkin_builder.cc) + +target_include_directories( + opentelemetry_exporter_zipkin_trace_builder + PUBLIC "$" + "$") + +set_target_properties(opentelemetry_exporter_zipkin_trace_builder + PROPERTIES EXPORT_NAME zipkin_trace_exporter_builder) + +set_target_version(opentelemetry_exporter_zipkin_trace_builder) + +target_link_libraries(opentelemetry_exporter_zipkin_trace_builder + PUBLIC opentelemetry_exporter_zipkin_trace) + otel_add_component( COMPONENT exporters_zipkin @@ -34,8 +57,24 @@ otel_add_component( "*.h" PATTERN "recordable.h" + EXCLUDE + PATTERN + "zipkin_builder.h" EXCLUDE) +otel_add_component( + COMPONENT + exporters_zipkin_builder + TARGETS + opentelemetry_exporter_zipkin_trace_builder + FILES_DIRECTORY + "include/opentelemetry/exporters/zipkin" + FILES_DESTINATION + "include/opentelemetry/exporters" + FILES_MATCHING + PATTERN + "zipkin_builder.h") + if(BUILD_TESTING) add_definitions(-DGTEST_LINKED_AS_SHARED_LIBRARY=1) diff --git a/functional/configuration/run_test.sh b/functional/configuration/run_test.sh new file mode 100755 index 0000000000..bb0a75515f --- /dev/null +++ b/functional/configuration/run_test.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +set -e + +# To run tests in a local dev environment: +# - make sure docker is running +# - set BUILD_DIR to the top level build directory, + +[ -z "${BUILD_DIR}" ] && export BUILD_DIR="${HOME}/build" + +export EXAMPLE_BIN_DIR="${BUILD_DIR}/examples/configuration/" + +# Make sure `example_yaml` is in the path +export PATH=${PATH}:${EXAMPLE_BIN_DIR} + +shelltest ./shelltests + diff --git a/functional/configuration/shelltests/disabled_empty.test b/functional/configuration/shelltests/disabled_empty.test new file mode 100644 index 0000000000..ce1e5dc10f --- /dev/null +++ b/functional/configuration/shelltests/disabled_empty.test @@ -0,0 +1,8 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +$ example_yaml --test --yaml shelltests/disabled_empty.yaml +> +MODEL PARSED +SDK CREATED +>= 0 diff --git a/functional/configuration/shelltests/disabled_empty.yaml b/functional/configuration/shelltests/disabled_empty.yaml new file mode 100644 index 0000000000..e33eb38ebb --- /dev/null +++ b/functional/configuration/shelltests/disabled_empty.yaml @@ -0,0 +1,5 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +file_format: 0.0 +disabled: diff --git a/functional/configuration/shelltests/disabled_false.test b/functional/configuration/shelltests/disabled_false.test new file mode 100644 index 0000000000..46cf173f5c --- /dev/null +++ b/functional/configuration/shelltests/disabled_false.test @@ -0,0 +1,8 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +$ example_yaml --test --yaml shelltests/disabled_false.yaml +> +MODEL PARSED +SDK CREATED +>= 0 diff --git a/functional/configuration/shelltests/disabled_false.yaml b/functional/configuration/shelltests/disabled_false.yaml new file mode 100644 index 0000000000..4cff2e08fe --- /dev/null +++ b/functional/configuration/shelltests/disabled_false.yaml @@ -0,0 +1,5 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +file_format: 0.0 +disabled: false diff --git a/functional/configuration/shelltests/disabled_true.test b/functional/configuration/shelltests/disabled_true.test new file mode 100644 index 0000000000..fae4b946f3 --- /dev/null +++ b/functional/configuration/shelltests/disabled_true.test @@ -0,0 +1,8 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +$ example_yaml --test --yaml shelltests/disabled_true.yaml +> +MODEL PARSED +SDK CREATED +>= 0 diff --git a/functional/configuration/shelltests/disabled_true.yaml b/functional/configuration/shelltests/disabled_true.yaml new file mode 100644 index 0000000000..c40ad924d6 --- /dev/null +++ b/functional/configuration/shelltests/disabled_true.yaml @@ -0,0 +1,5 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +file_format: 0.0 +disabled: true diff --git a/functional/configuration/shelltests/empty.test b/functional/configuration/shelltests/empty.test new file mode 100644 index 0000000000..ba6869976d --- /dev/null +++ b/functional/configuration/shelltests/empty.test @@ -0,0 +1,8 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +$ example_yaml --test --yaml shelltests/empty.yaml +> +[ERROR] [Yaml Configuration Parser] Parse failed with exception: Yaml: not a map, looking for: file_format +FAILED TO PARSE MODEL +>= 1 diff --git a/functional/configuration/shelltests/empty.yaml b/functional/configuration/shelltests/empty.yaml new file mode 100644 index 0000000000..b1bc75271a --- /dev/null +++ b/functional/configuration/shelltests/empty.yaml @@ -0,0 +1,4 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +# empty yaml file diff --git a/functional/configuration/shelltests/format_empty.test b/functional/configuration/shelltests/format_empty.test new file mode 100644 index 0000000000..820cea69a1 --- /dev/null +++ b/functional/configuration/shelltests/format_empty.test @@ -0,0 +1,8 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +$ example_yaml --test --yaml shelltests/format_empty.yaml +> +[ERROR] [Yaml Configuration Parser] Parse failed with exception: Yaml: string value is empty: file_format +FAILED TO PARSE MODEL +>= 1 diff --git a/functional/configuration/shelltests/format_empty.yaml b/functional/configuration/shelltests/format_empty.yaml new file mode 100644 index 0000000000..44987ecc7f --- /dev/null +++ b/functional/configuration/shelltests/format_empty.yaml @@ -0,0 +1,5 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +# This must fail +file_format: diff --git a/functional/configuration/shelltests/kitchen-sink.test b/functional/configuration/shelltests/kitchen-sink.test new file mode 100644 index 0000000000..24d58a03c5 --- /dev/null +++ b/functional/configuration/shelltests/kitchen-sink.test @@ -0,0 +1,46 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +$ example_yaml --test --yaml shelltests/kitchen-sink.yaml | egrep -v "(observed_timestamp|trace_id|span_id)" +> +MODEL PARSED +[WARNING] attribute_limits not supported, ignoring +[WARNING] IncludeExclude attribute processor not supported, ignoring +[WARNING] metric producer not supported, ignoring +[WARNING] metric producer not supported, ignoring +[WARNING] [Periodic Exporting Metric Reader] Invalid configuration: export_timeout_millis_ should be less than export_interval_millis_, using default values +[WARNING] [Periodic Exporting Metric Reader] Invalid configuration: export_timeout_millis_ should be less than export_interval_millis_, using default values +[WARNING] [Periodic Exporting Metric Reader] Invalid configuration: export_timeout_millis_ should be less than export_interval_millis_, using default values +[WARNING] [Periodic Exporting Metric Reader] Invalid configuration: export_timeout_millis_ should be less than export_interval_millis_, using default values +SDK CREATED +{ + timestamp : 0 + severity_num : 5 + severity_text : DEBUG + body : body + resource : + telemetry.sdk.version: 1.22.0 + service.version: 1.0.0 + double_array_key: [1.1,2.2] + double_key: 1.1 + bool_key: 1 + int_array_key: [1,2] + int_key: 1 + string_array_key: [value1,value2] + string_key: value + service.namespace: my-namespace + telemetry.sdk.language: cpp + bool_array_key: [1,0] + service.name: unknown_service + telemetry.sdk.name: opentelemetry + attributes : + event_id : 0 + event_name : + trace_flags : 00 + scope : + name : foo_library + version : + schema_url : + attributes : +} +>= 0 diff --git a/functional/configuration/shelltests/kitchen-sink.yaml b/functional/configuration/shelltests/kitchen-sink.yaml new file mode 100644 index 0000000000..de8d00be68 --- /dev/null +++ b/functional/configuration/shelltests/kitchen-sink.yaml @@ -0,0 +1,957 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +# kitchen-sink.yaml demonstrates all configurable surface area, including explanatory comments. +# +# It DOES NOT represent expected real world configuration, as it makes strange configuration +# choices in an effort to exercise the full surface area. +# +# Configuration values are set to their defaults when default values are defined. + +# The file format version. +# The yaml format is documented at +# https://github.com/open-telemetry/opentelemetry-configuration/tree/main/schema +file_format: "1.0-rc.1" +# Configure if the SDK is disabled or not. +# If omitted or null, false is used. +disabled: false +# Configure the log level of the internal logger used by the SDK. +# If omitted, info is used. +log_level: info +# Configure general attribute limits. See also tracer_provider.limits, logger_provider.limits. +attribute_limits: + # Configure max attribute value size. + # Value must be non-negative. + # If omitted or null, there is no limit. + attribute_value_length_limit: 4096 + # Configure max attribute count. + # Value must be non-negative. + # If omitted or null, 128 is used. + attribute_count_limit: 128 +# Configure logger provider. +# If omitted, a noop logger provider is used. +logger_provider: + # Configure log record processors. + processors: + - # Configure a batch log record processor. + batch: + # Configure delay interval (in milliseconds) between two consecutive exports. + # Value must be non-negative. + # If omitted or null, 1000 is used. + schedule_delay: 5000 + # Configure maximum allowed time (in milliseconds) to export data. + # Value must be non-negative. A value of 0 indicates no limit (infinity). + # If omitted or null, 30000 is used. + export_timeout: 30000 + # Configure maximum queue size. Value must be positive. + # If omitted or null, 2048 is used. + max_queue_size: 2048 + # Configure maximum batch size. Value must be positive. + # If omitted or null, 512 is used. + max_export_batch_size: 512 + # Configure exporter. + exporter: + # Configure exporter to be OTLP with HTTP transport. + otlp_http: + endpoint: http://localhost:4318/v1/logs + # Configure certificate used to verify a server's TLS credentials. + # Absolute path to certificate file in PEM format. + # If omitted or null, system default certificate verification is used for secure connections. + certificate_file: /app/cert.pem + # Configure mTLS private client key. + # Absolute path to client key file in PEM format. If set, .client_certificate must also be set. + # If omitted or null, mTLS is not used. + client_key_file: /app/cert.pem + # Configure mTLS client certificate. + # Absolute path to client certificate file in PEM format. If set, .client_key must also be set. + # If omitted or null, mTLS is not used. + client_certificate_file: /app/cert.pem + # Configure headers. Entries have higher priority than entries from .headers_list. + # If an entry's .value is null, the entry is ignored. + headers: + - name: api-key + value: "1234" + # Configure headers. Entries have lower priority than entries from .headers. + # The value is a list of comma separated key-value pairs matching the format of OTEL_EXPORTER_OTLP_HEADERS. See https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md#configuration-options for details. + # If omitted or null, no headers are added. + headers_list: "api-key=1234" + # Configure compression. + # Values include: gzip, none. Implementations may support other compression algorithms. + # If omitted or null, none is used. + compression: gzip + # Configure max time (in milliseconds) to wait for each export. + # Value must be non-negative. A value of 0 indicates no limit (infinity). + # If omitted or null, 10000 is used. + timeout: 10000 + # Configure the encoding used for messages. + # Values include: protobuf, json. Implementations may not support json. + # If omitted or null, protobuf is used. + encoding: protobuf + - # Configure a batch log record processor. + batch: + # Configure exporter. + exporter: + # Configure exporter to be OTLP with gRPC transport. + otlp_grpc: + # Configure endpoint. + # If omitted or null, http://localhost:4317 is used. + endpoint: http://localhost:4317 + # Configure certificate used to verify a server's TLS credentials. + # Absolute path to certificate file in PEM format. + # If omitted or null, system default certificate verification is used for secure connections. + certificate_file: /app/cert.pem + # Configure mTLS private client key. + # Absolute path to client key file in PEM format. If set, .client_certificate must also be set. + # If omitted or null, mTLS is not used. + client_key_file: /app/cert.pem + # Configure mTLS client certificate. + # Absolute path to client certificate file in PEM format. If set, .client_key must also be set. + # If omitted or null, mTLS is not used. + client_certificate_file: /app/cert.pem + # Configure headers. Entries have higher priority than entries from .headers_list. + # If an entry's .value is null, the entry is ignored. + headers: + - name: api-key + value: "1234" + # Configure headers. Entries have lower priority than entries from .headers. + # The value is a list of comma separated key-value pairs matching the format of OTEL_EXPORTER_OTLP_HEADERS. See https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md#configuration-options for details. + # If omitted or null, no headers are added. + headers_list: "api-key=1234" + # Configure compression. + # Values include: gzip, none. Implementations may support other compression algorithms. + # If omitted or null, none is used. + compression: gzip + # Configure max time (in milliseconds) to wait for each export. + # Value must be non-negative. A value of 0 indicates no limit (infinity). + # If omitted or null, 10000 is used. + timeout: 10000 + # Configure client transport security for the exporter's connection. + # Only applicable when .endpoint is provided without http or https scheme. Implementations may choose to ignore .insecure. + # If omitted or null, false is used. + insecure: false + - # Configure a batch log record processor. + batch: + # Configure exporter. + exporter: + # Configure exporter to be OTLP with file transport. + # This type is in development and subject to breaking changes in minor versions. + otlp_file/development: + # Configure output stream. + # Values include stdout, or scheme+destination. For example: file:///path/to/file.jsonl. + # If omitted or null, stdout is used. + output_stream: file:///var/log/logs.jsonl + - # Configure a batch log record processor. + batch: + # Configure exporter. + exporter: + # Configure exporter to be OTLP with file transport. + # This type is in development and subject to breaking changes in minor versions. + otlp_file/development: + # Configure output stream. + # Values include stdout, or scheme+destination. For example: file:///path/to/file.jsonl. + # If omitted or null, stdout is used. + output_stream: stdout + - # Configure a simple log record processor. + simple: + # Configure exporter. + exporter: + # Configure exporter to be console. + console: + # Configure log record limits. See also attribute_limits. + limits: + # Configure max attribute value size. Overrides .attribute_limits.attribute_value_length_limit. + # Value must be non-negative. + # If omitted or null, there is no limit. + attribute_value_length_limit: 4096 + # Configure max attribute count. Overrides .attribute_limits.attribute_count_limit. + # Value must be non-negative. + # If omitted or null, 128 is used. + attribute_count_limit: 128 + # Configure loggers. + # This type is in development and subject to breaking changes in minor versions. + logger_configurator/development: + # Configure the default logger config used there is no matching entry in .logger_configurator/development.loggers. + default_config: + # Configure if the logger is enabled or not. + disabled: true + # Configure loggers. + loggers: + - # Configure logger names to match, evaluated as follows: + # + # * If the logger name exactly matches. + # * If the logger name matches the wildcard pattern, where '?' matches any single character and '*' matches any number of characters including none. + name: io.opentelemetry.contrib.* + # The logger config. + config: + # Configure if the logger is enabled or not. + disabled: false +# Configure meter provider. +# If omitted, a noop meter provider is used. +meter_provider: + # Configure metric readers. + readers: + - # Configure a pull based metric reader. + pull: + # Configure exporter. + exporter: + # Configure exporter to be prometheus. + # This type is in development and subject to breaking changes in minor versions. + prometheus/development: + # Configure host. + # If omitted or null, localhost is used. + host: localhost + # Configure port. + # If omitted or null, 9464 is used. + port: 9464 + # Configure Prometheus Exporter to produce metrics without a unit suffix or UNIT metadata. + # If omitted or null, false is used. + without_units: false + # Configure Prometheus Exporter to produce metrics without a type suffix. + # If omitted or null, false is used. + without_type_suffix: false + # Configure Prometheus Exporter to produce metrics without a scope info metric. + # If omitted or null, false is used. + without_scope_info: false + # Configure Prometheus Exporter to add resource attributes as metrics attributes. + with_resource_constant_labels: + # Configure resource attributes to be included. + # Attribute keys from resources are evaluated to match as follows: + # * If the value of the attribute key exactly matches. + # * If the value of the attribute key matches the wildcard pattern, where '?' matches any single character and '*' matches any number of characters including none. + # If omitted, no resource attributes are included. + included: + - "service*" + # Configure resource attributes to be excluded. Applies after .with_resource_constant_labels.included (i.e. excluded has higher priority than included). + # Attribute keys from resources are evaluated to match as follows: + # * If the value of the attribute key exactly matches. + # * If the value of the attribute key matches the wildcard pattern, where '?' matches any single character and '*' matches any number of characters including none. + # If omitted, .included resource attributes are included. + excluded: + - "service.attr1" + # Configure metric producers. + producers: + - # Configure metric producer to be opencensus. + opencensus: + # Configure cardinality limits. + cardinality_limits: + # Configure default cardinality limit for all instrument types. + # Instrument-specific cardinality limits take priority. + # If omitted or null, 2000 is used. + default: 2000 + # Configure default cardinality limit for counter instruments. + # If omitted or null, the value from .default is used. + counter: 2000 + # Configure default cardinality limit for gauge instruments. + # If omitted or null, the value from .default is used. + gauge: 2000 + # Configure default cardinality limit for histogram instruments. + # If omitted or null, the value from .default is used. + histogram: 2000 + # Configure default cardinality limit for observable_counter instruments. + # If omitted or null, the value from .default is used. + observable_counter: 2000 + # Configure default cardinality limit for observable_gauge instruments. + # If omitted or null, the value from .default is used. + observable_gauge: 2000 + # Configure default cardinality limit for observable_up_down_counter instruments. + # If omitted or null, the value from .default is used. + observable_up_down_counter: 2000 + # Configure default cardinality limit for up_down_counter instruments. + # If omitted or null, the value from .default is used. + up_down_counter: 2000 + - # Configure a periodic metric reader. + periodic: + # Configure delay interval (in milliseconds) between start of two consecutive exports. + # Value must be non-negative. + # If omitted or null, 60000 is used. + interval: 60000 + # Configure maximum allowed time (in milliseconds) to export data. + # Value must be non-negative. A value of 0 indicates no limit (infinity). + # If omitted or null, 30000 is used. + timeout: 30000 + # Configure exporter. + exporter: + # Configure exporter to be OTLP with HTTP transport. + otlp_http: + # Configure endpoint, including the metric specific path. + # If omitted or null, http://localhost:4318/v1/metrics is used. + endpoint: http://localhost:4318/v1/metrics + # Configure certificate used to verify a server's TLS credentials. + # Absolute path to certificate file in PEM format. + # If omitted or null, system default certificate verification is used for secure connections. + certificate_file: /app/cert.pem + # Configure mTLS private client key. + # Absolute path to client key file in PEM format. If set, .client_certificate must also be set. + # If omitted or null, mTLS is not used. + client_key_file: /app/cert.pem + # Configure mTLS client certificate. + # Absolute path to client certificate file in PEM format. If set, .client_key must also be set. + # If omitted or null, mTLS is not used. + client_certificate_file: /app/cert.pem + # Configure headers. Entries have higher priority than entries from .headers_list. + # If an entry's .value is null, the entry is ignored. + headers: + - name: api-key + value: "1234" + # Configure headers. Entries have lower priority than entries from .headers. + # The value is a list of comma separated key-value pairs matching the format of OTEL_EXPORTER_OTLP_HEADERS. See https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md#configuration-options for details. + # If omitted or null, no headers are added. + headers_list: "api-key=1234" + # Configure compression. + # Values include: gzip, none. Implementations may support other compression algorithms. + # If omitted or null, none is used. + compression: gzip + # Configure max time (in milliseconds) to wait for each export. + # Value must be non-negative. A value of 0 indicates no limit (infinity). + # If omitted or null, 10000 is used. + timeout: 10000 + # Configure the encoding used for messages. + # Values include: protobuf, json. Implementations may not support json. + # If omitted or null, protobuf is used. + encoding: protobuf + # Configure temporality preference. + # Values include: cumulative, delta, low_memory. For behavior of values, see https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk_exporters/otlp.md. + # If omitted or null, cumulative is used. + temporality_preference: delta + # Configure default histogram aggregation. + # Values include: explicit_bucket_histogram, base2_exponential_bucket_histogram. For behavior of values, see https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk_exporters/otlp.md. + # If omitted or null, explicit_bucket_histogram is used. + default_histogram_aggregation: base2_exponential_bucket_histogram + # Configure metric producers. + producers: + - # Configure metric producer to be prometheus. + prometheus: + # Configure cardinality limits. + cardinality_limits: + # Configure default cardinality limit for all instrument types. + # Instrument-specific cardinality limits take priority. + # If omitted or null, 2000 is used. + default: 2000 + # Configure default cardinality limit for counter instruments. + # If omitted or null, the value from .default is used. + counter: 2000 + # Configure default cardinality limit for gauge instruments. + # If omitted or null, the value from .default is used. + gauge: 2000 + # Configure default cardinality limit for histogram instruments. + # If omitted or null, the value from .default is used. + histogram: 2000 + # Configure default cardinality limit for observable_counter instruments. + # If omitted or null, the value from .default is used. + observable_counter: 2000 + # Configure default cardinality limit for observable_gauge instruments. + # If omitted or null, the value from .default is used. + observable_gauge: 2000 + # Configure default cardinality limit for observable_up_down_counter instruments. + # If omitted or null, the value from .default is used. + observable_up_down_counter: 2000 + # Configure default cardinality limit for up_down_counter instruments. + # If omitted or null, the value from .default is used. + up_down_counter: 2000 + - # Configure a periodic metric reader. + periodic: + # Configure exporter. + exporter: + # Configure exporter to be OTLP with gRPC transport. + otlp_grpc: + # Configure endpoint. + # If omitted or null, http://localhost:4317 is used. + endpoint: http://localhost:4317 + # Configure certificate used to verify a server's TLS credentials. + # Absolute path to certificate file in PEM format. + # If omitted or null, system default certificate verification is used for secure connections. + certificate_file: /app/cert.pem + # Configure mTLS private client key. + # Absolute path to client key file in PEM format. If set, .client_certificate must also be set. + # If omitted or null, mTLS is not used. + client_key_file: /app/cert.pem + # Configure mTLS client certificate. + # Absolute path to client certificate file in PEM format. If set, .client_key must also be set. + # If omitted or null, mTLS is not used. + client_certificate_file: /app/cert.pem + # Configure headers. Entries have higher priority than entries from .headers_list. + # If an entry's .value is null, the entry is ignored. + headers: + - name: api-key + value: "1234" + # Configure headers. Entries have lower priority than entries from .headers. + # The value is a list of comma separated key-value pairs matching the format of OTEL_EXPORTER_OTLP_HEADERS. See https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md#configuration-options for details. + # If omitted or null, no headers are added. + headers_list: "api-key=1234" + # Configure compression. + # Values include: gzip, none. Implementations may support other compression algorithms. + # If omitted or null, none is used. + compression: gzip + # Configure max time (in milliseconds) to wait for each export. + # Value must be non-negative. A value of 0 indicates no limit (infinity). + # If omitted or null, 10000 is used. + timeout: 10000 + # Configure client transport security for the exporter's connection. + # Only applicable when .endpoint is provided without http or https scheme. Implementations may choose to ignore .insecure. + # If omitted or null, false is used. + insecure: false + # Configure temporality preference. + # Values include: cumulative, delta, low_memory. For behavior of values, see https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk_exporters/otlp.md. + # If omitted or null, cumulative is used. + temporality_preference: delta + # Configure default histogram aggregation. + # Values include: explicit_bucket_histogram, base2_exponential_bucket_histogram. For behavior of values, see https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk_exporters/otlp.md. + # If omitted or null, explicit_bucket_histogram is used. + default_histogram_aggregation: base2_exponential_bucket_histogram + - # Configure a periodic metric reader. + periodic: + # Configure exporter. + exporter: + # Configure exporter to be OTLP with file transport. + # This type is in development and subject to breaking changes in minor versions. + otlp_file/development: + # Configure output stream. + # Values include stdout, or scheme+destination. For example: file:///path/to/file.jsonl. + # If omitted or null, stdout is used. + output_stream: file:///var/log/metrics.jsonl + # Configure temporality preference. Values include: cumulative, delta, low_memory. For behavior of values, see https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk_exporters/otlp.md. + # If omitted or null, cumulative is used. + temporality_preference: delta + # Configure default histogram aggregation. Values include: explicit_bucket_histogram, base2_exponential_bucket_histogram. For behavior of values, see https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk_exporters/otlp.md. + # If omitted or null, explicit_bucket_histogram is used. + default_histogram_aggregation: base2_exponential_bucket_histogram + - # Configure a periodic metric reader. + periodic: + # Configure exporter. + exporter: + # Configure exporter to be OTLP with file transport. + # This type is in development and subject to breaking changes in minor versions. + otlp_file/development: + # Configure output stream. + # Values include stdout, or scheme+destination. For example: file:///path/to/file.jsonl. + # If omitted or null, stdout is used. + output_stream: stdout + # Configure temporality preference. Values include: cumulative, delta, low_memory. For behavior of values, see https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk_exporters/otlp.md. + # If omitted or null, cumulative is used. + temporality_preference: delta + # Configure default histogram aggregation. Values include: explicit_bucket_histogram, base2_exponential_bucket_histogram. For behavior of values, see https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk_exporters/otlp.md. + # If omitted or null, explicit_bucket_histogram is used. + default_histogram_aggregation: base2_exponential_bucket_histogram + - # Configure a periodic metric reader. + periodic: + # Configure exporter. + exporter: + # Configure exporter to be console. + console: + # Configure views. + # Each view has a selector which determines the instrument(s) it applies to, and a configuration for the resulting stream(s). + views: + - # Configure view selector. + # Selection criteria is additive as described in https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk.md#instrument-selection-criteria. + selector: + # Configure instrument name selection criteria. + # If omitted or null, all instrument names match. + instrument_name: my-instrument + # Configure instrument type selection criteria. + # Values include: counter, gauge, histogram, observable_counter, observable_gauge, observable_up_down_counter, up_down_counter. + # If omitted or null, all instrument types match. + instrument_type: histogram + # Configure the instrument unit selection criteria. + # If omitted or null, all instrument units match. + unit: ms + # Configure meter name selection criteria. + # If omitted or null, all meter names match. + meter_name: my-meter + # Configure meter version selection criteria. + # If omitted or null, all meter versions match. + meter_version: 1.0.0 + # Configure meter schema url selection criteria. + # If omitted or null, all meter schema URLs match. + meter_schema_url: https://opentelemetry.io/schemas/1.16.0 + # Configure view stream. + stream: + # Configure metric name of the resulting stream(s). + # If omitted or null, the instrument's original name is used. + name: new_instrument_name + # Configure metric description of the resulting stream(s). + # If omitted or null, the instrument's origin description is used. + description: new_description + # Configure aggregation of the resulting stream(s). + # Values include: default, drop, explicit_bucket_histogram, base2_exponential_bucket_histogram, last_value, sum. For behavior of values see https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk.md#aggregation. + # If omitted, default is used. + aggregation: + # Configure aggregation to be explicit_bucket_histogram. + explicit_bucket_histogram: + # Configure bucket boundaries. + # If omitted, [0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, 7500, 10000] is used. + boundaries: + [ + 0.0, + 5.0, + 10.0, + 25.0, + 50.0, + 75.0, + 100.0, + 250.0, + 500.0, + 750.0, + 1000.0, + 2500.0, + 5000.0, + 7500.0, + 10000.0 + ] + # Configure record min and max. + # If omitted or null, true is used. + record_min_max: true + # Configure the aggregation cardinality limit. + # If omitted or null, the metric reader's default cardinality limit is used. + aggregation_cardinality_limit: 2000 + # Configure attribute keys retained in the resulting stream(s). + attribute_keys: + # Configure list of attribute keys to include in the resulting stream(s). All other attributes are dropped. + # If omitted, all attributes are included. + included: + - key1 + - key2 + # Configure list of attribute keys to exclude from the resulting stream(s). Applies after .attribute_keys.included (i.e. excluded has higher priority than included). + # If omitted, .attribute_keys.included are included. + excluded: + - key3 + # Configure the exemplar filter. + # Values include: trace_based, always_on, always_off. For behavior of values see https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/configuration/sdk-environment-variables.md#metrics-sdk-configuration. + # If omitted or null, trace_based is used. + exemplar_filter: trace_based + # Configure meters. + # This type is in development and subject to breaking changes in minor versions. + meter_configurator/development: + # Configure the default meter config used there is no matching entry in .meter_configurator/development.meters. + default_config: + # Configure if the meter is enabled or not. + disabled: true + # Configure meters. + meters: + - # Configure meter names to match, evaluated as follows: + # + # * If the meter name exactly matches. + # * If the meter name matches the wildcard pattern, where '?' matches any single character and '*' matches any number of characters including none. + name: io.opentelemetry.contrib.* + # The meter config. + config: + # Configure if the meter is enabled or not. + disabled: false +# Configure text map context propagators. +# If omitted, a noop propagator is used. +propagator: + # Configure the propagators in the composite text map propagator. Entries from .composite_list are appended to the list here with duplicates filtered out. + # Built-in propagator keys include: tracecontext, baggage, b3, b3multi, jaeger, ottrace. Known third party keys include: xray. + # If the resolved list of propagators (from .composite and .composite_list) is empty, a noop propagator is used. + composite: + - # Include the w3c trace context propagator. + tracecontext: + - # Include the w3c baggage propagator. + baggage: + - # Include the zipkin b3 propagator. + b3: + - # Include the zipkin b3 multi propagator. + b3multi: + - # Include the jaeger propagator. + jaeger: + +# ottrace not supported in opentelemetry-cpp +# - # Include the opentracing propagator. +# ottrace: + + # Configure the propagators in the composite text map propagator. Entries are appended to .composite with duplicates filtered out. + # The value is a comma separated list of propagator identifiers matching the format of OTEL_PROPAGATORS. See https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/configuration/sdk-environment-variables.md#general-sdk-configuration for details. + # Built-in propagator identifiers include: tracecontext, baggage, b3, b3multi, jaeger, ottrace. Known third party identifiers include: xray. + # If the resolved list of propagators (from .composite and .composite_list) is empty, a noop propagator is used. +# composite_list: "tracecontext,baggage,b3,b3multi,jaeger,ottrace,xray" + +# ottrace, xray not supported in opentelemetry-cpp + composite_list: "tracecontext,baggage,b3,b3multi,jaeger" + +# Configure tracer provider. +# If omitted, a noop tracer provider is used. +tracer_provider: + # Configure span processors. + processors: + - # Configure a batch span processor. + batch: + # Configure delay interval (in milliseconds) between two consecutive exports. + # Value must be non-negative. + # If omitted or null, 5000 is used. + schedule_delay: 5000 + # Configure maximum allowed time (in milliseconds) to export data. + # Value must be non-negative. A value of 0 indicates no limit (infinity). + # If omitted or null, 30000 is used. + export_timeout: 30000 + # Configure maximum queue size. Value must be positive. + # If omitted or null, 2048 is used. + max_queue_size: 2048 + # Configure maximum batch size. Value must be positive. + # If omitted or null, 512 is used. + max_export_batch_size: 512 + # Configure exporter. + exporter: + # Configure exporter to be OTLP with HTTP transport. + otlp_http: + # Configure endpoint, including the trace specific path. + # If omitted or null, http://localhost:4318/v1/traces is used. + endpoint: http://localhost:4318/v1/traces + # Configure certificate used to verify a server's TLS credentials. + # Absolute path to certificate file in PEM format. + # If omitted or null, system default certificate verification is used for secure connections. + certificate_file: /app/cert.pem + # Configure mTLS private client key. + # Absolute path to client key file in PEM format. If set, .client_certificate must also be set. + # If omitted or null, mTLS is not used. + client_key_file: /app/cert.pem + # Configure mTLS client certificate. + # Absolute path to client certificate file in PEM format. If set, .client_key must also be set. + # If omitted or null, mTLS is not used. + client_certificate_file: /app/cert.pem + # Configure headers. Entries have higher priority than entries from .headers_list. + # If an entry's .value is null, the entry is ignored. + headers: + - name: api-key + value: "1234" + # Configure headers. Entries have lower priority than entries from .headers. + # The value is a list of comma separated key-value pairs matching the format of OTEL_EXPORTER_OTLP_HEADERS. See https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md#configuration-options for details. + # If omitted or null, no headers are added. + headers_list: "api-key=1234" + # Configure compression. + # Values include: gzip, none. Implementations may support other compression algorithms. + # If omitted or null, none is used. + compression: gzip + # Configure max time (in milliseconds) to wait for each export. + # Value must be non-negative. A value of 0 indicates no limit (infinity). + # If omitted or null, 10000 is used. + timeout: 10000 + # Configure the encoding used for messages. + # Values include: protobuf, json. Implementations may not support json. + # If omitted or null, protobuf is used. + encoding: protobuf + - # Configure a batch span processor. + batch: + # Configure exporter. + exporter: + # Configure exporter to be OTLP with gRPC transport. + otlp_grpc: + # Configure endpoint. + # If omitted or null, http://localhost:4317 is used. + endpoint: http://localhost:4317 + # Configure certificate used to verify a server's TLS credentials. + # Absolute path to certificate file in PEM format. + # If omitted or null, system default certificate verification is used for secure connections. + certificate_file: /app/cert.pem + # Configure mTLS private client key. + # Absolute path to client key file in PEM format. If set, .client_certificate must also be set. + # If omitted or null, mTLS is not used. + client_key_file: /app/cert.pem + # Configure mTLS client certificate. + # Absolute path to client certificate file in PEM format. If set, .client_key must also be set. + # If omitted or null, mTLS is not used. + client_certificate_file: /app/cert.pem + # Configure headers. Entries have higher priority than entries from .headers_list. + # If an entry's .value is null, the entry is ignored. + headers: + - name: api-key + value: "1234" + # Configure headers. Entries have lower priority than entries from .headers. + # The value is a list of comma separated key-value pairs matching the format of OTEL_EXPORTER_OTLP_HEADERS. See https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md#configuration-options for details. + # If omitted or null, no headers are added. + headers_list: "api-key=1234" + # Configure compression. + # Values include: gzip, none. Implementations may support other compression algorithms. + # If omitted or null, none is used. + compression: gzip + # Configure max time (in milliseconds) to wait for each export. + # Value must be non-negative. A value of 0 indicates no limit (infinity). + # If omitted or null, 10000 is used. + timeout: 10000 + # Configure client transport security for the exporter's connection. + # Only applicable when .endpoint is provided without http or https scheme. Implementations may choose to ignore .insecure. + # If omitted or null, false is used. + insecure: false + - # Configure a batch span processor. + batch: + # Configure exporter. + exporter: + # Configure exporter to be OTLP with file transport. + # This type is in development and subject to breaking changes in minor versions. + otlp_file/development: + # Configure output stream. + # Values include stdout, or scheme+destination. For example: file:///path/to/file.jsonl. + # If omitted or null, stdout is used. + output_stream: file:///var/log/traces.jsonl + - # Configure a batch span processor. + batch: + # Configure exporter. + exporter: + # Configure exporter to be OTLP with file transport. + # This type is in development and subject to breaking changes in minor versions. + otlp_file/development: + # Configure output stream. + # Values include stdout, or scheme+destination. For example: file:///path/to/file.jsonl. + # If omitted or null, stdout is used. + output_stream: stdout + - # Configure a batch span processor. + batch: + # Configure exporter. + exporter: + # Configure exporter to be zipkin. + zipkin: + # Configure endpoint. + # If omitted or null, http://localhost:9411/api/v2/spans is used. + endpoint: http://localhost:9411/api/v2/spans + # Configure max time (in milliseconds) to wait for each export. + # Value must be non-negative. A value of 0 indicates indefinite. + # If omitted or null, 10000 is used. + timeout: 10000 + - # Configure a simple span processor. + simple: + # Configure exporter. + exporter: + # Configure exporter to be console. + console: + # Configure span limits. See also attribute_limits. + limits: + # Configure max attribute value size. Overrides .attribute_limits.attribute_value_length_limit. + # Value must be non-negative. + # If omitted or null, there is no limit. + attribute_value_length_limit: 4096 + # Configure max attribute count. Overrides .attribute_limits.attribute_count_limit. + # Value must be non-negative. + # If omitted or null, 128 is used. + attribute_count_limit: 128 + # Configure max span event count. + # Value must be non-negative. + # If omitted or null, 128 is used. + event_count_limit: 128 + # Configure max span link count. + # Value must be non-negative. + # If omitted or null, 128 is used. + link_count_limit: 128 + # Configure max attributes per span event. + # Value must be non-negative. + # If omitted or null, 128 is used. + event_attribute_count_limit: 128 + # Configure max attributes per span link. + # Value must be non-negative. + # If omitted or null, 128 is used. + link_attribute_count_limit: 128 + # Configure the sampler. + # If omitted, parent based sampler with a root of always_on is used. + sampler: + # Configure sampler to be parent_based. + parent_based: + # Configure root sampler. + # If omitted or null, always_on is used. + root: + # Configure sampler to be trace_id_ratio_based. + trace_id_ratio_based: + # Configure trace_id_ratio. + # If omitted or null, 1.0 is used. + ratio: 0.0001 + # Configure remote_parent_sampled sampler. + # If omitted or null, always_on is used. + remote_parent_sampled: + # Configure sampler to be always_on. + always_on: + # Configure remote_parent_not_sampled sampler. + # If omitted or null, always_off is used. + remote_parent_not_sampled: + # Configure sampler to be always_off. + always_off: + # Configure local_parent_sampled sampler. + # If omitted or null, always_on is used. + local_parent_sampled: + # Configure sampler to be always_on. + always_on: + # Configure local_parent_not_sampled sampler. + # If omitted or null, always_off is used. + local_parent_not_sampled: + # Configure sampler to be always_off. + always_off: + # Configure tracers. + # This type is in development and subject to breaking changes in minor versions. + tracer_configurator/development: + # Configure the default tracer config used there is no matching entry in .tracer_configurator/development.tracers. + default_config: + # Configure if the tracer is enabled or not. + disabled: true + # Configure tracers. + tracers: + - # Configure tracer names to match, evaluated as follows: + # + # * If the tracer name exactly matches. + # * If the tracer name matches the wildcard pattern, where '?' matches any single character and '*' matches any number of characters including none. + name: io.opentelemetry.contrib.* + # The tracer config. + config: + # Configure if the tracer is enabled or not. + disabled: false +# Configure resource for all signals. +# If omitted, the default resource is used. +resource: + # Configure resource attributes. Entries have higher priority than entries from .resource.attributes_list. + # Entries must contain .name and .value, and may optionally include .type. If an entry's .type omitted or null, string is used. + # The .value's type must match the .type. Values for .type include: string, bool, int, double, string_array, bool_array, int_array, double_array. + attributes: + - name: service.name + value: unknown_service + - name: string_key + value: value + type: string + - name: bool_key + value: true + type: bool + - name: int_key + value: 1 + type: int + - name: double_key + value: 1.1 + type: double + - name: string_array_key + value: [ "value1", "value2" ] + type: string_array + - name: bool_array_key + value: [ true, false ] + type: bool_array + - name: int_array_key + value: [ 1, 2 ] + type: int_array + - name: double_array_key + value: [ 1.1, 2.2 ] + type: double_array + # Configure resource attributes. Entries have lower priority than entries from .resource.attributes. + # The value is a list of comma separated key-value pairs matching the format of OTEL_RESOURCE_ATTRIBUTES. See https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/configuration/sdk-environment-variables.md#general-sdk-configuration for details. + # If omitted or null, no resource attributes are added. + attributes_list: "service.namespace=my-namespace,service.version=1.0.0" + # Configure resource detection. + # This type is in development and subject to breaking changes in minor versions. + # If omitted or null, resource detection is disabled. + detection/development: + # Configure attributes provided by resource detectors. + attributes: + # Configure list of attribute key patterns to include from resource detectors. + # Attribute keys from resource detectors are evaluated to match as follows: + # * If the value of the attribute key exactly matches. + # * If the value of the attribute key matches the wildcard pattern, where '?' matches any single character and '*' matches any number of characters including none. + # If omitted, all attributes are included. + included: + - process.* + # Configure list of attribute key patterns to exclude from resource detectors. Applies after .resource.detectors.attributes.included (i.e. excluded has higher priority than included). + # Attribute keys from resource detectors are evaluated to match as follows: + # * If the value of the attribute key exactly matches. + # * If the value of the attribute key matches the wildcard pattern, where '?' matches any single character and '*' matches any number of characters including none. + # If omitted, .included attributes are included. + excluded: + - process.command_args + # Configure resource detectors. + # Resource detector names are dependent on the SDK language ecosystem. Please consult documentation for each respective language. + # If omitted or null, no resource detectors are enabled. + detectors: + - # Enable the container resource detector, which populates container.* attributes. + container: + - # Enable the host resource detector, which populates host.* and os.* attributes. + host: + - # Enable the process resource detector, which populates process.* attributes. + process: + - # Enable the service detector, which populates service.name based on the OTEL_SERVICE_NAME environment variable and service.instance.id. + service: + # Configure resource schema URL. + # If omitted or null, no schema URL is used. + schema_url: https://opentelemetry.io/schemas/1.16.0 +# Configure instrumentation. +# This type is in development and subject to breaking changes in minor versions. +instrumentation/development: + # Configure general SemConv options that may apply to multiple languages and instrumentations. + # Instrumenation may merge general config options with the language specific configuration at .instrumentation.. + general: + # Configure instrumentations following the peer semantic conventions. + # See peer semantic conventions: https://opentelemetry.io/docs/specs/semconv/attributes-registry/peer/ + peer: + # Configure the service mapping for instrumentations following peer.service semantic conventions. + # Each entry is a key value pair where "peer" defines the IP address and "service" defines the corresponding logical name of the service. + # See peer.service semantic conventions: https://opentelemetry.io/docs/specs/semconv/general/attributes/#general-remote-service-attributes + service_mapping: + - peer: 1.2.3.4 + service: FooService + - peer: 2.3.4.5 + service: BarService + # Configure instrumentations following the http semantic conventions. + # See http semantic conventions: https://opentelemetry.io/docs/specs/semconv/http/ + http: + # Configure instrumentations following the http client semantic conventions. + client: + # Configure headers to capture for outbound http requests. + request_captured_headers: + - Content-Type + - Accept + # Configure headers to capture for outbound http responses. + response_captured_headers: + - Content-Type + - Content-Encoding + # Configure instrumentations following the http server semantic conventions. + server: + # Configure headers to capture for inbound http requests. + request_captured_headers: + - Content-Type + - Accept + # Configure headers to capture for outbound http responses. + response_captured_headers: + - Content-Type + - Content-Encoding + # Configure C++ language-specific instrumentation libraries. + cpp: + # Configure the instrumentation corresponding to key "example". + example: + property: "value" + # Configure .NET language-specific instrumentation libraries. + dotnet: + # Configure the instrumentation corresponding to key "example". + example: + property: "value" + # Configure Erlang language-specific instrumentation libraries. + erlang: + # Configure the instrumentation corresponding to key "example". + example: + property: "value" + # Configure Go language-specific instrumentation libraries. + go: + # Configure the instrumentation corresponding to key "example". + example: + property: "value" + # Configure Java language-specific instrumentation libraries. + java: + # Configure the instrumentation corresponding to key "example". + example: + property: "value" + # Configure JavaScript language-specific instrumentation libraries. + js: + # Configure the instrumentation corresponding to key "example". + example: + property: "value" + # Configure PHP language-specific instrumentation libraries. + php: + # Configure the instrumentation corresponding to key "example". + example: + property: "value" + # Configure Python language-specific instrumentation libraries. + python: + # Configure the instrumentation corresponding to key "example". + example: + property: "value" + # Configure Ruby language-specific instrumentation libraries. + ruby: + # Configure the instrumentation corresponding to key "example". + example: + property: "value" + # Configure Rust language-specific instrumentation libraries. + rust: + # Configure the instrumentation corresponding to key "example". + example: + property: "value" + # Configure Swift language-specific instrumentation libraries. + swift: + # Configure the instrumentation corresponding to key "example". + example: + property: "value" diff --git a/functional/configuration/shelltests/propagator_both.test b/functional/configuration/shelltests/propagator_both.test new file mode 100644 index 0000000000..51f6b55daf --- /dev/null +++ b/functional/configuration/shelltests/propagator_both.test @@ -0,0 +1,8 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +$ example_yaml --test --yaml shelltests/propagator_both.yaml +> +MODEL PARSED +SDK CREATED +>= 0 diff --git a/functional/configuration/shelltests/propagator_both.yaml b/functional/configuration/shelltests/propagator_both.yaml new file mode 100644 index 0000000000..ed8a695942 --- /dev/null +++ b/functional/configuration/shelltests/propagator_both.yaml @@ -0,0 +1,10 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +file_format: 0.0 + +propagator: + composite: + - tracecontext: + - baggage: + composite_list: "b3,b3multi" diff --git a/functional/configuration/shelltests/propagator_broken.test b/functional/configuration/shelltests/propagator_broken.test new file mode 100644 index 0000000000..b02b1f9c39 --- /dev/null +++ b/functional/configuration/shelltests/propagator_broken.test @@ -0,0 +1,8 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +$ example_yaml --test --yaml shelltests/propagator_broken.yaml +> +[ERROR] [Yaml Configuration Parser] Parse failed with exception: Illegal composite child 2, properties count: 3 +FAILED TO PARSE MODEL +>= 1 diff --git a/functional/configuration/shelltests/propagator_broken.yaml b/functional/configuration/shelltests/propagator_broken.yaml new file mode 100644 index 0000000000..1e8bfc46a0 --- /dev/null +++ b/functional/configuration/shelltests/propagator_broken.yaml @@ -0,0 +1,13 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +file_format: 0.0 + +propagator: + composite: + # This is ok (child 1) + - tracecontext: + # This is broken (child 2) + - tracecontext: + foo: + bar: diff --git a/functional/configuration/shelltests/propagator_composite_list.test b/functional/configuration/shelltests/propagator_composite_list.test new file mode 100644 index 0000000000..eb39f6fce8 --- /dev/null +++ b/functional/configuration/shelltests/propagator_composite_list.test @@ -0,0 +1,8 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +$ example_yaml --test --yaml shelltests/propagator_composite_list.yaml +> +MODEL PARSED +SDK CREATED +>= 0 diff --git a/functional/configuration/shelltests/propagator_composite_list.yaml b/functional/configuration/shelltests/propagator_composite_list.yaml new file mode 100644 index 0000000000..92688efbc4 --- /dev/null +++ b/functional/configuration/shelltests/propagator_composite_list.yaml @@ -0,0 +1,7 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +file_format: 0.0 + +propagator: + composite_list: "tracecontext,baggage,b3,b3multi" diff --git a/functional/configuration/shelltests/propagator_duplicates.test b/functional/configuration/shelltests/propagator_duplicates.test new file mode 100644 index 0000000000..f63688928c --- /dev/null +++ b/functional/configuration/shelltests/propagator_duplicates.test @@ -0,0 +1,8 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +$ example_yaml --test --yaml shelltests/propagator_duplicates.yaml +> +MODEL PARSED +SDK CREATED +>= 0 diff --git a/functional/configuration/shelltests/propagator_duplicates.yaml b/functional/configuration/shelltests/propagator_duplicates.yaml new file mode 100644 index 0000000000..96a7ba82e5 --- /dev/null +++ b/functional/configuration/shelltests/propagator_duplicates.yaml @@ -0,0 +1,10 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +file_format: 0.0 + +propagator: + composite: + - tracecontext: + - baggage: + composite_list: "tracecontext,baggage,baggage,b3,b3multi" diff --git a/functional/configuration/shelltests/propagator_multi.test b/functional/configuration/shelltests/propagator_multi.test new file mode 100644 index 0000000000..3fd8d069c6 --- /dev/null +++ b/functional/configuration/shelltests/propagator_multi.test @@ -0,0 +1,8 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +$ example_yaml --test --yaml shelltests/propagator_multi.yaml +> +MODEL PARSED +SDK CREATED +>= 0 diff --git a/functional/configuration/shelltests/propagator_multi.yaml b/functional/configuration/shelltests/propagator_multi.yaml new file mode 100644 index 0000000000..e9fe8daa11 --- /dev/null +++ b/functional/configuration/shelltests/propagator_multi.yaml @@ -0,0 +1,11 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +file_format: 0.0 + +propagator: + composite: + - tracecontext: + - baggage: + - b3: + - b3multi: diff --git a/functional/configuration/shelltests/propagator_ottrace.test b/functional/configuration/shelltests/propagator_ottrace.test new file mode 100644 index 0000000000..83c58d7500 --- /dev/null +++ b/functional/configuration/shelltests/propagator_ottrace.test @@ -0,0 +1,9 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +$ example_yaml --test --yaml shelltests/propagator_ottrace.yaml +> +MODEL PARSED +[ERROR] [Configured Sdk] builder failed with exception: CreateTextMapPropagator() no builder for ottrace +FAILED TO CREATE SDK +>= 2 diff --git a/functional/configuration/shelltests/propagator_ottrace.yaml b/functional/configuration/shelltests/propagator_ottrace.yaml new file mode 100644 index 0000000000..c3c4cf2008 --- /dev/null +++ b/functional/configuration/shelltests/propagator_ottrace.yaml @@ -0,0 +1,8 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +file_format: 0.0 + +propagator: + composite: + - ottrace: diff --git a/functional/configuration/shelltests/propagator_single.test b/functional/configuration/shelltests/propagator_single.test new file mode 100644 index 0000000000..ce2586d47e --- /dev/null +++ b/functional/configuration/shelltests/propagator_single.test @@ -0,0 +1,8 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +$ example_yaml --test --yaml shelltests/propagator_single.yaml +> +MODEL PARSED +SDK CREATED +>= 0 diff --git a/functional/configuration/shelltests/propagator_single.yaml b/functional/configuration/shelltests/propagator_single.yaml new file mode 100644 index 0000000000..89cd55c4ad --- /dev/null +++ b/functional/configuration/shelltests/propagator_single.yaml @@ -0,0 +1,8 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +file_format: 0.0 + +propagator: + composite: + - tracecontext: diff --git a/functional/configuration/shelltests/propagator_unknown.test b/functional/configuration/shelltests/propagator_unknown.test new file mode 100644 index 0000000000..9412638fce --- /dev/null +++ b/functional/configuration/shelltests/propagator_unknown.test @@ -0,0 +1,9 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +$ example_yaml --test --yaml shelltests/propagator_unknown.yaml +> +MODEL PARSED +[ERROR] [Configured Sdk] builder failed with exception: CreateTextMapPropagator() no builder for never_hear_of_this_one +FAILED TO CREATE SDK +>= 2 diff --git a/functional/configuration/shelltests/propagator_unknown.yaml b/functional/configuration/shelltests/propagator_unknown.yaml new file mode 100644 index 0000000000..505f105f57 --- /dev/null +++ b/functional/configuration/shelltests/propagator_unknown.yaml @@ -0,0 +1,8 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +file_format: 0.0 + +propagator: + composite: + - never_hear_of_this_one: diff --git a/functional/configuration/shelltests/propagator_xray.test b/functional/configuration/shelltests/propagator_xray.test new file mode 100644 index 0000000000..0ff73021ec --- /dev/null +++ b/functional/configuration/shelltests/propagator_xray.test @@ -0,0 +1,9 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +$ example_yaml --test --yaml shelltests/propagator_xray.yaml +> +MODEL PARSED +[ERROR] [Configured Sdk] builder failed with exception: CreateTextMapPropagator() no builder for xray +FAILED TO CREATE SDK +>= 2 diff --git a/functional/configuration/shelltests/propagator_xray.yaml b/functional/configuration/shelltests/propagator_xray.yaml new file mode 100644 index 0000000000..ebecf43c3a --- /dev/null +++ b/functional/configuration/shelltests/propagator_xray.yaml @@ -0,0 +1,8 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +file_format: 0.0 + +propagator: + composite: + - xray: diff --git a/functional/configuration/shelltests/sampler_jaeger.test b/functional/configuration/shelltests/sampler_jaeger.test new file mode 100644 index 0000000000..402bd28385 --- /dev/null +++ b/functional/configuration/shelltests/sampler_jaeger.test @@ -0,0 +1,10 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +$ example_yaml --test --yaml shelltests/sampler_jaeger.yaml +> +[ERROR] JaegerRemoteSamplerConfiguration: FIXME +MODEL PARSED +[ERROR] [Configured Sdk] builder failed with exception: JaegerRemoteSampler not supported +FAILED TO CREATE SDK +>= 2 diff --git a/functional/configuration/shelltests/sampler_jaeger.yaml b/functional/configuration/shelltests/sampler_jaeger.yaml new file mode 100644 index 0000000000..0439fb0c86 --- /dev/null +++ b/functional/configuration/shelltests/sampler_jaeger.yaml @@ -0,0 +1,12 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +file_format: 0.0 + +tracer_provider: + processors: + simple: + console: + sampler: + # Must fail, not supported in C++ + jaeger_remote: diff --git a/sdk/src/CMakeLists.txt b/sdk/src/CMakeLists.txt index 377d305627..c922726547 100644 --- a/sdk/src/CMakeLists.txt +++ b/sdk/src/CMakeLists.txt @@ -7,3 +7,7 @@ add_subdirectory(metrics) add_subdirectory(logs) add_subdirectory(version) add_subdirectory(resource) + +if(WITH_CONFIGURATION) + add_subdirectory(configuration) +endif() diff --git a/sdk/src/configuration/CMakeLists.txt b/sdk/src/configuration/CMakeLists.txt new file mode 100644 index 0000000000..4b073f64a1 --- /dev/null +++ b/sdk/src/configuration/CMakeLists.txt @@ -0,0 +1,42 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +add_library( + opentelemetry_configuration + configuration_parser.cc + document_node.cc + yaml_configuration_parser.cc + ryml_document.cc + ryml_document_node.cc + configured_sdk.cc + sdk_builder.cc + registry.cc) + +set_target_properties(opentelemetry_configuration PROPERTIES EXPORT_NAME + configuration) +set_target_version(opentelemetry_configuration) + +target_include_directories( + opentelemetry_configuration + PUBLIC "$") + +target_link_libraries(opentelemetry_configuration PUBLIC opentelemetry_api + opentelemetry_common) + +# target_link_libraries( opentelemetry_configuration PUBLIC yaml-cpp::yaml-cpp) + +target_link_libraries(opentelemetry_configuration PUBLIC ryml::ryml) + +if(OPENTELEMETRY_INSTALL) + install( + TARGETS opentelemetry_configuration + EXPORT "${PROJECT_NAME}-target" + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + + opentelemetry_add_pkgconfig( + configuration "OpenTelemetry SDK - Configuration" + "Components for exporting traces in the OpenTelemetry SDK." + "opentelemetry_configuration") +endif() diff --git a/sdk/src/configuration/sdk_builder.cc b/sdk/src/configuration/sdk_builder.cc index c084ef930c..0da1af86dc 100644 --- a/sdk/src/configuration/sdk_builder.cc +++ b/sdk/src/configuration/sdk_builder.cc @@ -1490,12 +1490,8 @@ void SdkBuilder::AddView( sdk_attribute_processor = CreateAttributesProcessor(stream->attribute_keys); } - // FIXME-SDK: https://github.com/open-telemetry/opentelemetry-cpp/issues/3547 - // FIXME-SDK: unit is unused in class View, should be removed. - std::string unit("FIXME-SDK"); - auto sdk_view = std::make_unique( - stream->name, stream->description, unit, sdk_aggregation_type, sdk_aggregation_config, + stream->name, stream->description, sdk_aggregation_type, sdk_aggregation_config, std::move(sdk_attribute_processor)); view_registry->AddView(std::move(sdk_instrument_selector), std::move(sdk_meter_selector), diff --git a/sdk/test/CMakeLists.txt b/sdk/test/CMakeLists.txt index 33dd07f81a..dd957fae1f 100644 --- a/sdk/test/CMakeLists.txt +++ b/sdk/test/CMakeLists.txt @@ -7,3 +7,7 @@ add_subdirectory(metrics) add_subdirectory(logs) add_subdirectory(resource) add_subdirectory(instrumentationscope) + +if(WITH_CONFIGURATION) + add_subdirectory(configuration) +endif() diff --git a/sdk/test/configuration/CMakeLists.txt b/sdk/test/configuration/CMakeLists.txt new file mode 100644 index 0000000000..3bec414ca4 --- /dev/null +++ b/sdk/test/configuration/CMakeLists.txt @@ -0,0 +1,13 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +foreach(testname yaml_test yaml_propagator_test yaml_trace_test + yaml_resource_test yaml_logs_test yaml_metrics_test) + add_executable(${testname} "${testname}.cc") + target_link_libraries(${testname} ${GTEST_BOTH_LIBRARIES} + ${CMAKE_THREAD_LIBS_INIT} opentelemetry_configuration) + gtest_add_tests( + TARGET ${testname} + TEST_PREFIX trace. + TEST_LIST ${testname}) +endforeach() diff --git a/test_common/cmake/preview-options.cmake b/test_common/cmake/preview-options.cmake index 88acf7a187..8cba637f85 100644 --- a/test_common/cmake/preview-options.cmake +++ b/test_common/cmake/preview-options.cmake @@ -15,3 +15,4 @@ set(WITH_OTLP_GRPC_CREDENTIAL_PREVIEW ${ENABLE_PREVIEW} CACHE BOOL "" FORCE) set(WITH_OTLP_RETRY_PREVIEW ${ENABLE_PREVIEW} CACHE BOOL "" FORCE) set(WITH_OTLP_HTTP_COMPRESSION ${ENABLE_PREVIEW} CACHE BOOL "" FORCE) set(WITH_CURL_LOGGING ${ENABLE_PREVIEW} CACHE BOOL "" FORCE) +set(WITH_CONFIGURATION ${ENABLE_PREVIEW} CACHE BOOL "" FORCE) diff --git a/tools/format.sh b/tools/format.sh index 3a3863a8ea..d551ab21dd 100755 --- a/tools/format.sh +++ b/tools/format.sh @@ -23,8 +23,8 @@ fi # No CRLF line endings, except Windows files. "${SED[@]}" 's/\r$//' $($FIND -name '*.ps1' -prune -o \ -name '*.cmd' -prune -o -type f -print) -# No trailing spaces, except in patch. -"${SED[@]}" 's/ \+$//' $($FIND -name "*.patch" -prune -o -type f -print) +# No trailing spaces, except in patch, yaml and shelltest. +"${SED[@]}" 's/ \+$//' $($FIND -name "*.patch" -prune -o -name "*.yaml" -prune -o -name "*.test" -prune -o -type f -print) # If not overridden, try to use clang-format-18 or clang-format. if [[ -z "$CLANG_FORMAT" ]]; then