Skip to content

[CONFIGURATION] Split programmatic and YAML cmake targets#4138

Open
pranitaurlam wants to merge 8 commits into
open-telemetry:mainfrom
pranitaurlam:feat/split-configuration-cmake-targets
Open

[CONFIGURATION] Split programmatic and YAML cmake targets#4138
pranitaurlam wants to merge 8 commits into
open-telemetry:mainfrom
pranitaurlam:feat/split-configuration-cmake-targets

Conversation

@pranitaurlam

@pranitaurlam pranitaurlam commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Fixes #4134

Summary

  • Splits opentelemetry_configuration into two CMake targets:
    • opentelemetry_configuration: programmatic configuration only (sdk_builder.cc, configured_sdk.cc, registry.cc, configuration_parser.cc, document_node.cc, composable sampler builders). No ryml dependency. Built unconditionally as part of the SDK.
    • opentelemetry_configuration_yaml: YAML configuration components (yaml_configuration_parser.cc, ryml_document.cc, ryml_document_node.cc) with the ryml::ryml dependency. Gated by WITH_CONFIGURATION.
  • Repurposes WITH_CONFIGURATION to gate only the YAML/ryml target.
  • Adds a default constructor to Configuration so it can be instantiated programmatically without a Document.
  • Updates cmake component names: configuration_yaml replaces configuration for the YAML component; the configuration component is now the programmatic-only piece included in the SDK.

Test plan

  • Build without WITH_CONFIGURATION and verify opentelemetry_configuration links successfully without ryml
  • Build with WITH_CONFIGURATION=ON and verify both targets build and tests pass
  • Verify the example programmatic configuration from the issue compiles against opentelemetry_configuration alone

cc @lalitb @marcalff @lalitb @dbarker @ThomsonTan

@pranitaurlam pranitaurlam requested a review from a team as a code owner June 7, 2026 18:19
@linux-foundation-easycla

linux-foundation-easycla Bot commented Jun 7, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

Split opentelemetry_configuration into two targets:
- opentelemetry_configuration: programmatic config, no ryml dependency,
  built unconditionally as part of the SDK
- opentelemetry_configuration_yaml: YAML config with ryml dependency,
  gated by WITH_CONFIGURATION

Add default constructor to Configuration for programmatic use.
@pranitaurlam

pranitaurlam commented Jun 7, 2026

Copy link
Copy Markdown
Contributor Author

Hi @lalitb @marcalff @lalitb @dbarker @ThomsonTan

I've opened PR #4138 to resolve issue #4134 — splitting the opentelemetry_configuration CMake target into two separate targets so users can use programmatic configuration without pulling in the ryml dependency.

The EasyCLA check has passed. Could one of you please approve the workflow runs so CI can execute? Any feedback on the implementation is also very welcome.

Thank you!

@codecov

codecov Bot commented Jun 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.82%. Comparing base (17c4723) to head (499e3ac).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #4138   +/-   ##
=======================================
  Coverage   82.82%   82.82%           
=======================================
  Files         406      406           
  Lines       16913    16913           
=======================================
  Hits        14007    14007           
  Misses       2906     2906           
Files with missing lines Coverage Δ
...de/opentelemetry/sdk/configuration/configuration.h 100.00% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

- Restore configuration as standalone install component (not part of sdk)
- Add configuration_yaml to EXPECTED_COMPONENTS in do_ci.sh
- Fix cmake-format in CMakeLists.txt, sdk/src/configuration, sdk/test/configuration
- Add test_configuration_yaml.cc and component_tests/configuration_yaml/
- registry.cc: add missing text_map_propagator.h include (IWYU)
- sdk_builder.cc: replace filter_type.h with exemplar_filter.h (IWYU)
@marcalff marcalff self-assigned this Jun 9, 2026
- cmake-format: put PRIVATE on same line as target in target_link_libraries
- clang-format: move exemplar_filter.h include to alphabetical position
sdk_builder.cc directly uses ExemplarFilterType from
sdk/metrics/exemplar/filter_type.h. The prior commit moved
exemplar_filter.h into alphabetical order but did not restore
this separate metrics SDK header that was originally guarded by
ENABLE_METRICS_EXEMPLAR_PREVIEW. Add it back unconditionally.
@pranitaurlam pranitaurlam force-pushed the feat/split-configuration-cmake-targets branch from c092938 to efe4b12 Compare June 12, 2026 07:41

@marcalff marcalff left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix.

EDIT 2026-06-16: no longer needed due to renaming to opentelemetry_configuration_core, opentelemetry_configuration.

Please add an "Important note" in the CHANGELOG, to explain that user makefiles are affected, and needs to be adjusted, to use the new opentelemetry_configuration_yaml library.

Will merge after that.

@dbarker dbarker left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Please see initial feedback and a question below.

Comment thread install/test/cmake/component_tests/configuration/CMakeLists.txt
Comment thread install/test/cmake/component_tests/configuration/CMakeLists.txt
Comment thread install/test/cmake/component_tests/configuration/CMakeLists.txt

if(NOT TARGET Threads::Threads)
message(FATAL_ERROR "Threads::Threads target not found")
endif()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a check that the ryml target has been imported.

{
public:
Configuration() = default;
Configuration(std::unique_ptr<Document> doc) : doc_(std::move(doc)) {}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is coupling the Configuration class with the parsed document still required?

@dbarker

dbarker commented Jun 15, 2026

Copy link
Copy Markdown
Member

@pranitaurlam Thanks for the contribution. Marc and I discussed the PR in the SIG meeting today and request the following changes to minimize impact on current users of the configuration CMake component and opentelemetry-cpp::configuration CMake target.

Instead of placing the yaml components in the configuration_yaml target we suggest:

  1. Create a new CMake target opentelemetry-cpp::configuration_core to include the programmatic configuration objects. This new target should be built unconditionally with the SDK.
  2. Update the configuration CMake component and opentelemetry-cpp::configuration CMake target to link to configuration_core and include only the yaml objects and ryml dependency. This component and target should still be guarded by the WITH_CONFIGURATION CMake option.

This way current users of the yaml config will continue to link to the opentelemetry-cpp::configuration target and new users of the programmatic config can link to opentelemetry-cpp::configuration_core.

@marcalff

Copy link
Copy Markdown
Member

So, in short:

  • rename opentelemetry-cpp::configuration to opentelemetry-cpp::configuration_core
  • rename opentelemetry-cpp::configuration_yaml to opentelemetry-cpp::configuration

This way, applications using opentelemetry-cpp::configuration in their makefiles will be unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Programmatic Configuration without YAML dependencies

3 participants