opentelemetry-cpp icon indicating copy to clipboard operation
opentelemetry-cpp copied to clipboard

[CONFIGURATION] Split programmatic and YAML cmake targets

Open pranitaurlam opened this issue 5 months ago • 5 comments

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

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

cc @lalitb @marcalff @lalitb @dbarker @ThomsonTan

pranitaurlam avatar Jun 07 '26 18:06 pranitaurlam

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

  • :white_check_mark: login: pranitaurlam / name: pranitaurlam (2a5f743016f4bc571e0d337ad8a62c25708b9344, 9c36d754b3c387e48c3d6893846b16e238432d12, a7a35d474fc2bb059223a5fbd349fa7fa6108862, e3d85122fab7c5dcbee4eecd291904c46329f096, eab1f2b1187181a67da0883cd120b74f754f76b3, efe4b1285354b30bf7c6e3e8ed9cf0865bd21114)

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!

pranitaurlam avatar Jun 07 '26 18:06 pranitaurlam

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 82.82%. Comparing base (17c4723) to head (499e3ac). :warning: Report is 51 commits behind head on main.

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% <ø> (ø)
:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Jun 07 '26 21:06 codecov[bot]

@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.

dbarker avatar Jun 15 '26 21:06 dbarker

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.

marcalff avatar Jun 16 '26 18:06 marcalff

Hi @pranitaurlam, just checking in. Are you still working on this PR and have any questions based on comments above?

dbarker avatar Jun 29 '26 21:06 dbarker