Skip to content

Commit a1c25f1

Browse files
committed
merged from upstream
2 parents a47f4b1 + 064dfe3 commit a1c25f1

35 files changed

+1306
-54
lines changed

.github/workflows/ci.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,45 @@ jobs:
182182
run: |
183183
(cd ./functional/otlp; ./run_test.sh)
184184
185+
cmake_clang_yaml_config:
186+
name: CMake clang 18 (maintainer mode, yaml config)
187+
runs-on: ubuntu-24.04
188+
env:
189+
CC: /usr/bin/clang-18
190+
CXX: /usr/bin/clang++-18
191+
CXX_STANDARD: '14'
192+
steps:
193+
- name: Harden the runner (Audit all outbound calls)
194+
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
195+
with:
196+
egress-policy: audit
197+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
198+
with:
199+
submodules: 'recursive'
200+
- name: setup
201+
run: |
202+
sudo -E ./ci/setup_ci_environment.sh
203+
- name: install dependencies
204+
run: |
205+
sudo -E ./ci/install_thirdparty.sh --install-dir /usr/local --tags-file third_party_release
206+
- name: run cmake clang (maintainer mode, sync)
207+
run: |
208+
./ci/do_ci.sh cmake.maintainer.yaml.test
209+
- name: install shelltest
210+
run: sudo apt update && sudo apt-get install -y shelltestrunner
211+
- name: generate test cert
212+
env:
213+
CFSSL_VERSION: 1.6.3
214+
run: |
215+
sudo -E ./tools/setup-cfssl.sh
216+
(cd ./functional/cert; ./generate_cert.sh)
217+
- name: run otlp func test
218+
run: |
219+
(cd ./functional/otlp; ./run_test.sh)
220+
- name: run configuration func test
221+
run: |
222+
(cd ./functional/configuration; ./run_test.sh)
223+
185224
cmake_clang_maintainer_async_test:
186225
name: CMake clang 18 (maintainer mode, async)
187226
runs-on: ubuntu-24.04

.github/workflows/clang-tidy.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ jobs:
1717
matrix:
1818
include:
1919
- cmake_options: all-options-abiv1-preview
20-
warning_limit: 61
20+
warning_limit: 63
2121
- cmake_options: all-options-abiv2-preview
22-
warning_limit: 61
22+
warning_limit: 63
2323
steps:
2424
- name: Harden the runner (Audit all outbound calls)
2525
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
@@ -49,6 +49,12 @@ jobs:
4949
libgtest-dev \
5050
libbenchmark-dev
5151
52+
- name: Install rapidyaml
53+
run: |
54+
sudo -E ./ci/install_thirdparty.sh --install-dir /usr/local --tags-file third_party_release --packages "ryml"
55+
56+
- name: Check clang-tidy
57+
run: |
5258
if ! command -v clang-tidy &> /dev/null; then
5359
echo "clang-tidy could not be found"
5460
exit 1

.github/workflows/iwyu.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,15 @@ jobs:
5353
llvm-dev \
5454
libclang-dev \
5555
cmake
56+
57+
- name: Install rapidyaml
58+
run: |
59+
sudo -E ./ci/install_thirdparty.sh --install-dir /usr/local --tags-file third_party_release --packages "ryml"
60+
5661
- name: Install include-what-you-use
5762
run: |
5863
sudo ./ci/install_iwyu.sh
64+
5965
- name: Prepare CMake
6066
env:
6167
CC: clang

.iwyu.imp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,17 @@
1111
{ "include": ["<bits/types/struct_tm.h>", "private", "<time.h>", "public"] },
1212
{ "include": ["<bits/types/struct_FILE.h>", "private", "<stdio.h>", "public"] },
1313

14+
# Work around for ryml
15+
{ "include": ["<c4/std/string.hpp>", "private", "<ryml_std.hpp>", "public"] },
16+
17+
{ "include": ["<c4/yml/node.hpp>", "private", "<ryml.hpp>", "public"] },
18+
{ "include": ["<c4/yml/parse.hpp>", "private", "<ryml.hpp>", "public"] },
19+
{ "include": ["<c4/yml/parse_engine.hpp>", "private", "<ryml.hpp>", "public"] },
20+
{ "include": ["<c4/yml/tree.hpp>", "private", "<ryml.hpp>", "public"] },
21+
{ "include": ["<c4/yml/event_handler_tree.hpp>", "private", "<ryml.hpp>", "public"] },
22+
{ "include": ["<c4/substr.hpp>", "private", "<ryml.hpp>", "public"] },
23+
{ "include": ["<c4/substr_fwd.hpp>", "private", "<ryml.hpp>", "public"] },
24+
1425
# Local opentelemetry-cpp style
1526

1627
# We prefer to include <gtest/gtest.h> for simplicity

CMakeLists.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ endif()
6666
option(WITH_ABI_VERSION_1 "ABI version 1" ON)
6767
option(WITH_ABI_VERSION_2 "EXPERIMENTAL: ABI version 2 preview" OFF)
6868

69+
option(WITH_CONFIGURATION "EXPERIMENTAL: YAML configuration file" OFF)
70+
6971
#
7072
# We do not want to have WITH_ABI_VERSION = "1" or "2", and instead prefer two
7173
# distinct flags, WITH_ABI_VERSION_1 and WITH_ABI_VERSION_2.
@@ -349,6 +351,14 @@ if((NOT WITH_API_ONLY) AND USE_NLOHMANN_JSON)
349351
include("${opentelemetry-cpp_SOURCE_DIR}/cmake/nlohmann-json.cmake")
350352
endif()
351353

354+
#
355+
# Do we need RapidYaml ?
356+
#
357+
358+
if((NOT WITH_API_ONLY) AND WITH_CONFIGURATION)
359+
include("${opentelemetry-cpp_SOURCE_DIR}/cmake/ryml.cmake")
360+
endif()
361+
352362
#
353363
# Do we need OpenTracing ?
354364
#
@@ -499,6 +509,7 @@ message(STATUS "WITH_ELASTICSEARCH: ${WITH_ELASTICSEARCH}")
499509
message(STATUS "WITH_OPENTRACING: ${WITH_OPENTRACING}")
500510
message(STATUS "WITH_ETW: ${WITH_ETW}")
501511
message(STATUS "OPENTELEMETRY_BUILD_DLL: ${OPENTELEMETRY_BUILD_DLL}")
512+
message(STATUS "WITH_CONFIGURATION: ${WITH_CONFIGURATION}")
502513

503514
message(STATUS "---------------------------------------------")
504515
message(STATUS "feature preview options")
@@ -580,6 +591,9 @@ if(WITH_OPENTRACING)
580591
message(
581592
STATUS "opentracing-cpp: ${OpenTracing_VERSION} (${OpenTracing_PROVIDER})")
582593
endif()
594+
if(ryml_VERSION)
595+
message(STATUS "ryml: ${ryml_VERSION} (${ryml_PROVIDER})")
596+
endif()
583597
message(STATUS "---------------------------------------------")
584598

585599
include("${opentelemetry-cpp_SOURCE_DIR}/cmake/otel-install-functions.cmake")

MODULE.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ single_version_override(
1616
],
1717
)
1818

19+
bazel_dep(name = "rapidyaml", version = "0.9.0")
1920
bazel_dep(name = "curl", version = "8.8.0.bcr.4")
2021
bazel_dep(name = "depend_on_what_you_use", version = "0.10.0")
2122
bazel_dep(name = "google_benchmark", version = "1.9.4")

ci/do_ci.sh

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,31 @@ elif [[ "$1" == "cmake.maintainer.abiv2.test" ]]; then
171171
eval "$MAKE_COMMAND"
172172
make test
173173
exit 0
174+
elif [[ "$1" == "cmake.maintainer.yaml.test" ]]; then
175+
cd "${BUILD_DIR}"
176+
rm -rf *
177+
cmake "${CMAKE_OPTIONS[@]}" \
178+
-DWITH_OTLP_HTTP=ON \
179+
-DWITH_OTLP_GRPC=ON \
180+
-DWITH_OTLP_FILE=ON \
181+
-DWITH_PROMETHEUS=ON \
182+
-DWITH_EXAMPLES=ON \
183+
-DWITH_EXAMPLES_HTTP=ON \
184+
-DWITH_ZIPKIN=ON \
185+
-DBUILD_W3CTRACECONTEXT_TEST=ON \
186+
-DWITH_ELASTICSEARCH=ON \
187+
-DWITH_METRICS_EXEMPLAR_PREVIEW=ON \
188+
-DWITH_ASYNC_EXPORT_PREVIEW=OFF \
189+
-DOTELCPP_MAINTAINER_MODE=ON \
190+
-DWITH_NO_DEPRECATED_CODE=ON \
191+
-DWITH_OTLP_HTTP_COMPRESSION=ON \
192+
-DWITH_OTLP_RETRY_PREVIEW=ON \
193+
-DWITH_THREAD_INSTRUMENTATION_PREVIEW=ON \
194+
-DWITH_CONFIGURATION=ON \
195+
"${SRC_DIR}"
196+
eval "$MAKE_COMMAND"
197+
make test
198+
exit 0
174199
elif [[ "$1" == "cmake.with_async_export.test" ]]; then
175200
cd "${BUILD_DIR}"
176201
rm -rf *
@@ -511,8 +536,11 @@ EOF
511536
examples/plugin/load/load_plugin_example ${PLUGIN_DIR}/libexample_plugin.so /dev/null
512537
exit 0
513538
elif [[ "$1" == "bazel.no_bzlmod.test" ]]; then
514-
bazel $BAZEL_STARTUP_OPTIONS build --enable_bzlmod=false $BAZEL_OPTIONS //...
515-
bazel $BAZEL_STARTUP_OPTIONS test --enable_bzlmod=false $BAZEL_TEST_OPTIONS //...
539+
# Rapidyaml 0.9.0 as is does not support bazel,
540+
# modules in bazel central repository required
541+
# to build configuration.
542+
bazel $BAZEL_STARTUP_OPTIONS build --enable_bzlmod=false $BAZEL_OPTIONS -- //... -//examples/configuration/... -//sdk/src/configuration/... -//sdk/test/configuration/...
543+
bazel $BAZEL_STARTUP_OPTIONS test --enable_bzlmod=false $BAZEL_TEST_OPTIONS -- //... -//examples/configuration/... -//sdk/src/configuration/... -//sdk/test/configuration/...
516544
exit 0
517545
elif [[ "$1" == "bazel.test" ]]; then
518546
bazel $BAZEL_STARTUP_OPTIONS build $BAZEL_OPTIONS $BAZEL_WITH_PREVIEW //...
@@ -539,8 +567,8 @@ elif [[ "$1" == "bazel.noexcept" ]]; then
539567
# there are some exceptions and error handling code from the Prometheus Client
540568
# as well as Opentracing shim (due to some third party code in its Opentracing dependency)
541569
# that make this test always fail. Ignore these packages in the noexcept test here.
542-
bazel $BAZEL_STARTUP_OPTIONS build --copt=-fno-exceptions $BAZEL_OPTIONS_ASYNC -- //... -//exporters/prometheus/... -//examples/prometheus/... -//opentracing-shim/...
543-
bazel $BAZEL_STARTUP_OPTIONS test --copt=-fno-exceptions $BAZEL_TEST_OPTIONS_ASYNC -- //... -//exporters/prometheus/... -//examples/prometheus/... -//opentracing-shim/...
570+
bazel $BAZEL_STARTUP_OPTIONS build --copt=-fno-exceptions $BAZEL_OPTIONS_ASYNC -- //... -//exporters/prometheus/... -//examples/prometheus/... -//opentracing-shim/... -//examples/configuration/... -//sdk/src/configuration/... -//sdk/test/configuration/...
571+
bazel $BAZEL_STARTUP_OPTIONS test --copt=-fno-exceptions $BAZEL_TEST_OPTIONS_ASYNC -- //... -//exporters/prometheus/... -//examples/prometheus/... -//opentracing-shim/... -//examples/configuration/... -//sdk/src/configuration/... -//sdk/test/configuration/...
544572
exit 0
545573
elif [[ "$1" == "bazel.nortti" ]]; then
546574
# there are some exceptions and error handling code from the Prometheus Client

cmake/ryml.cmake

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Copyright The OpenTelemetry Authors
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# Import the rapidyaml target (ryml::ryml).
5+
# 1. Find an installed ryml package
6+
# 2. Use FetchContent to fetch and build ryml from GitHub
7+
8+
find_package(ryml QUIET)
9+
set(ryml_PROVIDER "find_package")
10+
11+
if(NOT ryml_FOUND)
12+
FetchContent_Declare(
13+
"ryml"
14+
GIT_REPOSITORY "https://github.com/biojppm/rapidyaml.git"
15+
GIT_TAG "${ryml_GIT_TAG}"
16+
)
17+
set(ryml_PROVIDER "fetch_repository")
18+
19+
set(RYML_ENABLE_TESTING OFF CACHE BOOL "" FORCE)
20+
set(RYML_ENABLE_INSTALL OFF CACHE BOOL "" FORCE)
21+
22+
FetchContent_MakeAvailable(ryml)
23+
24+
# Set the ryml_VERSION variable from the git tag.
25+
string(REGEX REPLACE "^v([0-9]+\\.[0-9]+\\.[0-9]+)$" "\\1" ryml_VERSION "${ryml_GIT_TAG}")
26+
endif()
27+
28+
if(NOT TARGET ryml::ryml)
29+
message(FATAL_ERROR "The required ryml::ryml target was not imported")
30+
endif()

cmake/thirdparty-dependency-config.cmake

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ set(OTEL_THIRDPARTY_DEPENDENCIES_SUPPORTED
1616
gRPC
1717
prometheus-cpp
1818
OpenTracing
19+
ryml
1920
)
2021

2122
#-----------------------------------------------------------------------
@@ -26,7 +27,7 @@ set(OTEL_THIRDPARTY_DEPENDENCIES_SUPPORTED
2627
set(OTEL_Protobuf_TARGET_NAMESPACE "protobuf")
2728

2829
#-----------------------------------------------------------------------
29-
# Set the find_dependecy search mode - empty is default. Options: cmake default (empty string ""), "MODULE", or "CONFIG"
30+
# Set the find_dependency search mode - empty is default. Options: cmake default (empty string ""), "MODULE", or "CONFIG"
3031
# # set(OTEL_<dependency>_SEARCH_MODE "<search mode>")
3132
#-----------------------------------------------------------------------
3233
set(OTEL_Threads_SEARCH_MODE "")
@@ -37,6 +38,7 @@ set(OTEL_nlohmann_json_SEARCH_MODE "CONFIG")
3738
set(OTEL_gRPC_SEARCH_MODE "CONFIG")
3839
set(OTEL_prometheus-cpp_SEARCH_MODE "CONFIG")
3940
set(OTEL_OpenTracing_SEARCH_MODE "CONFIG")
41+
set(OTEL_ryml_SEARCH_MODE "")
4042

4143
# The search mode is set to "CONFIG" for Protobuf versions >= 3.22.0
4244
# to find Protobuf's abseil dependency properly until the FindProtobuf module is updated support the upstream protobuf-config.cmake.
@@ -45,4 +47,4 @@ if(DEFINED Protobuf_VERSION AND Protobuf_VERSION VERSION_GREATER_EQUAL 3.22.0)
4547
set(OTEL_Protobuf_SEARCH_MODE "CONFIG")
4648
else()
4749
set(OTEL_Protobuf_SEARCH_MODE "")
48-
endif()
50+
endif()

examples/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,7 @@ add_subdirectory(multi_processor)
3131
if(WITH_EXAMPLES_HTTP)
3232
add_subdirectory(http)
3333
endif()
34+
35+
if(WITH_CONFIGURATION)
36+
add_subdirectory(configuration)
37+
endif()

0 commit comments

Comments
 (0)