Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/clang-tidy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/iwyu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,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)

#
# We do not want to have WITH_ABI_VERSION = "1" or "2", and instead prefer two
# distinct flags, WITH_ABI_VERSION_1 and WITH_ABI_VERSION_2.
Expand Down Expand Up @@ -349,6 +351,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.9.0 REQUIRED)
message(
STATUS
"Found ryml: include ${RYML_INCLUDE_DIR}, lib ${RYML_LIB_DIR}, version ${ryml_VERSION}"
)
endif()

#
# Do we need OpenTracing ?
#
Expand Down
25 changes: 25 additions & 0 deletions ci/do_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,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 *
Expand Down
32 changes: 32 additions & 0 deletions ci/install_ryml.sh
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ add_subdirectory(multi_processor)
if(WITH_EXAMPLES_HTTP)
add_subdirectory(http)
endif()

if(WITH_CONFIGURATION)
add_subdirectory(configuration)
endif()
86 changes: 86 additions & 0 deletions examples/configuration/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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()
Loading
Loading